本文整理汇总了Java中org.eclipse.jdt.internal.compiler.ast.QualifiedAllocationExpression类的典型用法代码示例。如果您正苦于以下问题:Java QualifiedAllocationExpression类的具体用法?Java QualifiedAllocationExpression怎么用?Java QualifiedAllocationExpression使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
QualifiedAllocationExpression类属于org.eclipse.jdt.internal.compiler.ast包,在下文中一共展示了QualifiedAllocationExpression类的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: convert
import org.eclipse.jdt.internal.compiler.ast.QualifiedAllocationExpression; //导入依赖的package包/类
private QualifiedAllocationExpression convert(
IJavaElement localType, FieldDeclaration enumConstant, CompilationResult compilationResult)
throws JavaModelException {
TypeDeclaration anonymousLocalTypeDeclaration =
convert((SourceType) localType, compilationResult);
QualifiedAllocationExpression expression =
new QualifiedAllocationExpression(anonymousLocalTypeDeclaration);
expression.type = anonymousLocalTypeDeclaration.superclass;
anonymousLocalTypeDeclaration.superclass = null;
anonymousLocalTypeDeclaration.superInterfaces = null;
anonymousLocalTypeDeclaration.allocation = expression;
if (enumConstant != null) {
anonymousLocalTypeDeclaration.modifiers &= ~ClassFileConstants.AccEnum;
expression.enumConstant = enumConstant;
expression.type = null;
}
return expression;
}
开发者ID:eclipse,项目名称:che,代码行数:19,代码来源:SourceTypeConverter.java
示例2: getInterfaceNames
import org.eclipse.jdt.internal.compiler.ast.QualifiedAllocationExpression; //导入依赖的package包/类
protected char[][] getInterfaceNames(TypeDeclaration typeDeclaration) {
char[][] interfaceNames = null;
int superInterfacesLength = 0;
TypeReference[] superInterfaces = typeDeclaration.superInterfaces;
if (superInterfaces != null) {
superInterfacesLength = superInterfaces.length;
interfaceNames = new char[superInterfacesLength][];
} else {
if ((typeDeclaration.bits & ASTNode.IsAnonymousType) != 0) {
// see PR 3442
QualifiedAllocationExpression alloc = typeDeclaration.allocation;
if (alloc != null && alloc.type != null) {
superInterfaces = new TypeReference[] { alloc.type};
superInterfacesLength = 1;
interfaceNames = new char[1][];
}
}
}
if (superInterfaces != null) {
for (int i = 0; i < superInterfacesLength; i++) {
interfaceNames[i] =
CharOperation.concatWith(superInterfaces[i].getParameterizedTypeName(), '.');
}
}
return interfaceNames;
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:27,代码来源:SourceElementNotifier.java
示例3: updatedStatement
import org.eclipse.jdt.internal.compiler.ast.QualifiedAllocationExpression; //导入依赖的package包/类
public Statement updatedStatement(int depth, Set knownTypes){
// ignore closed anonymous type
if ((this.typeDeclaration.bits & ASTNode.IsAnonymousType) != 0 && !this.preserveContent){
return null;
}
TypeDeclaration updatedType = updatedTypeDeclaration(depth + 1, knownTypes);
if (updatedType != null && (updatedType.bits & ASTNode.IsAnonymousType) != 0){
/* in presence of an anonymous type, we want the full allocation expression */
QualifiedAllocationExpression allocation = updatedType.allocation;
if (allocation.statementEnd == -1) {
allocation.statementEnd = updatedType.declarationSourceEnd;
}
return allocation;
}
return updatedType;
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:20,代码来源:RecoveredType.java
示例4: consumeClassInstanceCreationExpressionQualified
import org.eclipse.jdt.internal.compiler.ast.QualifiedAllocationExpression; //导入依赖的package包/类
protected void consumeClassInstanceCreationExpressionQualified() {
// ClassInstanceCreationExpression ::= Primary '.' 'new' SimpleName '(' ArgumentListopt ')' ClassBodyopt
// ClassInstanceCreationExpression ::= ClassInstanceCreationExpressionName 'new' SimpleName '(' ArgumentListopt ')' ClassBodyopt
classInstanceCreation(true);
QualifiedAllocationExpression qae =
(QualifiedAllocationExpression) this.expressionStack[this.expressionPtr];
if (qae.anonymousType == null) {
this.expressionLengthPtr--;
this.expressionPtr--;
qae.enclosingInstance = this.expressionStack[this.expressionPtr];
this.expressionStack[this.expressionPtr] = qae;
}
qae.sourceStart = qae.enclosingInstance.sourceStart;
consumeInvocationExpression();
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:18,代码来源:Parser.java
示例5: getInterfaceNames
import org.eclipse.jdt.internal.compiler.ast.QualifiedAllocationExpression; //导入依赖的package包/类
protected char[][] getInterfaceNames(TypeDeclaration typeDeclaration) {
char[][] interfaceNames = null;
int superInterfacesLength = 0;
TypeReference[] superInterfaces = typeDeclaration.superInterfaces;
if (superInterfaces != null) {
superInterfacesLength = superInterfaces.length;
interfaceNames = new char[superInterfacesLength][];
} else {
if ((typeDeclaration.bits & ASTNode.IsAnonymousType) != 0) {
// see PR 3442
QualifiedAllocationExpression alloc = typeDeclaration.allocation;
if (alloc != null && alloc.type != null) {
superInterfaces = new TypeReference[] { alloc.type};
superInterfacesLength = 1;
interfaceNames = new char[1][];
}
}
}
if (superInterfaces != null) {
int superInterfaceCount = 0;
next: for (int i = 0; i < superInterfacesLength; i++) {
TypeReference superInterface = superInterfaces[i];
if (superInterface instanceof CompletionOnKeyword) continue next;
if (CompletionUnitStructureRequestor.hasEmptyName(superInterface, this.assistNode)) continue next;
interfaceNames[superInterfaceCount++] = CharOperation.concatWith(superInterface.getParameterizedTypeName(), '.');
}
if (superInterfaceCount == 0) return null;
if (superInterfaceCount < superInterfacesLength) {
System.arraycopy(interfaceNames, 0, interfaceNames = new char[superInterfaceCount][], 0, superInterfaceCount);
}
}
return interfaceNames;
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:37,代码来源:CompletionElementNotifier.java
示例6: sourceEnd
import org.eclipse.jdt.internal.compiler.ast.QualifiedAllocationExpression; //导入依赖的package包/类
private int sourceEnd(TypeDeclaration typeDeclaration) {
if ((typeDeclaration.bits & ASTNode.IsAnonymousType) != 0) {
QualifiedAllocationExpression allocation = typeDeclaration.allocation;
if (allocation.enumConstant != null) // case of enum constant body
return allocation.enumConstant.sourceEnd;
return allocation.type.sourceEnd;
} else {
return typeDeclaration.sourceEnd;
}
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:11,代码来源:SourceElementNotifier.java
示例7: consumeAllocationHeader
import org.eclipse.jdt.internal.compiler.ast.QualifiedAllocationExpression; //导入依赖的package包/类
protected void consumeAllocationHeader() {
// ClassInstanceCreationExpression ::= 'new' ClassType '(' ArgumentListopt ')' ClassBodyopt
// ClassBodyopt produces a null item on the astStak if it produces NO class body
// An empty class body produces a 0 on the length stack.....
if (this.currentElement == null){
return; // should never occur, this consumeRule is only used in recovery mode
}
if (this.currentToken == TokenNameLBRACE){
// beginning of an anonymous type
TypeDeclaration anonymousType = new TypeDeclaration(this.compilationUnit.compilationResult);
anonymousType.name = CharOperation.NO_CHAR;
anonymousType.bits |= (ASTNode.IsAnonymousType|ASTNode.IsLocalType);
anonymousType.sourceStart = this.intStack[this.intPtr--];
anonymousType.declarationSourceStart = anonymousType.sourceStart;
anonymousType.sourceEnd = this.rParenPos; // closing parenthesis
QualifiedAllocationExpression alloc = new QualifiedAllocationExpression(anonymousType);
alloc.type = getTypeReference(0);
alloc.sourceStart = anonymousType.sourceStart;
alloc.sourceEnd = anonymousType.sourceEnd ;
this.lastCheckPoint = anonymousType.bodyStart = this.scanner.currentPosition;
this.currentElement = this.currentElement.add(anonymousType, 0);
this.lastIgnoredToken = -1;
if (!isIndirectlyInsideLambdaExpression())
this.currentToken = 0; // opening brace already taken into account
return;
}
this.lastCheckPoint = this.scanner.startPosition; // force to restart at this exact position
this.restartRecovery = true; // request to restart from here on
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:32,代码来源:Parser.java
示例8: missingTypeInConstructor
import org.eclipse.jdt.internal.compiler.ast.QualifiedAllocationExpression; //导入依赖的package包/类
public void missingTypeInConstructor(ASTNode location, MethodBinding constructor) {
List missingTypes = constructor.collectMissingTypes(null);
if (missingTypes == null) {
System.err.println("The constructor " + constructor + " is wrongly tagged as containing missing types"); //$NON-NLS-1$ //$NON-NLS-2$
return;
}
TypeBinding missingType = (TypeBinding) missingTypes.get(0);
int start = location.sourceStart;
int end = location.sourceEnd;
if (location instanceof QualifiedAllocationExpression) {
QualifiedAllocationExpression qualifiedAllocation = (QualifiedAllocationExpression) location;
if (qualifiedAllocation.anonymousType != null) {
start = qualifiedAllocation.anonymousType.sourceStart;
end = qualifiedAllocation.anonymousType.sourceEnd;
}
}
this.handle(
IProblem.MissingTypeInConstructor,
new String[] {
new String(constructor.declaringClass.readableName()),
typesAsString(constructor, false),
new String(missingType.readableName()),
},
new String[] {
new String(constructor.declaringClass.shortReadableName()),
typesAsString(constructor, true),
new String(missingType.shortReadableName()),
},
start,
end);
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:32,代码来源:ProblemReporter.java
示例9: endVisit
import org.eclipse.jdt.internal.compiler.ast.QualifiedAllocationExpression; //导入依赖的package包/类
@Override
public void endVisit(QualifiedAllocationExpression x, BlockScope scope) {
try {
SourceInfo info = makeSourceInfo(x);
List<JExpression> arguments = popCallArgs(info, x.arguments, x.binding);
pushNewExpression(info, x, x.enclosingInstance(), arguments, scope);
} catch (Throwable e) {
throw translateException(x, e);
}
}
开发者ID:WeTheInternet,项目名称:xapi,代码行数:11,代码来源:GwtAstBuilder.java
示例10: visit
import org.eclipse.jdt.internal.compiler.ast.QualifiedAllocationExpression; //导入依赖的package包/类
@Override public boolean visit(QualifiedAllocationExpression node, BlockScope scope) {
fixPositions(setGeneratedBy(node, source));
return super.visit(node, scope);
}
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:5,代码来源:SetGeneratedByVisitor.java
示例11: classInstanceCreation
import org.eclipse.jdt.internal.compiler.ast.QualifiedAllocationExpression; //导入依赖的package包/类
protected void classInstanceCreation(boolean hasClassBody) {
// ClassInstanceCreationExpression ::= 'new' ClassType '(' ArgumentListopt ')' ClassBodyopt
// ClassBodyopt produces a null item on the astStak if it produces NO class body
// An empty class body produces a 0 on the length stack.....
if ((this.astLengthStack[this.astLengthPtr] == 1)
&& (this.astStack[this.astPtr] == null)) {
int index;
if ((index = this.indexOfAssistIdentifier()) < 0) {
super.classInstanceCreation(hasClassBody);
return;
} else if(this.identifierLengthPtr > -1 &&
(this.identifierLengthStack[this.identifierLengthPtr] - 1) != index) {
super.classInstanceCreation(hasClassBody);
return;
}
QualifiedAllocationExpression alloc;
this.astPtr--;
this.astLengthPtr--;
alloc = new SelectionOnQualifiedAllocationExpression();
alloc.sourceEnd = this.endPosition; //the position has been stored explicitly
int length;
if ((length = this.expressionLengthStack[this.expressionLengthPtr--]) != 0) {
this.expressionPtr -= length;
System.arraycopy(
this.expressionStack,
this.expressionPtr + 1,
alloc.arguments = new Expression[length],
0,
length);
}
// trick to avoid creating a selection on type reference
char [] oldIdent = assistIdentifier();
setAssistIdentifier(null);
alloc.type = getTypeReference(0);
checkForDiamond(alloc.type);
setAssistIdentifier(oldIdent);
//the default constructor with the correct number of argument
//will be created and added by the TC (see createsInternalConstructorWithBinding)
alloc.sourceStart = this.intStack[this.intPtr--];
pushOnExpressionStack(alloc);
this.assistNode = alloc;
this.lastCheckPoint = alloc.sourceEnd + 1;
if (!this.diet){
this.restartRecovery = true; // force to restart in recovery mode
this.lastIgnoredToken = -1;
}
this.isOrphanCompletionNode = true;
} else {
super.classInstanceCreation(hasClassBody);
}
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:62,代码来源:SelectionParser.java
示例12: consumeClassInstanceCreationExpressionQualifiedWithTypeArguments
import org.eclipse.jdt.internal.compiler.ast.QualifiedAllocationExpression; //导入依赖的package包/类
protected void consumeClassInstanceCreationExpressionQualifiedWithTypeArguments() {
// ClassInstanceCreationExpression ::= Primary '.' 'new' TypeArguments SimpleName '(' ArgumentListopt ')' ClassBodyopt
// ClassInstanceCreationExpression ::= ClassInstanceCreationExpressionName 'new' TypeArguments SimpleName '(' ArgumentListopt ')' ClassBodyopt
QualifiedAllocationExpression alloc;
int length;
if (((length = this.astLengthStack[this.astLengthPtr]) == 1) && (this.astStack[this.astPtr] == null)) {
if (this.indexOfAssistIdentifier() < 0) {
super.consumeClassInstanceCreationExpressionQualifiedWithTypeArguments();
return;
}
//NO ClassBody
this.astPtr--;
this.astLengthPtr--;
alloc = new SelectionOnQualifiedAllocationExpression();
alloc.sourceEnd = this.endPosition; //the position has been stored explicitly
if ((length = this.expressionLengthStack[this.expressionLengthPtr--]) != 0) {
this.expressionPtr -= length;
System.arraycopy(
this.expressionStack,
this.expressionPtr + 1,
alloc.arguments = new Expression[length],
0,
length);
}
// trick to avoid creating a selection on type reference
char [] oldIdent = assistIdentifier();
setAssistIdentifier(null);
alloc.type = getTypeReference(0);
checkForDiamond(alloc.type);
setAssistIdentifier(oldIdent);
length = this.genericsLengthStack[this.genericsLengthPtr--];
this.genericsPtr -= length;
System.arraycopy(this.genericsStack, this.genericsPtr + 1, alloc.typeArguments = new TypeReference[length], 0, length);
this.intPtr--; // remove the position of the '<'
//the default constructor with the correct number of argument
//will be created and added by the TC (see createsInternalConstructorWithBinding)
alloc.sourceStart = this.intStack[this.intPtr--];
pushOnExpressionStack(alloc);
this.assistNode = alloc;
this.lastCheckPoint = alloc.sourceEnd + 1;
if (!this.diet){
this.restartRecovery = true; // force to restart in recovery mode
this.lastIgnoredToken = -1;
}
this.isOrphanCompletionNode = true;
} else {
super.consumeClassInstanceCreationExpressionQualifiedWithTypeArguments();
}
this.expressionLengthPtr--;
QualifiedAllocationExpression qae =
(QualifiedAllocationExpression) this.expressionStack[this.expressionPtr--];
qae.enclosingInstance = this.expressionStack[this.expressionPtr];
this.expressionStack[this.expressionPtr] = qae;
qae.sourceStart = qae.enclosingInstance.sourceStart;
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:66,代码来源:SelectionParser.java
示例13: consumeEnterAnonymousClassBody
import org.eclipse.jdt.internal.compiler.ast.QualifiedAllocationExpression; //导入依赖的package包/类
protected void consumeEnterAnonymousClassBody(boolean qualified) {
// EnterAnonymousClassBody ::= $empty
if (this.indexOfAssistIdentifier() < 0) {
super.consumeEnterAnonymousClassBody(qualified);
return;
}
// trick to avoid creating a selection on type reference
char [] oldIdent = assistIdentifier();
setAssistIdentifier(null);
TypeReference typeReference = getTypeReference(0);
setAssistIdentifier(oldIdent);
TypeDeclaration anonymousType = new TypeDeclaration(this.compilationUnit.compilationResult);
anonymousType.name = CharOperation.NO_CHAR;
anonymousType.bits |= (ASTNode.IsAnonymousType|ASTNode.IsLocalType);
QualifiedAllocationExpression alloc = new SelectionOnQualifiedAllocationExpression(anonymousType);
markEnclosingMemberWithLocalType();
pushOnAstStack(anonymousType);
alloc.sourceEnd = this.rParenPos; //the position has been stored explicitly
int argumentLength;
if ((argumentLength = this.expressionLengthStack[this.expressionLengthPtr--]) != 0) {
this.expressionPtr -= argumentLength;
System.arraycopy(
this.expressionStack,
this.expressionPtr + 1,
alloc.arguments = new Expression[argumentLength],
0,
argumentLength);
}
if (qualified) {
this.expressionLengthPtr--;
alloc.enclosingInstance = this.expressionStack[this.expressionPtr--];
}
alloc.type = typeReference;
anonymousType.sourceEnd = alloc.sourceEnd;
//position at the type while it impacts the anonymous declaration
anonymousType.sourceStart = anonymousType.declarationSourceStart = alloc.type.sourceStart;
alloc.sourceStart = this.intStack[this.intPtr--];
pushOnExpressionStack(alloc);
this.assistNode = alloc;
this.lastCheckPoint = alloc.sourceEnd + 1;
if (!this.diet){
this.restartRecovery = true; // force to restart in recovery mode
this.lastIgnoredToken = -1;
if (!isIndirectlyInsideLambdaExpression())
this.currentToken = 0; // opening brace already taken into account
this.hasReportedError = true;
}
anonymousType.bodyStart = this.scanner.currentPosition;
this.listLength = 0; // will be updated when reading super-interfaces
// recovery
if (this.currentElement != null){
this.lastCheckPoint = anonymousType.bodyStart;
this.currentElement = this.currentElement.add(anonymousType, 0);
if (!isIndirectlyInsideLambdaExpression())
this.currentToken = 0; // opening brace already taken into account
this.lastIgnoredToken = -1;
}
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:68,代码来源:SelectionParser.java
示例14: visit
import org.eclipse.jdt.internal.compiler.ast.QualifiedAllocationExpression; //导入依赖的package包/类
public boolean visit(
QualifiedAllocationExpression qualifiedAllocationExpression,
BlockScope scope) {
addRealFragment(qualifiedAllocationExpression);
return false;
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:7,代码来源:BinaryExpressionFragmentBuilder.java
示例15: visit
import org.eclipse.jdt.internal.compiler.ast.QualifiedAllocationExpression; //导入依赖的package包/类
public boolean visit(FieldDeclaration enumConstant, MethodScope scope) {
/*
* Print comments to get proper line number
*/
this.scribe.printComment();
final int line = this.scribe.line;
this.scribe.printModifiers(enumConstant.annotations, this, ICodeFormatterConstants.ANNOTATION_ON_FIELD);
this.scribe.printNextToken(TerminalTokens.TokenNameIdentifier, false);
formatEnumConstantArguments(
enumConstant,
this.preferences.insert_space_before_opening_paren_in_enum_constant,
this.preferences.insert_space_between_empty_parens_in_enum_constant,
this.preferences.insert_space_before_closing_paren_in_enum_constant,
this.preferences.insert_space_after_opening_paren_in_enum_constant,
this.preferences.insert_space_before_comma_in_enum_constant_arguments,
this.preferences.insert_space_after_comma_in_enum_constant_arguments,
this.preferences.alignment_for_arguments_in_enum_constant);
Expression initialization = enumConstant.initialization;
if (initialization instanceof QualifiedAllocationExpression) {
TypeDeclaration typeDeclaration = ((QualifiedAllocationExpression) initialization).anonymousType;
int fieldsCount = typeDeclaration.fields == null ? 0 : typeDeclaration.fields.length;
int methodsCount = typeDeclaration.methods == null ? 0 : typeDeclaration.methods.length;
int membersCount = typeDeclaration.memberTypes == null ? 0 : typeDeclaration.memberTypes.length;
/*
* Type body
*/
String enum_constant_brace = this.preferences.brace_position_for_enum_constant;
formatLeftCurlyBrace(line, enum_constant_brace);
formatTypeOpeningBraceForEnumConstant(enum_constant_brace, this.preferences.insert_space_before_opening_brace_in_enum_constant, typeDeclaration);
if (this.preferences.indent_body_declarations_compare_to_enum_constant_header) {
this.scribe.indent();
}
if (fieldsCount != 0 || methodsCount != 0 || membersCount != 0) {
formatTypeMembers(typeDeclaration);
}
if (this.preferences.indent_body_declarations_compare_to_enum_constant_header) {
this.scribe.unIndent();
}
if (this.preferences.insert_new_line_in_empty_enum_constant) {
this.scribe.printNewLine();
}
this.scribe.printNextToken(TerminalTokens.TokenNameRBRACE);
this.scribe.printComment(CodeFormatter.K_UNKNOWN, Scribe.BASIC_TRAILING_COMMENT);
if (enum_constant_brace.equals(DefaultCodeFormatterConstants.NEXT_LINE_SHIFTED)) {
this.scribe.unIndent();
}
if (hasComments()) {
this.scribe.printNewLine();
}
}
return false;
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:60,代码来源:CodeFormatterVisitor.java
示例16: convert
import org.eclipse.jdt.internal.compiler.ast.QualifiedAllocationExpression; //导入依赖的package包/类
public EnumConstantDeclaration convert(org.eclipse.jdt.internal.compiler.ast.FieldDeclaration enumConstant) {
checkCanceled();
EnumConstantDeclaration enumConstantDeclaration = new EnumConstantDeclaration(this.ast);
final SimpleName typeName = new SimpleName(this.ast);
typeName.internalSetIdentifier(new String(enumConstant.name));
typeName.setSourceRange(enumConstant.sourceStart, enumConstant.sourceEnd - enumConstant.sourceStart + 1);
enumConstantDeclaration.setName(typeName);
int declarationSourceStart = enumConstant.declarationSourceStart;
int declarationSourceEnd = enumConstant.declarationSourceEnd;
final org.eclipse.jdt.internal.compiler.ast.Expression initialization = enumConstant.initialization;
if (initialization != null) {
if (initialization instanceof QualifiedAllocationExpression) {
org.eclipse.jdt.internal.compiler.ast.TypeDeclaration anonymousType = ((QualifiedAllocationExpression) initialization).anonymousType;
if (anonymousType != null) {
AnonymousClassDeclaration anonymousClassDeclaration = new AnonymousClassDeclaration(this.ast);
int start = retrieveStartBlockPosition(anonymousType.sourceEnd, anonymousType.bodyEnd);
int end = retrieveRightBrace(anonymousType.bodyEnd, declarationSourceEnd);
if (end == -1) end = anonymousType.bodyEnd;
anonymousClassDeclaration.setSourceRange(start, end - start + 1);
enumConstantDeclaration.setAnonymousClassDeclaration(anonymousClassDeclaration);
buildBodyDeclarations(anonymousType, anonymousClassDeclaration);
if (this.resolveBindings) {
recordNodes(anonymousClassDeclaration, anonymousType);
anonymousClassDeclaration.resolveBinding();
}
enumConstantDeclaration.setSourceRange(declarationSourceStart, end - declarationSourceStart + 1);
}
} else {
enumConstantDeclaration.setSourceRange(declarationSourceStart, declarationSourceEnd - declarationSourceStart + 1);
}
final org.eclipse.jdt.internal.compiler.ast.Expression[] arguments = ((org.eclipse.jdt.internal.compiler.ast.AllocationExpression) initialization).arguments;
if (arguments != null) {
for (int i = 0, max = arguments.length; i < max; i++) {
enumConstantDeclaration.arguments().add(convert(arguments[i]));
}
}
} else {
enumConstantDeclaration.setSourceRange(declarationSourceStart, declarationSourceEnd - declarationSourceStart + 1);
}
setModifiers(enumConstantDeclaration, enumConstant);
if (this.resolveBindings) {
recordNodes(enumConstantDeclaration, enumConstant);
recordNodes(typeName, enumConstant);
enumConstantDeclaration.resolveVariable();
}
convert(enumConstant.javadoc, enumConstantDeclaration);
return enumConstantDeclaration;
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:49,代码来源:ASTConverter.java
示例17: consumeEnterAnonymousClassBody
import org.eclipse.jdt.internal.compiler.ast.QualifiedAllocationExpression; //导入依赖的package包/类
protected void consumeEnterAnonymousClassBody(boolean qualified) {
// EnterAnonymousClassBody ::= $empty
TypeReference typeReference = getTypeReference(0);
TypeDeclaration anonymousType = new TypeDeclaration(this.compilationUnit.compilationResult);
anonymousType.name = CharOperation.NO_CHAR;
anonymousType.bits |= (ASTNode.IsAnonymousType|ASTNode.IsLocalType);
anonymousType.bits |= (typeReference.bits & ASTNode.HasTypeAnnotations);
QualifiedAllocationExpression alloc = new QualifiedAllocationExpression(anonymousType);
markEnclosingMemberWithLocalType();
pushOnAstStack(anonymousType);
alloc.sourceEnd = this.rParenPos; //the position has been stored explicitly
int argumentLength;
if ((argumentLength = this.expressionLengthStack[this.expressionLengthPtr--]) != 0) {
this.expressionPtr -= argumentLength;
System.arraycopy(
this.expressionStack,
this.expressionPtr + 1,
alloc.arguments = new Expression[argumentLength],
0,
argumentLength);
}
if (qualified) {
this.expressionLengthPtr--;
alloc.enclosingInstance = this.expressionStack[this.expressionPtr--];
}
alloc.type = typeReference;
anonymousType.sourceEnd = alloc.sourceEnd;
//position at the type while it impacts the anonymous declaration
anonymousType.sourceStart = anonymousType.declarationSourceStart = alloc.type.sourceStart;
alloc.sourceStart = this.intStack[this.intPtr--];
pushOnExpressionStack(alloc);
anonymousType.bodyStart = this.scanner.currentPosition;
this.listLength = 0; // will be updated when reading super-interfaces
// flush the comments related to the anonymous
this.scanner.commentPtr = -1;
// recovery
if (this.currentElement != null){
this.lastCheckPoint = anonymousType.bodyStart;
this.currentElement = this.currentElement.add(anonymousType, 0);
if (!(this.currentElement instanceof RecoveredAnnotation)) {
if (!isIndirectlyInsideLambdaExpression())
this.currentToken = 0; // opening brace already taken into account
} else {
this.ignoreNextOpeningBrace = true;
this.currentElement.bracketBalance++;
}
this.lastIgnoredToken = -1;
}
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:58,代码来源:Parser.java
示例18: visit
import org.eclipse.jdt.internal.compiler.ast.QualifiedAllocationExpression; //导入依赖的package包/类
@Override public boolean visit(QualifiedAllocationExpression 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.QualifiedAllocationExpression类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论