Examples of LocalDeclaration


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

          // convert it to a simple try statement tagged as MALFORMED
          tryStatement.setFlags(tryStatement.getFlags() | ASTNode.MALFORMED);
          break;
        default:
          for (int i = 0; i < resourcesLength; i++) {
            LocalDeclaration localDeclaration = localDeclarations[i];
            VariableDeclarationExpression variableDeclarationExpression = convertToVariableDeclarationExpression(localDeclaration);
            int start = variableDeclarationExpression.getStartPosition();
            int end = localDeclaration.declarationEnd;
            variableDeclarationExpression.setSourceRange(start, end - start + 1);
            tryStatement.resources().add(variableDeclarationExpression);
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

      }
    }
  }
}
public void acceptLocalVariable(LocalVariableBinding binding) {
  LocalDeclaration local = binding.declaration;
  IJavaElement parent = findLocalElement(local.sourceStart); // findLocalElement() cannot find local variable
  LocalVariable localVar = null;
  if(parent != null) {
    localVar = new LocalVariable(
        (JavaElement)parent,
        new String(local.name),
        local.declarationSourceStart,
        local.declarationSourceEnd,
        local.sourceStart,
        local.sourceEnd,
        Util.typeSignature(local.type),
        local.annotations,
        local.modifiers,
        local.getKind() == AbstractVariableDeclaration.PARAMETER);
  }
  if (localVar != null) {
    addElement(localVar);
    if(SelectionEngine.DEBUG){
      System.out.print("SELECTION - accept local variable("); //$NON-NLS-1$
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

          }
        } 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

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

              startPosition = fieldDeclaration.sourceStart;
              endPosition = fieldDeclaration.sourceEnd;
            }
          } else if (binding instanceof AptSourceLocalVariableBinding){
            AptSourceLocalVariableBinding parameterBinding = (AptSourceLocalVariableBinding) binding;
            LocalDeclaration parameterDeclaration = parameterBinding.declaration;
            if (parameterDeclaration != null) {
              MethodBinding methodBinding = parameterBinding.methodBinding;
              if (methodBinding != null) {
                referenceContext = methodBinding.sourceMethod();
              }
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.