本文整理汇总了Java中org.eclipse.jdt.internal.compiler.ast.SuperReference类的典型用法代码示例。如果您正苦于以下问题:Java SuperReference类的具体用法?Java SuperReference怎么用?Java SuperReference使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SuperReference类属于org.eclipse.jdt.internal.compiler.ast包,在下文中一共展示了SuperReference类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getFirstParameterType
import org.eclipse.jdt.internal.compiler.ast.SuperReference; //导入依赖的package包/类
static TypeBinding getFirstParameterType(TypeDeclaration decl, CompletionProposalCollector completionProposalCollector) {
TypeBinding firstParameterType = null;
ASTNode node = getAssistNode(completionProposalCollector);
if (node == null) return null;
if (!(node instanceof CompletionOnQualifiedNameReference) && !(node instanceof CompletionOnSingleNameReference) && !(node instanceof CompletionOnMemberAccess)) return null;
// Never offer on 'super.<autocomplete>'.
if (node instanceof FieldReference && ((FieldReference)node).receiver instanceof SuperReference) return null;
if (node instanceof NameReference) {
Binding binding = ((NameReference) node).binding;
// Unremark next block to allow a 'blank' autocomplete to list any extensions that apply to the current scope, but make sure we're not in a static context first, which this doesn't do.
// Lacking good use cases, and having this particular concept be a little tricky on javac, means for now we don't support extension methods like this. this.X() will be fine, though.
/* if ((node instanceof SingleNameReference) && (((SingleNameReference) node).token.length == 0)) {
firstParameterType = decl.binding;
} else */if (binding instanceof VariableBinding) {
firstParameterType = ((VariableBinding) binding).type;
}
} else if (node instanceof FieldReference) {
firstParameterType = ((FieldReference) node).actualReceiverType;
}
return firstParameterType;
}
示例2: consumeFieldAccess
import org.eclipse.jdt.internal.compiler.ast.SuperReference; //导入依赖的package包/类
protected void consumeFieldAccess(boolean isSuperAccess) {
// FieldAccess ::= Primary '.' 'Identifier'
// FieldAccess ::= 'super' '.' 'Identifier'
FieldReference fr =
new FieldReference(
this.identifierStack[this.identifierPtr],
this.identifierPositionStack[this.identifierPtr--]);
this.identifierLengthPtr--;
if (isSuperAccess) {
//considers the fieldReference beginning at the 'super' ....
fr.sourceStart = this.intStack[this.intPtr--];
fr.receiver = new SuperReference(fr.sourceStart, this.endPosition);
pushOnExpressionStack(fr);
} else {
//optimize push/pop
fr.receiver = this.expressionStack[this.expressionPtr];
//field reference begins at the receiver
fr.sourceStart = fr.receiver.sourceStart;
this.expressionStack[this.expressionPtr] = fr;
}
}
示例3: consumeMethodInvocationSuperWithTypeArguments
import org.eclipse.jdt.internal.compiler.ast.SuperReference; //导入依赖的package包/类
protected void consumeMethodInvocationSuperWithTypeArguments() {
// MethodInvocation ::= 'super' '.' TypeArguments 'Identifier' '(' ArgumentListopt ')'
MessageSend m = newMessageSendWithTypeArguments();
this.intPtr--; // start position of the typeArguments
m.sourceEnd = this.rParenPos;
m.nameSourcePosition = this.identifierPositionStack[this.identifierPtr];
m.selector = this.identifierStack[this.identifierPtr--];
this.identifierLengthPtr--;
// handle type arguments
int length = this.genericsLengthStack[this.genericsLengthPtr--];
this.genericsPtr -= length;
System.arraycopy(this.genericsStack, this.genericsPtr + 1, m.typeArguments = new TypeReference[length], 0, length);
m.sourceStart = this.intStack[this.intPtr--]; // start position of the super keyword
m.receiver = new SuperReference(m.sourceStart, this.endPosition);
pushOnExpressionStack(m);
consumeInvocationExpression();
}
示例4: consumeReferenceExpressionSuperForm
import org.eclipse.jdt.internal.compiler.ast.SuperReference; //导入依赖的package包/类
protected void consumeReferenceExpressionSuperForm() {
// ReferenceExpression ::= 'super' '::' NonWildTypeArgumentsopt Identifier
ReferenceExpression referenceExpression = newReferenceExpression();
TypeReference [] typeArguments = null;
char [] selector;
int sourceEnd;
sourceEnd = (int) this.identifierPositionStack[this.identifierPtr];
referenceExpression.nameSourceStart = (int) (this.identifierPositionStack[this.identifierPtr] >>> 32);
selector = this.identifierStack[this.identifierPtr--];
this.identifierLengthPtr--;
int length = this.genericsLengthStack[this.genericsLengthPtr--];
if (length > 0) {
this.genericsPtr -= length;
System.arraycopy(this.genericsStack, this.genericsPtr + 1, typeArguments = new TypeReference[length], 0, length);
this.intPtr--; // pop type arguments source start.
}
SuperReference superReference = new SuperReference(this.intStack[this.intPtr--], this.endPosition);
referenceExpression.initialize(this.compilationUnit.compilationResult, superReference, typeArguments, selector, sourceEnd);
consumeReferenceExpression(referenceExpression);
}
示例5: consumeFieldAccess
import org.eclipse.jdt.internal.compiler.ast.SuperReference; //导入依赖的package包/类
protected void consumeFieldAccess(boolean isSuperAccess) {
// FieldAccess ::= Primary '.' 'Identifier'
// FieldAccess ::= 'super' '.' 'Identifier'
if (this.indexOfAssistIdentifier() < 0) {
super.consumeFieldAccess(isSuperAccess);
return;
}
FieldReference fieldReference =
new SelectionOnFieldReference(
this.identifierStack[this.identifierPtr],
this.identifierPositionStack[this.identifierPtr--]);
this.identifierLengthPtr--;
if (isSuperAccess) { //considerates the fieldReferenceerence beginning at the 'super' ....
fieldReference.sourceStart = this.intStack[this.intPtr--];
fieldReference.receiver = new SuperReference(fieldReference.sourceStart, this.endPosition);
pushOnExpressionStack(fieldReference);
} else { //optimize push/pop
if ((fieldReference.receiver = this.expressionStack[this.expressionPtr]).isThis()) { //fieldReferenceerence begins at the this
fieldReference.sourceStart = fieldReference.receiver.sourceStart;
}
this.expressionStack[this.expressionPtr] = fieldReference;
}
this.assistNode = fieldReference;
this.lastCheckPoint = fieldReference.sourceEnd + 1;
if (!this.diet){
this.restartRecovery = true; // force to restart in recovery mode
this.lastIgnoredToken = -1;
}
this.isOrphanCompletionNode = true;
}
示例6: visit
import org.eclipse.jdt.internal.compiler.ast.SuperReference; //导入依赖的package包/类
/**
* @see org.eclipse.jdt.internal.compiler.ASTVisitor#visit(org.eclipse.jdt.internal.compiler.ast.SuperReference, org.eclipse.jdt.internal.compiler.lookup.BlockScope)
*/
public boolean visit(SuperReference superReference, BlockScope scope) {
final int numberOfParens = (superReference.bits & ASTNode.ParenthesizedMASK) >> ASTNode.ParenthesizedSHIFT;
if (numberOfParens > 0) {
manageOpeningParenthesizedExpression(superReference, numberOfParens);
}
this.scribe.printNextToken(TerminalTokens.TokenNamesuper);
if (numberOfParens > 0) {
manageClosingParenthesizedExpression(superReference, numberOfParens);
}
return false;
}
示例7: consumeMethodInvocationSuper
import org.eclipse.jdt.internal.compiler.ast.SuperReference; //导入依赖的package包/类
protected void consumeMethodInvocationSuper() {
// MethodInvocation ::= 'super' '.' 'Identifier' '(' ArgumentListopt ')'
MessageSend m = newMessageSend();
m.sourceStart = this.intStack[this.intPtr--]; // start position of the super keyword
m.sourceEnd = this.rParenPos;
m.nameSourcePosition = this.identifierPositionStack[this.identifierPtr];
m.selector = this.identifierStack[this.identifierPtr--];
this.identifierLengthPtr--;
m.receiver = new SuperReference(m.sourceStart, this.endPosition);
pushOnExpressionStack(m);
consumeInvocationExpression();
}
示例8: endVisit
import org.eclipse.jdt.internal.compiler.ast.SuperReference; //导入依赖的package包/类
@Override
public void endVisit(SuperReference x, BlockScope scope) {
try {
assert (typeMap.get(x.resolvedType) == curClass.classType.getSuperClass());
// Super refs can be modeled as a this ref.
push(makeThisRef(makeSourceInfo(x)));
} catch (Throwable e) {
throw translateException(x, e);
}
}
示例9: visit
import org.eclipse.jdt.internal.compiler.ast.SuperReference; //导入依赖的package包/类
@Override public boolean visit(SuperReference node, BlockScope scope) {
fixPositions(setGeneratedBy(node, source));
return super.visit(node, scope);
}
示例10: parseBlockStatements
import org.eclipse.jdt.internal.compiler.ast.SuperReference; //导入依赖的package包/类
/**
* Parse the block statements inside the given constructor declaration and try to complete at the
* cursor location.
*/
public void parseBlockStatements(ConstructorDeclaration cd, CompilationUnitDeclaration unit) {
//only parse the method body of cd
//fill out its statements
//convert bugs into parse error
initialize();
// set the lastModifiers to reflect the modifiers of the constructor whose
// block statements are being parsed
// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=202634
this.lastModifiers = cd.modifiers;
this.lastModifiersStart = cd.modifiersSourceStart;
// simulate goForConstructorBody except that we don't want to balance brackets because they are not going to be balanced
goForBlockStatementsopt();
this.referenceContext = cd;
this.compilationUnit = unit;
this.scanner.resetTo(cd.bodyStart, bodyEnd(cd));
consumeNestedMethod();
try {
parse();
} catch (AbortCompilation ex) {
this.lastAct = ERROR_ACTION;
}
if (this.lastAct == ERROR_ACTION) {
cd.bits |= ASTNode.HasSyntaxErrors;
return;
}
// attach the statements as we might be searching for a reference to a local type
cd.explicitDeclarations = this.realBlockStack[this.realBlockPtr--];
int length;
if ((length = this.astLengthStack[this.astLengthPtr--]) != 0) {
this.astPtr -= length;
if (this.astStack[this.astPtr + 1] instanceof ExplicitConstructorCall)
//avoid a isSomeThing that would only be used here BUT what is faster between two alternatives ?
{
System.arraycopy(
this.astStack,
this.astPtr + 2,
cd.statements = new Statement[length - 1],
0,
length - 1);
cd.constructorCall = (ExplicitConstructorCall) this.astStack[this.astPtr + 1];
} else { //need to add explicitly the super();
System.arraycopy(
this.astStack,
this.astPtr + 1,
cd.statements = new Statement[length],
0,
length);
cd.constructorCall = SuperReference.implicitSuperConstructorCall();
}
} else {
cd.constructorCall = SuperReference.implicitSuperConstructorCall();
if (!containsComment(cd.bodyStart, cd.bodyEnd)) {
cd.bits |= ASTNode.UndocumentedEmptyBlock;
}
}
if (cd.constructorCall.sourceEnd == 0) {
cd.constructorCall.sourceEnd = cd.sourceEnd;
cd.constructorCall.sourceStart = cd.sourceStart;
}
}
示例11: visit
import org.eclipse.jdt.internal.compiler.ast.SuperReference; //导入依赖的package包/类
public boolean visit(SuperReference superReference, BlockScope scope) {
addRealFragment(superReference);
return false;
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:5,代码来源:BinaryExpressionFragmentBuilder.java
示例12: visit
import org.eclipse.jdt.internal.compiler.ast.SuperReference; //导入依赖的package包/类
@Override public boolean visit(SuperReference node, BlockScope scope) {
setGeneratedBy(node, source);
applyOffsetExpression(node);
return super.visit(node, scope);
}