@Override public boolean visit(CastExpression castExpression, BlockScope scope) { CastInfo ci = new CastInfo(); //the 8 bits from 21 to 28 represents number of enclosing brackets ci.nrOfBrackets = ((castExpression.bits >>> 21) & 0xF); ci.typeRef = this.references.buildTypeReference(castExpression.type, scope, true); context.casts.add(ci); castExpression.expression.traverse(this, scope); return false; }
public StringBuffer printExpression(int indent, StringBuffer output) { output.append("<SelectOnMessageSend:"); //$NON-NLS-1$ if (!this.receiver.isImplicitThis()) this.receiver.printExpression(0, output).append('.'); output.append(this.selector).append('('); if (this.arguments != null) { for (int i = 0; i < this.arguments.length; i++) { if (i > 0) output.append(", "); //$NON-NLS-1$ this.arguments[i].printExpression(0, output); } } return output.append(")>"); //$NON-NLS-1$ }
/** * @see org.eclipse.jdt.internal.compiler.ast.Expression#optimizedBooleanConstant() */ @Override public Constant optimizedBooleanConstant() { switch(this.resolvedType.id) { case T_boolean : case T_JavaLangBoolean : return this.expression.optimizedBooleanConstant(); } return Constant.NotAConstant; }
public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) { this.receiver.checkNPE(currentScope, flowContext, flowInfo); flowInfo = this.receiver.analyseCode(currentScope, flowContext, flowInfo); return this.position.analyseCode(currentScope, flowContext, flowInfo); }
public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) { this.receiver.checkNPE(currentScope, flowContext, flowInfo, 1); flowInfo = this.receiver.analyseCode(currentScope, flowContext, flowInfo); flowInfo = this.position.analyseCode(currentScope, flowContext, flowInfo); this.position.checkNPEbyUnboxing(currentScope, flowContext, flowInfo); // account for potential ArrayIndexOutOfBoundsException: flowContext.recordAbruptExit(); return flowInfo; }
public void resolve(BlockScope scope) { TypeBinding type = this.condition.resolveTypeExpecting(scope, TypeBinding.BOOLEAN); this.condition.computeConversion(scope, type, type); if (this.action != null) this.action.resolve(scope); }
tagAsUnnecessaryCast(scope, castType); return true; if (!necessary) tagAsUnnecessaryCast(scope, castType); return true; tagAsUnnecessaryCast(scope, castType); return true; tagAsUnnecessaryCast(scope, castType); return true; tagAsUnnecessaryCast(scope, castType); return true; //null is compatible with every thing tagAsUnnecessaryCast(scope, castType); return true; // identity conversion if (exprElementType.isBaseType() || castElementType.isBaseType()) { if (castElementType == exprElementType) { tagAsNeedCheckCast(); return true; return checkCastTypesCompatibility(scope, castElementType, exprElementType, expression); checkUnsafeCast(scope, castType, expressionType, null /*no match*/, true); return checkCastTypesCompatibility(scope, ((TypeVariableBinding)castType).upperBound(), expressionType, expression);
public void generateAssignment(BlockScope currentScope, CodeStream codeStream, Assignment assignment, boolean valueRequired) { int pc = codeStream.position; FieldBinding codegenBinding = this.binding.original(); this.receiver.generateCode(currentScope, codeStream, !codegenBinding.isStatic()); codeStream.recordPositionsFrom(pc, this.sourceStart); assignment.expression.generateCode(currentScope, codeStream, true); fieldStore(currentScope, codeStream, codegenBinding, this.syntheticAccessors == null ? null : this.syntheticAccessors[FieldReference.WRITE], this.actualReceiverType, this.receiver.isImplicitThis(), valueRequired); if (valueRequired) { codeStream.generateImplicitConversion(assignment.implicitConversion); } // no need for generic cast as value got dupped }
this.right.generateOptimizedBoolean(currentScope, codeStream, (inline ? trueLabel : falseLabel), (inline ? falseLabel : trueLabel), valueRequired); return; this.left.generateOptimizedBoolean(currentScope, codeStream, (inline ? trueLabel : falseLabel), (inline ? falseLabel : trueLabel), valueRequired); return; this.left.generateCode(currentScope, codeStream, valueRequired); this.right.generateCode(currentScope, codeStream, valueRequired); int pc = codeStream.position; if (valueRequired) {
tagAsUnnecessaryCast(scope, castType); return true; if (!necessary) tagAsUnnecessaryCast(scope, castType); return true; tagAsUnnecessaryCast(scope, castType); return true; tagAsUnnecessaryCast(scope, castType); return true; tagAsUnnecessaryCast(scope, castType); return true; //null is compatible with every thing tagAsUnnecessaryCast(scope, castType); return true; // identity conversion if (exprElementType.isBaseType() || castElementType.isBaseType()) { if (castElementType == exprElementType) { tagAsNeedCheckCast(); return true; return checkCastTypesCompatibility(scope, castElementType, exprElementType, expression); checkUnsafeCast(scope, castType, expressionType, null /*no match*/, true); return checkCastTypesCompatibility(scope, ((TypeVariableBinding)castType).upperBound(), expressionType, expression);
@Override public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) { FlowInfo result = this.expression .analyseCode(currentScope, flowContext, flowInfo) .unconditionalInits(); this.expression.checkNPEbyUnboxing(currentScope, flowContext, flowInfo); // account for pot. CCE: flowContext.recordAbruptExit(); return result; }
/** * Expression statements are plain expressions, however they generate like * normal expressions with no value required. * * @param currentScope org.eclipse.jdt.internal.compiler.lookup.BlockScope * @param codeStream org.eclipse.jdt.internal.compiler.codegen.CodeStream */ public void generateCode(BlockScope currentScope, CodeStream codeStream) { if ((this.bits & ASTNode.IsReachable) == 0) { return; } generateCode(currentScope, codeStream, false); }
this.expression.generateOptimizedBoolean( currentScope, codeStream,
public boolean checkNPE(BlockScope scope, FlowContext flowContext, FlowInfo flowInfo, int ttlForFieldCheck) { if((this.resolvedType.tagBits & TagBits.AnnotationNonNull) != 0) { return true; } checkNPEbyUnboxing(scope, flowContext, flowInfo); return this.expression.checkNPE(scope, flowContext, flowInfo, ttlForFieldCheck); }
@Override public boolean receiverIsImplicitThis() { return this.receiver.isImplicitThis(); } // -- interface Invocation: --
public FlowInfo analyseAssignment(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo, Assignment assignment, boolean compoundAssignment) { // TODO (maxime) optimization: unconditionalInits is applied to all existing calls if (assignment.expression == null) { return analyseCode(currentScope, flowContext, flowInfo); } return assignment .expression .analyseCode( currentScope, flowContext, analyseCode(currentScope, flowContext, flowInfo).unconditionalInits()); }
tagAsUnnecessaryCast(scope, castType); return true; if (!necessary) tagAsUnnecessaryCast(scope, castType); return true; tagAsUnnecessaryCast(scope, castType); return true; tagAsUnnecessaryCast(scope, castType); return true; tagAsUnnecessaryCast(scope, castType); return true; //null is compatible with every thing tagAsUnnecessaryCast(scope, castType); return true; // identity conversion if (exprElementType.isBaseType() || castElementType.isBaseType()) { if (castElementType == exprElementType) { tagAsNeedCheckCast(); return true; return checkCastTypesCompatibility(scope, castElementType, exprElementType, expression); checkUnsafeCast(scope, castType, expressionType, null /*no match*/, true); return checkCastTypesCompatibility(scope, ((TypeVariableBinding)castType).upperBound(), expressionType, expression);
public void resolve(BlockScope scope) { TypeBinding type = this.condition.resolveTypeExpecting(scope, TypeBinding.BOOLEAN); this.condition.computeConversion(scope, type, type); if (this.action != null) this.action.resolve(scope); }
public void generateAssignment(BlockScope currentScope, CodeStream codeStream, Assignment assignment, boolean valueRequired) { int pc = codeStream.position; FieldBinding codegenBinding = this.binding.original(); this.receiver.generateCode(currentScope, codeStream, !codegenBinding.isStatic()); codeStream.recordPositionsFrom(pc, this.sourceStart); assignment.expression.generateCode(currentScope, codeStream, true); fieldStore(currentScope, codeStream, codegenBinding, this.syntheticAccessors == null ? null : this.syntheticAccessors[FieldReference.WRITE], this.actualReceiverType, this.receiver.isImplicitThis(), valueRequired); if (valueRequired) { codeStream.generateImplicitConversion(assignment.implicitConversion); } // no need for generic cast as value got dupped }
this.assertExpression.generateOptimizedBoolean(currentScope, codeStream, (falseLabel = new BranchLabel(codeStream)), null , true); codeStream.newJavaLangAssertionError(); codeStream.dup(); if (this.exceptionArgument != null) { this.exceptionArgument.generateCode(currentScope, codeStream, true); codeStream.invokeJavaLangAssertionErrorConstructor(this.exceptionArgument.implicitConversion & 0xF); } else {