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

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


}
public void unreachableCode(Statement statement) {
  int sourceStart = statement.sourceStart;
  int sourceEnd = statement.sourceEnd;
  if (statement instanceof LocalDeclaration) {
    LocalDeclaration declaration = (LocalDeclaration) statement;
    sourceStart = declaration.declarationSourceStart;
    sourceEnd = declaration.declarationSourceEnd;
  } else if (statement instanceof Expression) {
    int statemendEnd = ((Expression) statement).statementEnd;
    if (statemendEnd != -1) sourceEnd = statemendEnd;
View Full Code Here


      if(node instanceof Block) {
        Block block = (Block) node;
        element = element.add(block, 0);
        this.lastCheckPoint = block.sourceEnd + 1;
      } else if(node instanceof LocalDeclaration) {
        LocalDeclaration statement = (LocalDeclaration) node;
        element = element.add(statement, 0);
        this.lastCheckPoint = statement.sourceEnd + 1;
      } else if(node instanceof Expression) {
        if(node instanceof Assignment ||
            node instanceof PrefixExpression ||
View Full Code Here

    }
  }

  Argument arg = (Argument)this.astStack[this.astPtr--];
  // convert argument to local variable
  LocalDeclaration localDeclaration = new LocalDeclaration(arg.name, arg.sourceStart, arg.sourceEnd);
  localDeclaration.type = arg.type;
  localDeclaration.declarationSourceStart = arg.declarationSourceStart;
  localDeclaration.declarationSourceEnd = arg.declarationSourceEnd;

  this.currentElement = this.currentElement.add(localDeclaration, 0);
View Full Code Here

  TypeReference type;

  char[] identifierName = this.identifierStack[this.identifierPtr];
  long namePosition = this.identifierPositionStack[this.identifierPtr];

  LocalDeclaration localDeclaration = createLocalDeclaration(identifierName, (int) (namePosition >>> 32), (int) namePosition);
  localDeclaration.declarationSourceEnd = localDeclaration.declarationEnd;
  localDeclaration.bits |= ASTNode.IsForeachElementVariable;

  int extraDims = this.intStack[this.intPtr--];
  Annotation [][] annotationsOnExtendedDimensions = extraDims == 0 ? null : getAnnotationsOnDimensions(extraDims);
View Full Code Here

      this.lastCheckPoint = (int) (namePosition >>> 32);
      this.restartRecovery = true;
      return;
    }
    if (isLocalDeclaration){
      LocalDeclaration localDecl = (LocalDeclaration) this.astStack[this.astPtr];
      this.lastCheckPoint = localDecl.sourceEnd + 1;
      this.currentElement = this.currentElement.add(localDecl, 0);
    } else {
      FieldDeclaration fieldDecl = (FieldDeclaration) this.astStack[this.astPtr];
      this.lastCheckPoint = fieldDecl.sourceEnd + 1;
View Full Code Here

  this.realBlockStack[this.realBlockPtr]++;

  // update source end to include the semi-colon
  int variableDeclaratorsCounter = this.astLengthStack[this.astLengthPtr];
  for (int i = variableDeclaratorsCounter - 1; i >= 0; i--) {
    LocalDeclaration localDeclaration = (LocalDeclaration) this.astStack[this.astPtr - i];
    localDeclaration.declarationSourceEnd = this.endStatementPosition;
    localDeclaration.declarationEnd = this.endStatementPosition;  // semi-colon included
  }

}
View Full Code Here

protected void consumeResourceSpecification() {
  // ResourceSpecification ::= '(' Resources ')'
}
protected void consumeResourceOptionalTrailingSemiColon(boolean punctuated) {
  // TrailingSemiColon ::= ';'
  LocalDeclaration localDeclaration = (LocalDeclaration) this.astStack[this.astPtr];
  if (punctuated) {
    localDeclaration.declarationSourceEnd = this.endStatementPosition;
  }
}
View Full Code Here

}
protected JavadocParser createJavadocParser() {
  return new JavadocParser(this);
}
protected LocalDeclaration createLocalDeclaration(char[] localDeclarationName, int sourceStart, int sourceEnd) {
  return new LocalDeclaration(localDeclarationName, sourceStart, sourceEnd);
}
View Full Code Here

    Statement updatedStatement = this.statements[i].updatedStatement(depth, knownTypes);
    if (updatedStatement != null){
      updatedStatements[updatedCount++] = updatedStatement;
     
      if (updatedStatement instanceof LocalDeclaration) {
        LocalDeclaration localDeclaration = (LocalDeclaration) updatedStatement;
        if(localDeclaration.declarationSourceEnd > lastEnd) {
          lastEnd = localDeclaration.declarationSourceEnd;
        }
      } else if (updatedStatement instanceof TypeDeclaration) {
        TypeDeclaration typeDeclaration = (TypeDeclaration) updatedStatement;
View Full Code Here

      return null;
    }
  }

  private JavaElement getJavaElement(LocalVariableBinding binding) {
    LocalDeclaration local = binding.declaration;

    JavaElement parent = null;
    ReferenceContext referenceContext = binding.declaringScope.referenceContext();
    if (referenceContext instanceof AbstractMethodDeclaration) {
      AbstractMethodDeclaration methodDeclaration = (AbstractMethodDeclaration) referenceContext;
      parent = this.getJavaElementOfCompilationUnit(methodDeclaration, methodDeclaration.binding);
    } else if (referenceContext instanceof TypeDeclaration){
      // Local variable is declared inside an initializer
      TypeDeclaration typeDeclaration = (TypeDeclaration) referenceContext;

      JavaElement type = this.getJavaElementOfCompilationUnit(typeDeclaration, typeDeclaration.binding);
      parent = Util.getUnresolvedJavaElement(local.sourceStart, local.sourceEnd, type);
    }
    if (parent == null) return null;

    return new LocalVariable(
        parent,
        new String(local.name),
        local.declarationSourceStart,
        local.declarationSourceEnd,
        local.sourceStart,
        local.sourceEnd,
        Util.typeSignature(local.type),
        binding.declaration.annotations,
        local.modifiers,
        local.getKind() == AbstractVariableDeclaration.PARAMETER);
  }
View Full Code Here

TOP

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

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.