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

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


    //
    // Then parse the token stream.
    //
    TimeCounterHandle timeCounterParse = PerformanceStatistics.parse.start();
    try {
      final RecordingErrorListener errorListener = new RecordingErrorListener();
      Parser parser = new Parser(source, errorListener);
      AnalysisOptions options = getContext().getAnalysisOptions();
      parser.setParseFunctionBodies(options.getAnalyzeFunctionBodies());
      parser.setParseAsync(options.getEnableAsync());
      parser.setParseDeferredLibraries(options.getEnableDeferredLoading());
      parser.setParseEnum(options.getEnableEnum());
      unit = parser.parseCompilationUnit(tokenStream);
      unit.setLineInfo(lineInfo);
      AnalysisContext analysisContext = getContext();
      for (Directive directive : unit.getDirectives()) {
        if (directive instanceof PartOfDirective) {
          containsPartOfDirective = true;
        } else {
          containsNonPartOfDirective = true;
          if (directive instanceof UriBasedDirective) {
            Source referencedSource = resolveDirective(
                analysisContext,
                source,
                (UriBasedDirective) directive,
                errorListener);
            if (referencedSource != null) {
              if (directive instanceof ExportDirective) {
                exportedSources.add(referencedSource);
              } else if (directive instanceof ImportDirective) {
                importedSources.add(referencedSource);
              } else if (directive instanceof PartDirective) {
                if (!referencedSource.equals(source)) {
                  includedSources.add(referencedSource);
                }
              } else {
                throw new AnalysisException(getClass().getSimpleName() + " failed to handle a "
                    + directive.getClass().getName());
              }
            }
          }
        }
      }
      errors = errorListener.getErrorsForSource(source);
    } finally {
      timeCounterParse.stop();
    }
  }
View Full Code Here


   *
   * @param analysisContext the analysis context in which the library is being analyzed
   */
  public LibraryResolver(InternalAnalysisContext analysisContext) {
    this.analysisContext = analysisContext;
    this.errorListener = new RecordingErrorListener();
    coreLibrarySource = analysisContext.getSourceFactory().forUri(DartSdk.DART_CORE);
  }
View Full Code Here

   *
   * @param analysisContext the analysis context in which the library is being analyzed
   */
  public LibraryResolver2(InternalAnalysisContext analysisContext) {
    this.analysisContext = analysisContext;
    this.errorListener = new RecordingErrorListener();
    coreLibrarySource = analysisContext.getSourceFactory().forUri(DartSdk.DART_CORE);
  }
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.