Package com.google.dart.engine.error

Examples of com.google.dart.engine.error.AnalysisError


    reportErrorForOffset(errorCode, offset, length, arguments);
  }

  private void reportErrorForOffset(ErrorCode errorCode, int offset, int length,
      Object... arguments) {
    errorListener.onError(new AnalysisError(source, offset, length, errorCode, arguments));
  }
View Full Code Here


        PropertyAccessorElement accessor = (PropertyAccessorElement) duplicate;
        if (accessor.isSynthetic()) {
          offset = accessor.getVariable().getNameOffset();
        }
      }
      return new AnalysisError(
          duplicate.getSource(),
          offset,
          duplicate.getDisplayName().length(),
          CompileTimeErrorCode.PREFIX_COLLIDES_WITH_TOP_LEVEL_MEMBER,
          existing.getDisplayName());
View Full Code Here

  protected AnalysisError getErrorForDuplicate(Element existing, Element duplicate) {
    // TODO(brianwilkerson) Customize the error message based on the types of elements that share
    // the same name.
    // TODO(jwren) There are 4 error codes for duplicate, but only 1 is being generated.
    Source source = duplicate.getSource();
    return new AnalysisError(
        source,
        duplicate.getNameOffset(),
        duplicate.getDisplayName().length(),
        CompileTimeErrorCode.DUPLICATE_DEFINITION,
        existing.getDisplayName());
View Full Code Here

    // May be there is a hidden Element.
    if (hasHiddenName) {
      Element hiddenElement = hiddenElements.get(name);
      if (hiddenElement != null) {
        getErrorListener().onError(
            new AnalysisError(
                getSource(identifier),
                identifier.getOffset(),
                identifier.getLength(),
                CompileTimeErrorCode.REFERENCED_BEFORE_DECLARATION));
        return hiddenElement;
View Full Code Here

      if (directive.validate() != null) {
        return;
      }
    }
    StringLiteral uriLiteral = directive.getUri();
    errorListener.onError(new AnalysisError(
        librarySource,
        uriLiteral.getOffset(),
        uriLiteral.getLength(),
        CompileTimeErrorCode.URI_DOES_NOT_EXIST,
        directive.getUriContent()));
View Full Code Here

      String[] libraryNames = new String[count];
      for (int i = 0; i < count; i++) {
        libraryNames[i] = getLibraryName(conflictingMembers[i]);
      }
      Arrays.sort(libraryNames);
      errorListener.onError(new AnalysisError(
          getSource(identifier),
          identifier.getOffset(),
          identifier.getLength(),
          StaticWarningCode.AMBIGUOUS_IMPORT,
          foundEltName,
View Full Code Here

      }
    }
    if (sdkElement != null && to > 0) {
      String sdkLibName = getLibraryName(sdkElement);
      String otherLibName = getLibraryName(conflictingMembers[0]);
      errorListener.onError(new AnalysisError(
          getSource(identifier),
          identifier.getOffset(),
          identifier.getLength(),
          StaticWarningCode.CONFLICTING_DART_IMPORT,
          name,
View Full Code Here

  @Override
  protected AnalysisError getErrorForDuplicate(Element existing, Element duplicate) {
    if (existing instanceof PropertyAccessorElement && duplicate instanceof MethodElement) {
      if (existing.getNameOffset() < duplicate.getNameOffset()) {
        return new AnalysisError(
            duplicate.getSource(),
            duplicate.getNameOffset(),
            duplicate.getDisplayName().length(),
            CompileTimeErrorCode.METHOD_AND_GETTER_WITH_SAME_NAME,
            existing.getDisplayName());
      } else {
        return new AnalysisError(
            existing.getSource(),
            existing.getNameOffset(),
            existing.getDisplayName().length(),
            CompileTimeErrorCode.GETTER_AND_METHOD_WITH_SAME_NAME,
            existing.getDisplayName());
View Full Code Here

          Source templateSource = context.getSourceFactory().forUri(
              source.resolveRelativeUri(new URI(templateUri)));
          if (!context.exists(templateSource)) {
            templateSource = context.getSourceFactory().resolveUri(source, "package:" + templateUri);
            if (!context.exists(templateSource)) {
              errorListener.onError(new AnalysisError(
                  angularElement.getSource(),
                  hasTemplate.getTemplateUriOffset(),
                  templateUri.length(),
                  AngularCode.URI_DOES_NOT_EXIST,
                  templateUri));
              continue;
            }
          }
          if (!AnalysisEngine.isHtmlFileName(templateUri)) {
            continue;
          }
          if (hasTemplate instanceof AngularComponentElementImpl) {
            ((AngularComponentElementImpl) hasTemplate).setTemplateSource(templateSource);
          }
          if (hasTemplate instanceof AngularViewElementImpl) {
            ((AngularViewElementImpl) hasTemplate).setTemplateSource(templateSource);
          }
        } catch (URISyntaxException exception) {
          errorListener.onError(new AnalysisError(
              angularElement.getSource(),
              hasTemplate.getTemplateUriOffset(),
              templateUri.length(),
              AngularCode.INVALID_URI,
              templateUri));
View Full Code Here

  /**
   * Reports given {@link ErrorCode} at the given position.
   */
  void reportErrorForOffset(ErrorCode errorCode, int offset, int length, Object... arguments) {
    errorListener.onError(new AnalysisError(source, offset, length, errorCode, arguments));
  }
View Full Code Here

TOP

Related Classes of com.google.dart.engine.error.AnalysisError

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.