/** * @see org.eclipse.jdt.internal.compiler.ASTVisitor#visit(org.eclipse.jdt.internal.compiler.ast.ArrayReference, org.eclipse.jdt.internal.compiler.lookup.BlockScope) */ public boolean visit(ArrayReference arrayReference, BlockScope scope) { final int numberOfParens = (arrayReference.bits & ASTNode.ParenthesizedMASK) >> ASTNode.ParenthesizedSHIFT; if (numberOfParens > 0) { manageOpeningParenthesizedExpression(arrayReference, numberOfParens); } arrayReference.receiver.traverse(this, scope); this.scribe.printNextToken(TerminalTokens.TokenNameLBRACKET, this.preferences.insert_space_before_opening_bracket_in_array_reference); if (this.preferences.insert_space_after_opening_bracket_in_array_reference) { this.scribe.space(); } arrayReference.position.traverse(this, scope); this.scribe.printNextToken(TerminalTokens.TokenNameRBRACKET, this.preferences.insert_space_before_closing_bracket_in_array_reference); if (numberOfParens > 0) { manageClosingParenthesizedExpression(arrayReference, numberOfParens); } return false; }
protected void consumeArrayAccess(boolean unspecifiedReference) { // ArrayAccess ::= Name '[' Expression ']' ==> true // ArrayAccess ::= PrimaryNoNewArray '[' Expression ']' ==> false //optimize push/pop Expression exp; if (unspecifiedReference) { exp = this.expressionStack[this.expressionPtr] = new ArrayReference( getUnspecifiedReferenceOptimized(), this.expressionStack[this.expressionPtr]); } else { this.expressionPtr--; this.expressionLengthPtr--; exp = this.expressionStack[this.expressionPtr] = new ArrayReference( this.expressionStack[this.expressionPtr], this.expressionStack[this.expressionPtr + 1]); } exp.sourceEnd = this.endStatementPosition; }
public void referenceMustBeArrayTypeAt(TypeBinding arrayType, ArrayReference arrayRef) { this.handle( IProblem.ArrayReferenceRequired, new String[] {new String(arrayType.readableName())}, new String[] {new String(arrayType.shortReadableName())}, arrayRef.sourceStart, arrayRef.sourceEnd); }
@Override public void endVisit(ArrayReference x, BlockScope scope) { try { SourceInfo info = makeSourceInfo(x); JExpression position = pop(x.position); JExpression receiver = pop(x.receiver); push(new JArrayRef(info, receiver, position)); } catch (Throwable e) { throw translateException(x, e); } }
@Override public boolean visit(ArrayReference node, BlockScope scope) { fixPositions(setGeneratedBy(node, source)); return super.visit(node, scope); }
public boolean visit(ArrayReference arrayReference, BlockScope scope) { addRealFragment(arrayReference); return false; }
public void arrayReferencePotentialNullReference(ArrayReference arrayReference) { // TODO(stephan): merge with other expressions this.handle(IProblem.ArrayReferencePotentialNullReference, NoArgument, NoArgument, arrayReference.sourceStart, arrayReference.sourceEnd); }
@Override public boolean visit(ArrayReference node, BlockScope scope) { setGeneratedBy(node, source); applyOffsetExpression(node); return super.visit(node, scope); }