Package org.eclipse.jdt.internal.compiler

Examples of org.eclipse.jdt.internal.compiler.CompilationResult


      return (JMethodBody) method.getBody();
    }

    private SourceInfo makeSourceInfo(AbstractMethodDeclaration methodDecl,
        HasSourceInfo enclosing) {
      CompilationResult compResult = methodDecl.compilationResult;
      int[] indexes = compResult.lineSeparatorPositions;
      String fileName = String.valueOf(compResult.fileName);
      int startLine = Util.getLineNumber(methodDecl.sourceStart, indexes, 0,
          indexes.length - 1);
      SourceInfo toReturn = program.createSourceInfo(methodDecl.sourceStart,
View Full Code Here


     * more straightforward), it makes for fewer kinds of things to worry about
     * when optimizing (more aggressive optimizations), and it's how Java
     * actually implements the stuff under the hood anyway.
     */
    private boolean process(TypeDeclaration typeDeclaration) {
      CompilationResult compResult = typeDeclaration.compilationResult;
      currentSeparatorPositions = compResult.lineSeparatorPositions;
      currentFileName = String.valueOf(compResult.fileName);
      SourceTypeBinding binding = typeDeclaration.binding;

      if (binding.constantPoolName() == null) {
View Full Code Here

        CompilationUnitScope scope) {
      return process(typeDeclaration);
    }

    private SourceInfo makeSourceInfo(TypeDeclaration typeDecl) {
      CompilationResult compResult = typeDecl.compilationResult;
      int[] indexes = compResult.lineSeparatorPositions;
      String fileName = String.valueOf(compResult.fileName);
      int startLine = Util.getLineNumber(typeDecl.sourceStart, indexes, 0,
          indexes.length - 1);
      return program.createSourceInfo(typeDecl.sourceStart, typeDecl.bodyEnd,
View Full Code Here

  // see bug 47079 for more details
  int[] oldLineEnds = this.scanner.lineEnds;
  int oldLinePtr = this.scanner.linePtr;

  //real parse of the method....
  CompilationResult compilationResult = unit.compilationResult;
  char[] contents = this.readManager != null
    ? this.readManager.getContents(compilationResult.compilationUnit)
    : compilationResult.compilationUnit.getContents();
  this.scanner.setSource(contents, compilationResult);
View Full Code Here

  }
  return end;
}
private int retrieveEndingPositionAfterOpeningParenthesis(int sourceStart, int sourceEnd, int numberOfParen) {
  if (this.referenceContext == null) return sourceEnd;
  CompilationResult compilationResult = this.referenceContext.compilationResult();
  if (compilationResult == null) return sourceEnd;
  ICompilationUnit compilationUnit = compilationResult.getCompilationUnit();
  if (compilationUnit == null) return sourceEnd;
  char[] contents = compilationUnit.getContents();
  if (contents.length == 0) return sourceEnd;
  if (this.positionScanner == null) {
    this.positionScanner = new Scanner(false, false, false, this.options.sourceLevel, this.options.complianceLevel, null, null, false);
View Full Code Here

  }
  return sourceEnd;
}
private int retrieveStartingPositionAfterOpeningParenthesis(int sourceStart, int sourceEnd, int numberOfParen) {
  if (this.referenceContext == null) return sourceStart;
  CompilationResult compilationResult = this.referenceContext.compilationResult();
  if (compilationResult == null) return sourceStart;
  ICompilationUnit compilationUnit = compilationResult.getCompilationUnit();
  if (compilationUnit == null) return sourceStart;
  char[] contents = compilationUnit.getContents();
  if (contents.length == 0) return sourceStart;
  if (this.positionScanner == null) {
    this.positionScanner = new Scanner(false, false, false, this.options.sourceLevel, this.options.complianceLevel, null, null, false);
View Full Code Here

      typeReference.sourceStart,
      typeReference.sourceEnd);
}
private int retrieveClosingAngleBracketPosition(int start) {
  if (this.referenceContext == null) return start;
  CompilationResult compilationResult = this.referenceContext.compilationResult();
  if (compilationResult == null) return start;
  ICompilationUnit compilationUnit = compilationResult.getCompilationUnit();
  if (compilationUnit == null) return start;
  char[] contents = compilationUnit.getContents();
  if (contents.length == 0) return start;
  if (this.positionScanner == null) {
    this.positionScanner = new Scanner(false, false, false, this.options.sourceLevel, this.options.complianceLevel, null, null, false);
View Full Code Here

    // walks the source units
    this.requestedSources = new HashtableOfObject();
    for (int i = 0; i < sourceLength; i++) {
      org.eclipse.jdt.internal.compiler.env.ICompilationUnit sourceUnit = sourceUnits[i];
      CompilationUnitDeclaration parsedUnit;
      CompilationResult unitResult =
        new CompilationResult(sourceUnit, index++, maxUnits, this.options.maxProblemsPerUnit);
      try {
        if (this.options.verbose) {
          this.out.println(
            Messages.bind(Messages.compilation_request,
            new String[] {
              String.valueOf(index++ + 1),
              String.valueOf(maxUnits),
              new String(sourceUnit.getFileName())
            }));
        }
        // diet parsing for large collection of units
        if (this.totalUnits < this.parseThreshold) {
          parsedUnit = this.parser.parse(sourceUnit, unitResult);
        } else {
          parsedUnit = this.parser.dietParse(sourceUnit, unitResult);
        }
        // initial type binding creation
        this.lookupEnvironment.buildTypeBindings(parsedUnit, null /*no access restriction*/);
        addCompilationUnit(sourceUnit, parsedUnit);
        this.requestedSources.put(unitResult.getFileName(), sourceUnit);
        worked(1);
      } finally {
        sourceUnits[i] = null; // no longer hold onto the unit
      }
    }
View Full Code Here

        false);
      int unitLength = compilationUnits.length;
      if (monitor != null) monitor.beginTask("", unitLength); //$NON-NLS-1$
      for (int i = 0; i < unitLength; i++) {
        org.eclipse.jdt.internal.compiler.env.ICompilationUnit sourceUnit = (org.eclipse.jdt.internal.compiler.env.ICompilationUnit) compilationUnits[i];
        CompilationResult compilationResult = new CompilationResult(sourceUnit, 0, 0, compilerOptions.maxProblemsPerUnit);
        CompilationUnitDeclaration compilationUnitDeclaration = parser.dietParse(sourceUnit, compilationResult);

        if (compilationUnitDeclaration.ignoreMethodBodies) {
          compilationUnitDeclaration.ignoreFurtherInvestigation = true;
          // if initial diet parse did not work, no need to dig into method bodies.
View Full Code Here

          // go to the next unit
          continue;
        }
        org.eclipse.jdt.internal.compiler.batch.CompilationUnit compilationUnit = new org.eclipse.jdt.internal.compiler.batch.CompilationUnit(contents, sourceUnits[i], encoding);
        org.eclipse.jdt.internal.compiler.env.ICompilationUnit sourceUnit = compilationUnit;
        CompilationResult compilationResult = new CompilationResult(sourceUnit, 0, 0, compilerOptions.maxProblemsPerUnit);
        CompilationUnitDeclaration compilationUnitDeclaration = parser.dietParse(sourceUnit, compilationResult);

        if (compilationUnitDeclaration.ignoreMethodBodies) {
          compilationUnitDeclaration.ignoreFurtherInvestigation = true;
          // if initial diet parse did not work, no need to dig into method bodies.
View Full Code Here

TOP

Related Classes of org.eclipse.jdt.internal.compiler.CompilationResult

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.