/** * @see org.eclipse.jdt.internal.compiler.ASTVisitor#visit(org.eclipse.jdt.internal.compiler.ast.QualifiedSuperReference, org.eclipse.jdt.internal.compiler.lookup.BlockScope) */ public boolean visit( QualifiedSuperReference qualifiedSuperReference, BlockScope scope) { final int numberOfParens = (qualifiedSuperReference.bits & ASTNode.ParenthesizedMASK) >> ASTNode.ParenthesizedSHIFT; if (numberOfParens > 0) { manageOpeningParenthesizedExpression(qualifiedSuperReference, numberOfParens); } qualifiedSuperReference.qualification.traverse(this, scope); this.scribe.printNextToken(TerminalTokens.TokenNameDOT); this.scribe.printNextToken(TerminalTokens.TokenNamesuper); if (numberOfParens > 0) { manageClosingParenthesizedExpression(qualifiedSuperReference, numberOfParens); } return false; }
public Expression convert(org.eclipse.jdt.internal.compiler.ast.ThisReference reference) { if (reference.isImplicitThis()) { // There is no source associated with an implicit this return null; } else if (reference instanceof org.eclipse.jdt.internal.compiler.ast.QualifiedSuperReference) { return convert((org.eclipse.jdt.internal.compiler.ast.QualifiedSuperReference) reference); } else if (reference instanceof org.eclipse.jdt.internal.compiler.ast.QualifiedThisReference) { return convert((org.eclipse.jdt.internal.compiler.ast.QualifiedThisReference) reference); } else { ThisExpression thisExpression = new ThisExpression(this.ast); thisExpression.setSourceRange(reference.sourceStart, reference.sourceEnd - reference.sourceStart + 1); if (this.resolveBindings) { recordNodes(thisExpression, reference); recordPendingThisExpressionScopeResolution(thisExpression); } return thisExpression; } }
protected void consumePrimaryNoNewArrayNameSuper() { // PrimaryNoNewArray ::= Name '.' 'super' // handle type arguments pushOnGenericsIdentifiersLengthStack(this.identifierLengthStack[this.identifierLengthPtr]); pushOnGenericsLengthStack(0); // javac does not accept annotations here anywhere ... TypeReference typeReference = getTypeReference(0); rejectIllegalTypeAnnotations(typeReference); pushOnExpressionStack( new QualifiedSuperReference( typeReference, this.intStack[this.intPtr--], this.endPosition)); }
@Override public void endVisit(QualifiedSuperReference x, BlockScope scope) { try { // Oddly enough, super refs can be modeled as this refs, because // whatever expression they qualify has already been resolved. endVisit((QualifiedThisReference) x, scope); } catch (Throwable e) { throw translateException(x, e); } }
@Override public boolean visit(QualifiedSuperReference node, BlockScope scope) { fixPositions(setGeneratedBy(node, source)); return super.visit(node, scope); }
@Override public boolean visit(QualifiedSuperReference node, ClassScope scope) { fixPositions(setGeneratedBy(node, source)); return super.visit(node, scope); }
public boolean visit( QualifiedSuperReference qualifiedSuperReference, BlockScope scope) { addRealFragment(qualifiedSuperReference); return false; }
public Name convert(org.eclipse.jdt.internal.compiler.ast.QualifiedSuperReference reference) { return convert(reference.qualification); }
@Override public void endVisit(MessageSend x, BlockScope scope) { try { SourceInfo info = makeSourceInfo(x); JMethod method = typeMap.get(x.binding); List<JExpression> arguments = popCallArgs(info, x.arguments, x.binding); JExpression receiver = pop(x.receiver); if (x.receiver instanceof ThisReference) { if (method.isStatic()) { // don't bother qualifying it, it's a no-op receiver = null; } else if ((x.bits & ASTNode.DepthMASK) != 0) { // outer method can be reached through emulation if implicit access ReferenceBinding targetType = scope.enclosingSourceType().enclosingTypeAt( (x.bits & ASTNode.DepthMASK) >> ASTNode.DepthSHIFT); receiver = makeThisReference(info, targetType, true, scope); } else if (x.receiver.sourceStart == 0) { // Synthetic this ref with bad source info; fix the info. JThisRef oldRef = (JThisRef) receiver; receiver = new JThisRef(info, oldRef.getClassType()); } } JMethodCall call = new JMethodCall(info, receiver, method); // On a super ref, don't allow polymorphic dispatch. Oddly enough, // QualifiedSuperReference not derived from SuperReference! boolean isSuperRef = x.receiver instanceof SuperReference || x.receiver instanceof QualifiedSuperReference; if (isSuperRef) { call.setStaticDispatchOnly(); } // The arguments come first... call.addArgs(arguments); if (x.valueCast != null) { JType castType = typeMap.get(x.valueCast); push(maybeCast(castType, call)); } else { push(call); } } catch (Throwable e) { throw translateException(x, e); } }
@Override public boolean visit(QualifiedSuperReference node, BlockScope scope) { setGeneratedBy(node, source); applyOffsetExpression(node); return super.visit(node, scope); }
@Override public boolean visit(QualifiedSuperReference node, ClassScope scope) { setGeneratedBy(node, source); applyOffsetExpression(node); return super.visit(node, scope); }