Package com.google.dart.engine.internal.element

Examples of com.google.dart.engine.internal.element.EmbeddedHtmlScriptElementImpl


    try {
      Source htmlSource = htmlElement.getSource();
      XmlAttributeNode scriptAttribute = getScriptSourcePath(node);
      String scriptSourcePath = scriptAttribute == null ? null : scriptAttribute.getText();
      if (node.getAttributeEnd().getType() == TokenType.GT && scriptSourcePath == null) {
        EmbeddedHtmlScriptElementImpl script = new EmbeddedHtmlScriptElementImpl(node);
        try {
          LibraryResolver resolver = new LibraryResolver(context);
          LibraryElementImpl library = (LibraryElementImpl) resolver.resolveEmbeddedLibrary(
              htmlSource,
              modificationStamp,
              node.getScript(),
              true);
          script.setScriptLibrary(library);
          resolvedLibraries.addAll(resolver.getResolvedLibraries());
          errorListener.addAll(resolver.getErrorListener());
        } catch (AnalysisException exception) {
          //TODO (danrubel): Handle or forward the exception
          AnalysisEngine.getInstance().getLogger().logError(
              "Could not resolve script tag",
              exception);
        }
        node.setScriptElement(script);
        scripts.add(script);
      } else {
        ExternalHtmlScriptElementImpl script = new ExternalHtmlScriptElementImpl(node);
        if (scriptSourcePath != null) {
          try {
            scriptSourcePath = UriUtilities.encode(scriptSourcePath);
            // Force an exception to be thrown if the URI is invalid so that we can report the
            // problem.
            new URI(scriptSourcePath);
            Source scriptSource = context.getSourceFactory().resolveUri(
                htmlSource,
                scriptSourcePath);
            script.setScriptSource(scriptSource);
            if (!context.exists(scriptSource)) {
              reportValueError(
                  HtmlWarningCode.URI_DOES_NOT_EXIST,
                  scriptAttribute,
                  scriptSourcePath);
View Full Code Here

TOP

Related Classes of com.google.dart.engine.internal.element.EmbeddedHtmlScriptElementImpl

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.