Examples of CompilationResult


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

          // requested AST
          char[] fileName = unit.compilationResult.getFileName();
          ICompilationUnit source = (ICompilationUnit) this.requestedSources.get(fileName);
          if (source != null) {
            // convert AST
            CompilationResult compilationResult = unit.compilationResult;
            org.aspectj.org.eclipse.jdt.internal.compiler.env.ICompilationUnit sourceUnit = compilationResult.compilationUnit;
            char[] contents = sourceUnit.getContents();
            // AspectJ Extension start - use the factory
            // old code:
            // AST ast = AST.newAST(apiLevel);
            // new code:
            AST ast = ASTParser.getAST(apiLevel);
            // End AspectJ Extension
            ast.setFlag(flags | AST.RESOLVED_BINDINGS);
            ast.setDefaultNodeFlag(ASTNode.ORIGINAL);
            // AspectJ Extension - use the factory
            // old code:
            // ASTConverter converter = new ASTConverter(compilerOptions, true/*need to resolve bindings*/, this.monitor);
            // new code:
            ASTConverter converter = ASTConverter.getASTConverter(compilerOptions,true,this.monitor);
            // End AspectJ Extension
            BindingResolver resolver = new DefaultBindingResolver(unit.scope, owner, this.bindingTables, (flags & ICompilationUnit.ENABLE_BINDINGS_RECOVERY) != 0);
            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

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

  /* recovery */
  recordLastStatementIfNeeded();
}
protected CompilationUnitDeclaration endParse(int act) {
  if (this.hasRecoveredOnExpression) {
    CompilationResult unitResult = this.compilationUnit.compilationResult;
    if (act != ERROR_ACTION) { // expression recovery worked
      // flush previously recorded problems
      for (int i = 0; i < unitResult.problemCount; i++) {
        unitResult.problems[i] = null; // discard problem
      }
View Full Code Here

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

  ISourceType sourceType = sourceTypes[0];
  while (sourceType.getEnclosingType() != null)
    sourceType = sourceType.getEnclosingType();
 
  // build corresponding compilation unit
  CompilationResult result = new CompilationResult(sourceType.getFileName(), 1, 1, this.options.maxProblemsPerUnit);
  CompilationUnitDeclaration unit =
    SourceTypeConverter.buildCompilationUnit(
      new ISourceType[] {sourceType}, // ignore secondary types, to improve laziness
      SourceTypeConverter.MEMBER_TYPE, // need member types
      // no need for field initialization
View Full Code Here

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

       
        // build parsed unit
        CompilationUnitDeclaration parsedUnit = null;
        if (cu.isOpen()) {
          // create parsed unit from source element infos
          CompilationResult result = new CompilationResult(((ICompilationUnit)cu).getFileName(), i, openablesLength, this.options.maxProblemsPerUnit);
          SourceTypeElementInfo[] typeInfos = null;
          try {
            IType[] topLevelTypes = cu.getTypes();
            int topLevelLength = topLevelTypes.length;
            if (topLevelLength == 0) continue; // empty cu: no need to parse (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=65677)
            typeInfos = new SourceTypeElementInfo[topLevelLength];
            for (int j = 0; j < topLevelLength; j++) {
              IType topLevelType = topLevelTypes[j];
              typeInfos[j] = (SourceTypeElementInfo)((JavaElement)topLevelType).getElementInfo();
            }
          } catch (JavaModelException e) {
            // types/cu exist since cu is opened
          }
          int flags = !containsLocalType
            ? SourceTypeConverter.MEMBER_TYPE
            : SourceTypeConverter.FIELD_AND_METHOD | SourceTypeConverter.MEMBER_TYPE | SourceTypeConverter.LOCAL_TYPE;
          parsedUnit =
            SourceTypeConverter.buildCompilationUnit(
              typeInfos,
              flags,
              this.lookupEnvironment.problemReporter,
              result);
          if (containsLocalType)   parsedUnit.bits |= ASTNode.HasAllMethodBodies;
        } else {
          // create parsed unit from file
          IFile file = (IFile) cu.getResource();
          ICompilationUnit sourceUnit = this.builder.createCompilationUnitFromPath(openable, file);
         
          CompilationResult unitResult = new CompilationResult(sourceUnit, i, openablesLength, this.options.maxProblemsPerUnit);
          parsedUnit = parser.dietParse(sourceUnit, unitResult);
        }

        if (parsedUnit != null) {
          hasLocalType[unitsIndex] = containsLocalType;
View Full Code Here

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

    if (!maybeIncremental()) {
      return;
    }

    File sourceFile = new File(result.fileName());
    CompilationResult cr = result.result();

    references.put(sourceFile, new ReferenceCollection(cr.qualifiedReferences, cr.simpleNameReferences));

    UnwovenClassFile[] unwovenClassFiles = result.unwovenClassFiles();
    for (int i = 0; i < unwovenClassFiles.length; i++) {
View Full Code Here

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

    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

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

      "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

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

    try {
      this.fileName = sourceUnit.getFileName();
      this.actualCompletionPosition = completionPosition - 1;
      this.offset = pos;
      // 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

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

* Add an additional compilation unit into the loop
*  ->  build compilation unit declarations, their bindings and record their results.
*/
public void accept(ICompilationUnit sourceUnit, AccessRestriction accessRestriction) {
  // Switch the current policy and compilation result for this unit to the requested one.
  CompilationResult unitResult = new CompilationResult(sourceUnit, 1, 1, this.options.maxProblemsPerUnit);
  try {
    CompilationUnitDeclaration parsedUnit = basicParser().dietParse(sourceUnit, unitResult);
    this.lookupEnvironment.buildTypeBindings(parsedUnit, accessRestriction);
    this.lookupEnvironment.completeTypeBindings(parsedUnit, true);
  } catch (AbortCompilationUnit e) {
View Full Code Here

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

    SourceTypeElementInfo elementInfo = (SourceTypeElementInfo) sourceType;
    IType type = elementInfo.getHandle();
    ICompilationUnit sourceUnit = (ICompilationUnit) type.getCompilationUnit();
    accept(sourceUnit, accessRestriction);
  } else {
    CompilationResult result = new CompilationResult(sourceType.getFileName(), 1, 1, 0);
    CompilationUnitDeclaration unit =
      SourceTypeConverter.buildCompilationUnit(
        sourceTypes,
        SourceTypeConverter.FIELD_AND_METHOD // need field and methods
        | SourceTypeConverter.MEMBER_TYPE, // need member types
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.