Package com.google.dart.engine.internal.context

Examples of com.google.dart.engine.internal.context.RecordingErrorListener


  @Override
  protected void internalPerform() throws AnalysisException {
    TimeCounterHandle timeCounter = PerformanceStatistics.errors.start();
    try {
      RecordingErrorListener errorListener = new RecordingErrorListener();
      ErrorReporter errorReporter = new ErrorReporter(errorListener, source);
      TypeProvider typeProvider = getContext().getTypeProvider();
      //
      // Validate the directives
      //
      validateDirectives(getContext(), source, unit, errorListener);
      //
      // Use the ConstantVerifier to verify the use of constants. This needs to happen before using
      // the ErrorVerifier because some error codes need the computed constant values.
      //
      ConstantVerifier constantVerifier = new ConstantVerifier(
          errorReporter,
          libraryElement,
          typeProvider);
      unit.accept(constantVerifier);
      //
      // Use the ErrorVerifier to compute the rest of the errors.
      //
      ErrorVerifier errorVerifier = new ErrorVerifier(
          errorReporter,
          libraryElement,
          typeProvider,
          new InheritanceManager(libraryElement));
      unit.accept(errorVerifier);
      errors = errorListener.getErrorsForSource(source);
    } finally {
      timeCounter.stop();
    }
  }
View Full Code Here


    //
    // Build the standard HTML element.
    //
    HtmlUnitBuilder builder = new HtmlUnitBuilder(getContext());
    element = builder.buildHtmlElement(source, modificationTime, unit);
    final RecordingErrorListener errorListener = builder.getErrorListener();
    //
    // Validate the directives
    //
    unit.accept(new RecursiveXmlVisitor<Void>() {
      @Override
      public Void visitHtmlScriptTagNode(HtmlScriptTagNode node) {
        CompilationUnit script = node.getScript();
        if (script != null) {
          GenerateDartErrorsTask.validateDirectives(getContext(), source, script, errorListener);
        }
        return null;
      }
    });
    //
    // Record all resolution errors.
    //
    resolutionErrors = errorListener.getErrorsForSource(source);
    //
    // Remember the resolved unit.
    //
    resolvedUnit = unit;
  }
View Full Code Here

    return "build Polymer elements " + source.getFullName();
  }

  @Override
  protected void internalPerform() throws AnalysisException {
    RecordingErrorListener errorListener = new RecordingErrorListener();
    PolymerHtmlUnitBuilder resolver = new PolymerHtmlUnitBuilder(
        getContext(),
        errorListener,
        source,
        lineInfo,
        unit);
    resolver.build();
    errors = errorListener.getErrorsForSource(source);
  }
View Full Code Here

    return "resolve as Polymer " + source.getFullName();
  }

  @Override
  protected void internalPerform() throws AnalysisException {
    RecordingErrorListener errorListener = new RecordingErrorListener();
    PolymerHtmlUnitResolver resolver = new PolymerHtmlUnitResolver(
        getContext(),
        errorListener,
        source,
        lineInfo,
        unit);
    resolver.resolveUnit();
    errors = errorListener.getErrorsForSource(source);
  }
View Full Code Here

   *
   * @param context the analysis context in which the element model will be built
   */
  public HtmlUnitBuilder(InternalAnalysisContext context) {
    this.context = context;
    this.errorListener = new RecordingErrorListener();
  }
View Full Code Here

    //
    new DeclarationResolver().resolve(unit, find(libraryElement, source));
    //
    // Resolve the type names.
    //
    RecordingErrorListener errorListener = new RecordingErrorListener();
    TypeResolverVisitor typeResolverVisitor = new TypeResolverVisitor(
        libraryElement,
        source,
        typeProvider,
        errorListener);
View Full Code Here

    return "scan as dart " + source.getFullName();
  }

  @Override
  protected void internalPerform() throws AnalysisException {
    final RecordingErrorListener errorListener = new RecordingErrorListener();
    TimeCounterHandle timeCounterScan = PerformanceStatistics.scan.start();
    try {
      Scanner scanner = new Scanner(source, new CharSequenceReader(content), errorListener);
      scanner.setPreserveComments(getContext().getAnalysisOptions().getPreserveComments());
      tokenStream = scanner.tokenize();
      lineInfo = new LineInfo(scanner.getLineStarts());
      errors = errorListener.getErrorsForSource(source);
    } catch (Exception exception) {
      throw new AnalysisException("Exception", exception);
    } finally {
      timeCounterScan.stop();
    }
View Full Code Here

  @Override
  protected void internalPerform() throws AnalysisException {
    //
    // Prepare for resolution.
    //
    RecordingErrorListener errorListener = new RecordingErrorListener();
    LineInfo lineInfo = getContext().getLineInfo(source);
    //
    // Perform resolution.
    //
    if (application != null) {
      AngularHtmlUnitResolver resolver = new AngularHtmlUnitResolver(
          getContext(),
          errorListener,
          source,
          lineInfo,
          unit);
      resolver.resolveComponentTemplate(application, component);
      resolvedUnit = unit;
    }
    //
    // Remember the errors.
    //
    resolutionErrors = errorListener.getErrorsForSource(source);
  }
View Full Code Here

      compilationUnits[i] = units[i].getData();
    }
    //
    // Analyze all of the units.
    //
    RecordingErrorListener errorListener = new RecordingErrorListener();
    HintGenerator hintGenerator = new HintGenerator(compilationUnits, getContext(), errorListener);
    hintGenerator.generateForLibrary();
    //
    // Store the results.
    //
    hintMap = new HashMap<Source, TimestampedData<AnalysisError[]>>(unitCount);
    for (int i = 0; i < unitCount; i++) {
      long modificationTime = units[i].getModificationTime();
      Source source = units[i].getData().getElement().getSource();
      AnalysisError[] errors = errorListener.getErrorsForSource(source);
      hintMap.put(source, new TimestampedData<AnalysisError[]>(modificationTime, errors));
    }
  }
View Full Code Here

    try {
      AbstractScanner scanner = new StringScanner(source, content);
      scanner.setPassThroughElements(new String[] {TAG_SCRIPT});
      Token token = scanner.tokenize();
      lineInfo = new LineInfo(scanner.getLineStarts());
      final RecordingErrorListener errorListener = new RecordingErrorListener();
      unit = new HtmlParser(source, errorListener).parse(token, lineInfo);
      unit.accept(new RecursiveXmlVisitor<Void>() {
        @Override
        public Void visitHtmlScriptTagNode(HtmlScriptTagNode node) {
          resolveScriptDirectives(node.getScript(), errorListener);
          return null;
        }
      });
      errors = errorListener.getErrorsForSource(source);
      referencedLibraries = getLibrarySources();
    } catch (Exception exception) {
      throw new AnalysisException("Exception", exception);
    }
  }
View Full Code Here

TOP

Related Classes of com.google.dart.engine.internal.context.RecordingErrorListener

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.