Package org.eclipse.jdt.internal.compiler

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


      this.typeRoot = root;
     
      this.checkCancel();
     
      // for now until we can change the UI.
      CompilationResult result = new CompilationResult(sourceUnit, 1, 1, this.compilerOptions.maxProblemsPerUnit);
      CompilationUnitDeclaration parsedUnit = this.parser.dietParse(sourceUnit, result, this.actualCompletionPosition);

      //    boolean completionNodeFound = false;
      if (parsedUnit != null) {
        if(DEBUG) {
View Full Code Here


    while(topLevelType.getDeclaringType() != null) {
      topLevelType = topLevelType.getDeclaringType();
    }

    this.fileName = topLevelType.getParent().getElementName().toCharArray();
    CompilationResult compilationResult = new CompilationResult(this.fileName, 1, 1, this.compilerOptions.maxProblemsPerUnit);

    CompilationUnitDeclaration compilationUnit = null;

    try {
      // TypeConverter is used instead of SourceTypeConverter because the type
View Full Code Here

      "FakeType.java", //$NON-NLS-1$
      encoding);

    this.actualCompletionPosition = prefix.length() + position - 1;

    CompilationResult fakeResult = new CompilationResult(fakeUnit, 1, 1, this.compilerOptions.maxProblemsPerUnit);
    CompilationUnitDeclaration fakeAST = this.parser.dietParse(fakeUnit, fakeResult, this.actualCompletionPosition);

    parseBlockStatements(fakeAST, this.actualCompletionPosition);

    return (Initializer)fakeAST.types[0].fields[0];
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

      new ProblemReporter(
          DefaultErrorHandlingPolicies.proceedWithAllProblems(),
          compilerOptions,
          new DefaultProblemFactory()),
      false);
    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

          // requested AST
          char[] fileName = unit.compilationResult.getFileName();
          ICompilationUnit source = (ICompilationUnit) this.requestedSources.get(fileName);
          if (source != null) {
            // convert AST
            CompilationResult compilationResult = unit.compilationResult;
            org.eclipse.jdt.internal.compiler.env.ICompilationUnit sourceUnit = compilationResult.compilationUnit;
            char[] contents = sourceUnit.getContents();
            AST ast = AST.newAST(apiLevel);
            ast.setFlag(flags | AST.RESOLVED_BINDINGS);
            ast.setDefaultNodeFlag(ASTNode.ORIGINAL);
            ASTConverter converter = new ASTConverter(compilerOptions, true/*need to resolve bindings*/, this.monitor);
            BindingResolver resolver = new DefaultBindingResolver(unit.scope, owner, this.bindingTables, (flags & ICompilationUnit.ENABLE_BINDINGS_RECOVERY) != 0, this.fromJavaProject);
            ast.setBindingResolver(resolver);
            converter.setAST(ast);
            CompilationUnit compilationUnit = converter.convert(unit, contents);
            compilationUnit.setTypeRoot(source);
            compilationUnit.setLineEndTable(compilationResult.getLineSeparatorPositions());
            ast.setDefaultNodeFlag(0);
            ast.setOriginalModificationCount(ast.modificationCount());

            // pass it to requestor
            astRequestor.acceptAST(source, compilationUnit);
View Full Code Here

          // requested AST
          char[] fileName = unit.compilationResult.getFileName();
          org.eclipse.jdt.internal.compiler.env.ICompilationUnit source = (org.eclipse.jdt.internal.compiler.env.ICompilationUnit) this.requestedSources.get(fileName);
          if (source != null) {
            // convert AST
            CompilationResult compilationResult = unit.compilationResult;
            org.eclipse.jdt.internal.compiler.env.ICompilationUnit sourceUnit = compilationResult.compilationUnit;
            char[] contents = sourceUnit.getContents();
            AST ast = AST.newAST(apiLevel);
            ast.setFlag(flags | AST.RESOLVED_BINDINGS);
            ast.setDefaultNodeFlag(ASTNode.ORIGINAL);
            ASTConverter converter = new ASTConverter(compilerOptions, true/*need to resolve bindings*/, this.monitor);
            BindingResolver resolver = new DefaultBindingResolver(unit.scope, null, this.bindingTables, (flags & ICompilationUnit.ENABLE_BINDINGS_RECOVERY) != 0, this.fromJavaProject);
            ast.setBindingResolver(resolver);
            converter.setAST(ast);
            CompilationUnit compilationUnit = converter.convert(unit, contents);
            compilationUnit.setTypeRoot(null);
            compilationUnit.setLineEndTable(compilationResult.getLineSeparatorPositions());
            ast.setDefaultNodeFlag(0);
            ast.setOriginalModificationCount(ast.modificationCount());

            // pass it to requestor
            astRequestor.acceptAST(new String(source.getFileName()), compilationUnit);
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

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.