Package org.eclipse.jdt.internal.compiler.ast

Examples of org.eclipse.jdt.internal.compiler.ast.ASTNode


  int size1 = 0, size2 = 0, size3 = 0;
  TypeDeclaration enumDeclaration = (TypeDeclaration) this.astStack[this.astPtr - length];
  boolean hasAbstractMethods = false;
  int enumConstantsCounter = 0;
  for (int i = length - 1; i >= 0; i--) {
    ASTNode astNode = this.astStack[this.astPtr--];
    if (astNode instanceof AbstractMethodDeclaration) {
      //methods and constructors have been regrouped into one single list
      flag[i] = 2;
      size2++;
      if (((AbstractMethodDeclaration) astNode).isAbstract()) {
View Full Code Here


  int iComment = this.scanner.commentPtr;
  if (iComment < 0) return false; // no comment available
  int iStatement = this.astLengthPtr;
  if (iStatement < 0 || this.astLengthStack[iStatement] <= 1) return false; // no statement available
  // Fallthrough comment must be located after the previous statement
  ASTNode lastNode = this.astStack[this.astPtr];
  int rangeStart = lastNode.sourceEnd;
  previousComment: for (; iComment >= 0; iComment--) {
    int commentStart = this.scanner.commentStarts[iComment];
    if (commentStart < 0) commentStart = -commentStart; // line comments have negative start positions
    // ignore comments before start
View Full Code Here

  if (this.currentElement != null) return; // this is already done in the recovery code
  markEnclosingMemberWithLocalOrFunctionalType(LocalTypeKind.LOCAL);
}
protected void markEnclosingMemberWithLocalOrFunctionalType(LocalTypeKind context) {
  for (int i = this.astPtr; i >= 0; i--) {
    ASTNode node = this.astStack[i];
    if (node instanceof AbstractMethodDeclaration
        || node instanceof FieldDeclaration
        || (node instanceof TypeDeclaration // mark type for now: all initializers will be marked when added to this type
            // and enclosing type must not be closed (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=147485)
            && ((TypeDeclaration) node).declarationSourceEnd == 0)) {
      switch (context) {
        case METHOD_REFERENCE:
          node.bits |= ASTNode.HasFunctionalInterfaceTypes;
          break;
        case LAMBDA:
          node.bits |= ASTNode.HasFunctionalInterfaceTypes;
          //$FALL-THROUGH$
        case LOCAL:
          node.bits |= ASTNode.HasLocalType;
      }
      return;
    }
  }
  // default to reference context (case of parse method body)
  if (this.referenceContext instanceof AbstractMethodDeclaration
      || this.referenceContext instanceof TypeDeclaration) {
    ASTNode node = (ASTNode)this.referenceContext;
    switch (context) {
      case METHOD_REFERENCE:
        node.bits |= ASTNode.HasFunctionalInterfaceTypes;
        break;
      case LAMBDA:
View Full Code Here

  }
  boolean containsInitializers = false;
  TypeDeclaration typeDeclaration = null;
  for (int i = 0, max = result.length; i < max; i++) {
    // parse each class body declaration
    ASTNode node = result[i];
    if (node instanceof TypeDeclaration) {
      ((TypeDeclaration) node).parseMethods(this, unit);
    } else if (node instanceof AbstractMethodDeclaration) {
      ((AbstractMethodDeclaration) node).parseStatements(this, unit);
    } else if (node instanceof FieldDeclaration) {
View Full Code Here

        }

        // to compute bodyStart, and thus used to set next checkpoint.
        int count;
        for (count = 0; count < argLength; count++){
          ASTNode aNode = parser.astStack[argStart+count];
          if(aNode instanceof Argument) {
            Argument argument = (Argument)aNode;
            /* cannot be an argument if non final */
            char[][] argTypeName = argument.type.getTypeName();
            if ((argument.modifiers & ~ClassFileConstants.AccFinal) != 0
View Full Code Here

  int lastStart = this.blockStarts[0];
  block.sourceStart = lastStart;
  element = element.add(block, 1);
  int blockIndex = 1// ignore first block start, since manually rebuilt here

  ASTNode node = null, lastNode = null;
  for (int i = 0; i <= this.astPtr; i++, lastNode = node) {
    node = this.astStack[i];
    if(node instanceof ForeachStatement && ((ForeachStatement)node).action == null) {
      node = ((ForeachStatement)node).elementVariable;
    }
View Full Code Here

      /* See if CompletionParser.attachOrphanCompletionNode has already added bits and pieces of AST to the recovery tree. If so, we want to
         replace those fragments with the fuller statement that provides target type for the lambda that got closed just now. There is prior
         art/precedent in the Java 7 world to this: Search for recoveredBlock.statements[--recoveredBlock.statementCount] = null;
         See also that this concern does not arise in the case of field/local initialization since the initializer is replaced with full tree by consumeExitVariableWithInitialization.
      */
      ASTNode assistNodeParent = this.assistNodeParent();
      ASTNode enclosingNode = this.enclosingNode();
      if (assistNodeParent != null || enclosingNode != null) {
        RecoveredBlock recoveredBlock = (RecoveredBlock) (this.currentElement instanceof RecoveredBlock ? this.currentElement :
                          (this.currentElement.parent instanceof RecoveredBlock) ? this.currentElement.parent : null);
        if (recoveredBlock != null) {
          RecoveredStatement recoveredStatement = recoveredBlock.statementCount > 0 ? recoveredBlock.statements[recoveredBlock.statementCount - 1] : null;
          ASTNode parseTree = recoveredStatement != null ? recoveredStatement.updatedStatement(0, new HashSet()) : null;
          if (parseTree != null && (parseTree == assistNodeParent || parseTree == enclosingNode)) {
            recoveredBlock.statements[--recoveredBlock.statementCount] = null;
            this.currentElement = recoveredBlock;
          }
        }
View Full Code Here

public char[] assistIdentifier(){
  return ((SelectionScanner)this.scanner).selectionIdentifier;
}
protected void attachOrphanCompletionNode(){
  if (this.isOrphanCompletionNode){
    ASTNode orphan = this.assistNode;
    this.isOrphanCompletionNode = false;


    /* if in context of a type, then persists the identifier into a fake field return type */
    if (this.currentElement instanceof RecoveredType){
View Full Code Here

    if (!isIndirectlyInsideLambdaExpression())
      this.currentToken = 0; // given we are not on an eof, we do not want side effects caused by looked-ahead token
  }
}
private void buildMoreCompletionContext(Expression expression) {
  ASTNode parentNode = null;

  int kind = topKnownElementKind(SELECTION_OR_ASSIST_PARSER);
  if(kind != 0) {
    int info = topKnownElementInfo(SELECTION_OR_ASSIST_PARSER);
    nextElement : switch (kind) {
      case K_BETWEEN_CASE_AND_COLON :
        if(this.expressionPtr > 0) {
          SwitchStatement switchStatement = new SwitchStatement();
          switchStatement.expression = this.expressionStack[this.expressionPtr - 1];
          if(this.astLengthPtr > -1 && this.astPtr > -1) {
            int length = this.astLengthStack[this.astLengthPtr];
            int newAstPtr = this.astPtr - length;
            ASTNode firstNode = this.astStack[newAstPtr + 1];
            if(length != 0 && firstNode.sourceStart > switchStatement.expression.sourceEnd) {
              switchStatement.statements = new Statement[length + 1];
              System.arraycopy(
                this.astStack,
                newAstPtr + 1,
View Full Code Here

    this.lookupEnvironment.unitBeingCompleted = this.compilationUnitDeclaration;
    try {
      this.hasComputedVisibleElementBindings = true;
 
      Scope scope = this.assistScope;
      ASTNode astNode = this.assistNode;
      boolean notInJavadoc = this.completionContext.javadoc == 0;
 
      this.visibleLocalVariables = new ObjectVector();
      this.visibleFields = new ObjectVector();
      this.visibleMethods = new ObjectVector();
View Full Code Here

TOP

Related Classes of org.eclipse.jdt.internal.compiler.ast.ASTNode

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.