当前位置: 首页>>代码示例>>Java>>正文


Java InstanceOfExpression类代码示例

本文整理汇总了Java中org.eclipse.jdt.internal.compiler.ast.InstanceOfExpression的典型用法代码示例。如果您正苦于以下问题:Java InstanceOfExpression类的具体用法?Java InstanceOfExpression怎么用?Java InstanceOfExpression使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


InstanceOfExpression类属于org.eclipse.jdt.internal.compiler.ast包,在下文中一共展示了InstanceOfExpression类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: visit

import org.eclipse.jdt.internal.compiler.ast.InstanceOfExpression; //导入依赖的package包/类
/**
 * @see org.eclipse.jdt.internal.compiler.ASTVisitor#visit(org.eclipse.jdt.internal.compiler.ast.InstanceOfExpression, org.eclipse.jdt.internal.compiler.lookup.BlockScope)
 */
public boolean visit(
	InstanceOfExpression instanceOfExpression,
	BlockScope scope) {

	final int numberOfParens = (instanceOfExpression.bits & ASTNode.ParenthesizedMASK) >> ASTNode.ParenthesizedSHIFT;
	if (numberOfParens > 0) {
		manageOpeningParenthesizedExpression(instanceOfExpression, numberOfParens);
	}
	instanceOfExpression.expression.traverse(this, scope);
	this.scribe.printNextToken(TerminalTokens.TokenNameinstanceof, true);
	this.scribe.space();
	instanceOfExpression.type.traverse(this, scope);

	if (numberOfParens > 0) {
		manageClosingParenthesizedExpression(instanceOfExpression, numberOfParens);
	}
	return false;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:22,代码来源:CodeFormatterVisitor.java

示例2: consumeInstanceOfExpression

import org.eclipse.jdt.internal.compiler.ast.InstanceOfExpression; //导入依赖的package包/类
protected void consumeInstanceOfExpression() {
	// RelationalExpression ::= RelationalExpression 'instanceof' ReferenceType
	//optimize the push/pop

	//by construction, no base type may be used in getTypeReference
	Expression exp;
	this.expressionStack[this.expressionPtr] = exp =
		new InstanceOfExpression(
			this.expressionStack[this.expressionPtr],
			getTypeReference(this.intStack[this.intPtr--]));
	if (exp.sourceEnd == 0) {
		//array on base type....
		exp.sourceEnd = this.scanner.startPosition - 1;
	}
	//the scanner is on the next token already....
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:17,代码来源:Parser.java

示例3: consumeInstanceOfExpressionWithName

import org.eclipse.jdt.internal.compiler.ast.InstanceOfExpression; //导入依赖的package包/类
protected void consumeInstanceOfExpressionWithName() {
	// RelationalExpression_NotName ::= Name instanceof ReferenceType
	//optimize the push/pop

	//by construction, no base type may be used in getTypeReference
	TypeReference reference = getTypeReference(this.intStack[this.intPtr--]);
	pushOnExpressionStack(getUnspecifiedReferenceOptimized());
	Expression exp;
	this.expressionStack[this.expressionPtr] = exp =
		new InstanceOfExpression(
			this.expressionStack[this.expressionPtr],
			reference);
	if (exp.sourceEnd == 0) {
		//array on base type....
		exp.sourceEnd = this.scanner.startPosition - 1;
	}
	//the scanner is on the next token already....
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:19,代码来源:Parser.java

示例4: notCompatibleTypesError

import org.eclipse.jdt.internal.compiler.ast.InstanceOfExpression; //导入依赖的package包/类
public void notCompatibleTypesError(InstanceOfExpression expression, TypeBinding leftType, TypeBinding rightType) {
	String leftName = new String(leftType.readableName());
	String rightName = new String(rightType.readableName());
	String leftShortName = new String(leftType.shortReadableName());
	String rightShortName = new String(rightType.shortReadableName());
	if (leftShortName.equals(rightShortName)){
		leftShortName = leftName;
		rightShortName = rightName;
	}
	this.handle(
		IProblem.IncompatibleTypesInConditionalOperator,
		new String[] {leftName, rightName },
		new String[] {leftShortName, rightShortName },
		expression.sourceStart,
		expression.sourceEnd);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:17,代码来源:ProblemReporter.java

示例5: unnecessaryInstanceof

import org.eclipse.jdt.internal.compiler.ast.InstanceOfExpression; //导入依赖的package包/类
public void unnecessaryInstanceof(InstanceOfExpression instanceofExpression, TypeBinding checkType) {
	int severity = computeSeverity(IProblem.UnnecessaryInstanceof);
	if (severity == ProblemSeverities.Ignore) return;
	TypeBinding expressionType = instanceofExpression.expression.resolvedType;
	this.handle(
		IProblem.UnnecessaryInstanceof,
		new String[]{ new String(expressionType.readableName()), new String(checkType.readableName())},
		new String[]{ new String(expressionType.shortReadableName()), new String(checkType.shortReadableName())},
		severity,
		instanceofExpression.sourceStart,
		instanceofExpression.sourceEnd);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:13,代码来源:ProblemReporter.java

示例6: endVisit

import org.eclipse.jdt.internal.compiler.ast.InstanceOfExpression; //导入依赖的package包/类
@Override
public void endVisit(InstanceOfExpression x, BlockScope scope) {
  try {
    SourceInfo info = makeSourceInfo(x);
    JExpression expr = pop(x.expression);
    JReferenceType testType = (JReferenceType) typeMap.get(x.type.resolvedType);
    push(new JInstanceOf(info, testType, expr));
  } catch (Throwable e) {
    throw translateException(x, e);
  }
}
 
开发者ID:WeTheInternet,项目名称:xapi,代码行数:12,代码来源:GwtAstBuilder.java

示例7: createCanEqual

import org.eclipse.jdt.internal.compiler.ast.InstanceOfExpression; //导入依赖的package包/类
public MethodDeclaration createCanEqual(EclipseNode type, ASTNode source, List<Annotation> onParam) {
	/* protected boolean canEqual(final java.lang.Object other) {
	 *     return other instanceof Outer.Inner.MyType;
	 * }
	 */
	int pS = source.sourceStart; int pE = source.sourceEnd;
	long p = (long)pS << 32 | pE;
	
	char[] otherName = "other".toCharArray();
	
	MethodDeclaration method = new MethodDeclaration(
			((CompilationUnitDeclaration) type.top().get()).compilationResult);
	setGeneratedBy(method, source);
	method.modifiers = toEclipseModifier(AccessLevel.PROTECTED);
	method.returnType = TypeReference.baseTypeReference(TypeIds.T_boolean, 0);
	method.returnType.sourceStart = pS; method.returnType.sourceEnd = pE;
	setGeneratedBy(method.returnType, source);
	method.selector = "canEqual".toCharArray();
	method.thrownExceptions = null;
	method.typeParameters = null;
	method.bits |= Eclipse.ECLIPSE_DO_NOT_TOUCH_FLAG;
	method.bodyStart = method.declarationSourceStart = method.sourceStart = source.sourceStart;
	method.bodyEnd = method.declarationSourceEnd = method.sourceEnd = source.sourceEnd;
	TypeReference objectRef = new QualifiedTypeReference(TypeConstants.JAVA_LANG_OBJECT, new long[] { p, p, p });
	setGeneratedBy(objectRef, source);
	method.arguments = new Argument[] {new Argument(otherName, 0, objectRef, Modifier.FINAL)};
	method.arguments[0].sourceStart = pS; method.arguments[0].sourceEnd = pE;
	if (!onParam.isEmpty()) method.arguments[0].annotations = onParam.toArray(new Annotation[0]);
	setGeneratedBy(method.arguments[0], source);
	
	SingleNameReference otherRef = new SingleNameReference(otherName, p);
	setGeneratedBy(otherRef, source);
	
	TypeReference typeReference = createTypeReference(type, p);
	setGeneratedBy(typeReference, source);
	
	InstanceOfExpression instanceOf = new InstanceOfExpression(otherRef, typeReference);
	instanceOf.sourceStart = pS; instanceOf.sourceEnd = pE;
	setGeneratedBy(instanceOf, source);
	
	ReturnStatement returnStatement = new ReturnStatement(instanceOf, pS, pE);
	setGeneratedBy(returnStatement, source);
	
	method.statements = new Statement[] {returnStatement};
	return method;
}
 
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:47,代码来源:HandleEqualsAndHashCode.java

示例8: visit

import org.eclipse.jdt.internal.compiler.ast.InstanceOfExpression; //导入依赖的package包/类
@Override public boolean visit(InstanceOfExpression node, BlockScope scope) {
	fixPositions(setGeneratedBy(node, source));
	return super.visit(node, scope);
}
 
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:5,代码来源:SetGeneratedByVisitor.java

示例9: createCanEqual

import org.eclipse.jdt.internal.compiler.ast.InstanceOfExpression; //导入依赖的package包/类
public MethodDeclaration createCanEqual(EclipseNode type, ASTNode source, List<Annotation> onParam) {
	/* public boolean canEqual(final java.lang.Object other) {
	 *     return other instanceof Outer.Inner.MyType;
	 * }
	 */
	int pS = source.sourceStart; int pE = source.sourceEnd;
	long p = (long)pS << 32 | pE;
	
	char[] otherName = "other".toCharArray();
	
	MethodDeclaration method = new MethodDeclaration(
			((CompilationUnitDeclaration) type.top().get()).compilationResult);
	setGeneratedBy(method, source);
	method.modifiers = toEclipseModifier(AccessLevel.PROTECTED);
	method.returnType = TypeReference.baseTypeReference(TypeIds.T_boolean, 0);
	method.returnType.sourceStart = pS; method.returnType.sourceEnd = pE;
	setGeneratedBy(method.returnType, source);
	method.selector = "canEqual".toCharArray();
	method.thrownExceptions = null;
	method.typeParameters = null;
	method.bits |= Eclipse.ECLIPSE_DO_NOT_TOUCH_FLAG;
	method.bodyStart = method.declarationSourceStart = method.sourceStart = source.sourceStart;
	method.bodyEnd = method.declarationSourceEnd = method.sourceEnd = source.sourceEnd;
	TypeReference objectRef = new QualifiedTypeReference(TypeConstants.JAVA_LANG_OBJECT, new long[] { p, p, p });
	setGeneratedBy(objectRef, source);
	method.arguments = new Argument[] {new Argument(otherName, 0, objectRef, Modifier.FINAL)};
	method.arguments[0].sourceStart = pS; method.arguments[0].sourceEnd = pE;
	if (!onParam.isEmpty()) method.arguments[0].annotations = onParam.toArray(new Annotation[0]);
	setGeneratedBy(method.arguments[0], source);
	
	SingleNameReference otherRef = new SingleNameReference(otherName, p);
	setGeneratedBy(otherRef, source);
	
	TypeReference typeReference = createTypeReference(type, p);
	setGeneratedBy(typeReference, source);
	
	InstanceOfExpression instanceOf = new InstanceOfExpression(otherRef, typeReference);
	instanceOf.sourceStart = pS; instanceOf.sourceEnd = pE;
	setGeneratedBy(instanceOf, source);
	
	ReturnStatement returnStatement = new ReturnStatement(instanceOf, pS, pE);
	setGeneratedBy(returnStatement, source);
	
	method.statements = new Statement[] {returnStatement};
	return method;
}
 
开发者ID:mobmead,项目名称:EasyMPermission,代码行数:47,代码来源:HandleEqualsAndHashCode.java

示例10: visit

import org.eclipse.jdt.internal.compiler.ast.InstanceOfExpression; //导入依赖的package包/类
public boolean visit(
	InstanceOfExpression instanceOfExpression,
	BlockScope scope) {
		addRealFragment(instanceOfExpression);
		return false;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:7,代码来源:BinaryExpressionFragmentBuilder.java

示例11: createCanEqual

import org.eclipse.jdt.internal.compiler.ast.InstanceOfExpression; //导入依赖的package包/类
private MethodDeclaration createCanEqual(EclipseNode type, ASTNode source) {
	/* public boolean canEqual(final java.lang.Object other) {
	 *     return other instanceof Outer.Inner.MyType;
	 * }
	 */
	int pS = source.sourceStart; int pE = source.sourceEnd;
	long p = (long)pS << 32 | pE;
	
	char[] otherName = "other".toCharArray();
	
	MethodDeclaration method = new MethodDeclaration(
			((CompilationUnitDeclaration) type.top().get()).compilationResult);
	setGeneratedBy(method, source);
	method.modifiers = toEclipseModifier(AccessLevel.PUBLIC);
	method.returnType = TypeReference.baseTypeReference(TypeIds.T_boolean, 0);
	method.returnType.sourceStart = pS; method.returnType.sourceEnd = pE;
	setGeneratedBy(method.returnType, source);
	method.selector = "canEqual".toCharArray();
	method.thrownExceptions = null;
	method.typeParameters = null;
	method.bits |= Eclipse.ECLIPSE_DO_NOT_TOUCH_FLAG;
	method.bodyStart = method.declarationSourceStart = method.sourceStart = source.sourceStart;
	method.bodyEnd = method.declarationSourceEnd = method.sourceEnd = source.sourceEnd;
	TypeReference objectRef = new QualifiedTypeReference(TypeConstants.JAVA_LANG_OBJECT, new long[] { p, p, p });
	setGeneratedBy(objectRef, source);
	method.arguments = new Argument[] {new Argument(otherName, 0, objectRef, Modifier.FINAL)};
	method.arguments[0].sourceStart = pS; method.arguments[0].sourceEnd = pE;
	setGeneratedBy(method.arguments[0], source);
	
	SingleNameReference otherRef = new SingleNameReference(otherName, p);
	setGeneratedBy(otherRef, source);
	
	TypeReference typeReference = createTypeReference(type, p);
	setGeneratedBy(typeReference, source);
	
	InstanceOfExpression instanceOf = new InstanceOfExpression(otherRef, typeReference);
	instanceOf.sourceStart = pS; instanceOf.sourceEnd = pE;
	setGeneratedBy(instanceOf, source);
	
	ReturnStatement returnStatement = new ReturnStatement(instanceOf, pS, pE);
	setGeneratedBy(returnStatement, source);
	
	method.statements = new Statement[] {returnStatement};
	return method;
}
 
开发者ID:redundent,项目名称:lombok,代码行数:46,代码来源:HandleEqualsAndHashCode.java

示例12: visit

import org.eclipse.jdt.internal.compiler.ast.InstanceOfExpression; //导入依赖的package包/类
@Override public boolean visit(InstanceOfExpression node, BlockScope scope) {
	setGeneratedBy(node, source);
	applyOffsetExpression(node);
	return super.visit(node, scope);
}
 
开发者ID:redundent,项目名称:lombok,代码行数:6,代码来源:SetGeneratedByVisitor.java


注:本文中的org.eclipse.jdt.internal.compiler.ast.InstanceOfExpression类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。