Package com.google.dart.engine.context

Examples of com.google.dart.engine.context.AnalysisException


  private CacheState checkContentState(CacheState newState) {
    if (contentState == CacheState.ERROR) {
      InstrumentationBuilder builder = Instrumentation.builder("SourceEntryImpl-checkContentState");
      builder.data("message", "contentState changing from " + contentState + " to " + newState);
      //builder.data("source", source.getFullName());
      builder.record(new AnalysisException());
      builder.log();
    }
    return newState;
  }
View Full Code Here


   *           {@link CompilationUnit}
   */
  public static Scope scopeFor(AstNode node, AnalysisErrorListener errorListener)
      throws AnalysisException {
    if (node == null) {
      throw new AnalysisException("Cannot create scope: node is null");
    } else if (node instanceof CompilationUnit) {
      ScopeBuilder builder = new ScopeBuilder(errorListener);
      return builder.scopeForAstNode(node);
    }
    AstNode parent = node.getParent();
    if (parent == null) {
      throw new AnalysisException("Cannot create scope: node is not part of a CompilationUnit");
    }
    ScopeBuilder builder = new ScopeBuilder(errorListener);
    return builder.scopeForAstNode(parent);
  }
View Full Code Here

    if (node instanceof CompilationUnit) {
      return scopeForCompilationUnit((CompilationUnit) node);
    }
    AstNode parent = node.getParent();
    if (parent == null) {
      throw new AnalysisException("Cannot create scope: node is not part of a CompilationUnit");
    }
    Scope scope = scopeForAstNode(parent);
    if (node instanceof ClassDeclaration) {
      ClassElement element = ((ClassDeclaration) node).getElement();
      if (element == null) {
        throw new AnalysisException("Cannot build a scope for an unresolved class");
      }
      scope = new ClassScope(new TypeParameterScope(scope, element), element);
    } else if (node instanceof ClassTypeAlias) {
      ClassElement element = ((ClassTypeAlias) node).getElement();
      if (element == null) {
        throw new AnalysisException("Cannot build a scope for an unresolved class type alias");
      }
      scope = new ClassScope(new TypeParameterScope(scope, element), element);
    } else if (node instanceof ConstructorDeclaration) {
      ConstructorElement element = ((ConstructorDeclaration) node).getElement();
      if (element == null) {
        throw new AnalysisException("Cannot build a scope for an unresolved constructor");
      }
      FunctionScope functionScope = new FunctionScope(scope, element);
      functionScope.defineParameters();
      scope = functionScope;
    } else if (node instanceof FunctionDeclaration) {
      ExecutableElement element = ((FunctionDeclaration) node).getElement();
      if (element == null) {
        throw new AnalysisException("Cannot build a scope for an unresolved function");
      }
      FunctionScope functionScope = new FunctionScope(scope, element);
      functionScope.defineParameters();
      scope = functionScope;
    } else if (node instanceof FunctionTypeAlias) {
      scope = new FunctionTypeScope(scope, ((FunctionTypeAlias) node).getElement());
    } else if (node instanceof MethodDeclaration) {
      ExecutableElement element = ((MethodDeclaration) node).getElement();
      if (element == null) {
        throw new AnalysisException("Cannot build a scope for an unresolved method");
      }
      FunctionScope functionScope = new FunctionScope(scope, element);
      functionScope.defineParameters();
      scope = functionScope;
    }
View Full Code Here

  }

  private Scope scopeForCompilationUnit(CompilationUnit node) throws AnalysisException {
    CompilationUnitElement unitElement = node.getElement();
    if (unitElement == null) {
      throw new AnalysisException("Cannot create scope: compilation unit is not resolved");
    }
    LibraryElement libraryElement = unitElement.getLibrary();
    if (libraryElement == null) {
      throw new AnalysisException("Cannot create scope: compilation unit is not part of a library");
    }
    return new LibraryScope(libraryElement, errorListener);
  }
View Full Code Here

    try {
      TimestampedData<CharSequence> data = getContext().getContents(source);
      content = data.getData();
      modificationTime = data.getModificationTime();
    } catch (Throwable exception) {
      throw new AnalysisException("Could not get contents of " + source, exception);
    }
  }
View Full Code Here

    TypeProvider typeProvider = ((InternalAnalysisContext) libraryElement.getContext()).getTypeProvider();
    ResolvableCompilationUnit resolvableUnit = getContext().computeResolvableCompilationUnit(source);
    modificationTime = resolvableUnit.getModificationTime();
    CompilationUnit unit = resolvableUnit.getCompilationUnit();
    if (unit == null) {
      throw new AnalysisException(
          "Internal error: computeResolvableCompilationUnit returned a value without a parsed Dart unit");
    }
    //
    // Resolve names in declarations.
    //
View Full Code Here

      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

      if (isOpaque) {
        result = new URI(result.getScheme() + ":" + result.getRawSchemeSpecificPart().substring(1));
      }
      return result;
    } catch (Exception exception) {
      throw new AnalysisException("Could not resolve URI (" + containedUri
          + ") relative to source (" + uri + ")", exception);
    }
  }
View Full Code Here

        }
      });
      errors = errorListener.getErrorsForSource(source);
      referencedLibraries = getLibrarySources();
    } catch (Exception exception) {
      throw new AnalysisException("Exception", exception);
    }
  }
View Full Code Here

   */
  private Source internalResolveUri(Source containingSource, URI containedUri)
      throws AnalysisException {
    if (!containedUri.isAbsolute()) {
      if (containingSource == null) {
        throw new AnalysisException("Cannot resolve a relative URI without a containing source: "
            + containedUri);
      }
      containedUri = containingSource.resolveRelativeUri(containedUri);
    }
    for (UriResolver resolver : resolvers) {
View Full Code Here

TOP

Related Classes of com.google.dart.engine.context.AnalysisException

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.