Examples of LocalDeclaration


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

 
  private void removeLocals(Statement[] statements, int start, int end) {
    if (statements != null) {
      for (int i = 0; i < statements.length; i++) {
        if (statements[i] instanceof LocalDeclaration) {
          LocalDeclaration localDeclaration = (LocalDeclaration) statements[i];         
          int j = indexOfFisrtNameAfter(start);
          done : while (j != -1) {
            int nameStart = this.potentialVariableNameStarts[j];
            if (start <= nameStart && nameStart <= end) {
              if (CharOperation.equals(this.potentialVariableNames[j], localDeclaration.name, false)) {
View Full Code Here

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

          }
        } else if (i == statementsLength - 1 && insertNewLineAfterLastStatement) {
          this.scribe.printNewLine();
        }
      } else if (statement instanceof LocalDeclaration) {
        LocalDeclaration currentLocal = (LocalDeclaration) statement;
        if (i < (statementsLength - 1)) {
          /*
           * We need to check that the next statement is a local declaration
           */
          if (statements[i + 1] instanceof LocalDeclaration) {
            LocalDeclaration nextLocal = (LocalDeclaration) statements[i + 1];
            if (currentLocal.declarationSourceStart != nextLocal.declarationSourceStart) {
              this.scribe.printNextToken(TerminalTokens.TokenNameSEMICOLON, this.preferences.insert_space_before_semicolon);
              this.scribe.printTrailingComment();
              if (i != statementsLength - 1) {
                if (!(statement instanceof EmptyStatement) && !(statements[i + 1] instanceof EmptyStatement)) {
View Full Code Here

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

           */ 
          this.scribe.printNextToken(TerminalTokens.TokenNameSEMICOLON, this.preferences.insert_space_before_semicolon);
          this.scribe.printTrailingComment();
          this.scribe.printNewLine();
        } else if (statement instanceof LocalDeclaration) {
          LocalDeclaration currentLocal = (LocalDeclaration) statement;
          if (i < (statementsLength - 1)) {
            /*
             * We need to check that the next statement is a local declaration
             */
            if (statements[i + 1] instanceof LocalDeclaration) {
              LocalDeclaration nextLocal = (LocalDeclaration) statements[i + 1];
              if (currentLocal.declarationSourceStart != nextLocal.declarationSourceStart) {
                /*
                 * Print the semi-colon
                 */ 
                this.scribe.printNextToken(TerminalTokens.TokenNameSEMICOLON, this.preferences.insert_space_before_semicolon);
View Full Code Here

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

      }
    }
  }
}
public void acceptLocalVariable(LocalVariableBinding binding) {
  LocalDeclaration local = binding.declaration;
  IJavaElement parent = findLocalElement(local.sourceStart); // findLocalElement() cannot find local variable
  IJavaElement localVar = null;
  if(parent != null) {
    localVar = new LocalVariable(
        (JavaElement)parent,
View Full Code Here

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

    Statement updatedStatement = this.statements[i].updatedStatement();
    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

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

      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

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

}
public void fakeReachable(ASTNode location) {
  int sourceStart = location.sourceStart;
  int sourceEnd = location.sourceEnd;
  if (location instanceof LocalDeclaration) {
    LocalDeclaration declaration = (LocalDeclaration) location;
    sourceStart = declaration.declarationSourceStart;
    sourceEnd = declaration.declarationSourceEnd;
 
  this.handle(
    IProblem.DeadCode,
View Full Code Here

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

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

          }
        } else if (i == statementsLength - 1 && insertNewLineAfterLastStatement) {
          this.scribe.printNewLine();
        }
      } else if (statement instanceof LocalDeclaration) {
        LocalDeclaration currentLocal = (LocalDeclaration) statement;
        if (i < (statementsLength - 1)) {
          /*
           * We need to check that the next statement is a local declaration
           */
          if (statements[i + 1] instanceof LocalDeclaration) {
            LocalDeclaration nextLocal = (LocalDeclaration) statements[i + 1];
            if (currentLocal.declarationSourceStart != nextLocal.declarationSourceStart) {
              this.scribe.printNextToken(TerminalTokens.TokenNameSEMICOLON, this.preferences.insert_space_before_semicolon);
              this.scribe.printComment(CodeFormatter.K_UNKNOWN, Scribe.BASIC_TRAILING_COMMENT);
              if (i != statementsLength - 1) {
                if (!(statement instanceof EmptyStatement) && !(statements[i + 1] instanceof EmptyStatement)) {
View Full Code Here

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

           */
          this.scribe.printNextToken(TerminalTokens.TokenNameSEMICOLON, this.preferences.insert_space_before_semicolon);
          this.scribe.printComment(CodeFormatter.K_UNKNOWN, Scribe.BASIC_TRAILING_COMMENT);
          this.scribe.printNewLine();
        } else if (statement instanceof LocalDeclaration) {
          LocalDeclaration currentLocal = (LocalDeclaration) statement;
          if (i < (statementsLength - 1)) {
            /*
             * We need to check that the next statement is a local declaration
             */
            if (statements[i + 1] instanceof LocalDeclaration) {
              LocalDeclaration nextLocal = (LocalDeclaration) statements[i + 1];
              if (currentLocal.declarationSourceStart != nextLocal.declarationSourceStart) {
                /*
                 * Print the semi-colon
                 */
                this.scribe.printNextToken(TerminalTokens.TokenNameSEMICOLON, this.preferences.insert_space_before_semicolon);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.