Package com.google.javascript.rhino.jstype

Examples of com.google.javascript.rhino.jstype.SimpleSourceFile


  public void testValidScript() {
    Node n = new Node(Token.SCRIPT);
    expectInvalid(n, Check.SCRIPT);
    n.setInputId(new InputId("something_input"));
    n.setStaticSourceFile(new SimpleSourceFile("something", false));
    expectValid(n, Check.SCRIPT);
    expectInvalid(n, Check.STATEMENT);
    expectInvalid(n, Check.EXPRESSION);
  }
View Full Code Here


   * @return If in IDE mode, returns a partial tree.
   */
  private Node parseError(String source, String... errors) {
    TestErrorReporter testErrorReporter = new TestErrorReporter(errors, null);
    ParseResult result = ParserRunner.parse(
        new SimpleSourceFile("input", false),
        source,
        ParserRunner.createConfig(isIdeMode, mode, false, null),
        testErrorReporter);
    Node script = result.ast;

View Full Code Here

   * @return The parse tree.
   */
  private Node parseWarning(String string, String... warnings) {
    TestErrorReporter testErrorReporter = new TestErrorReporter(null, warnings);
    Node script = null;
    StaticSourceFile file = new SimpleSourceFile("input", false);
    script = ParserRunner.parse(file,
      string,
      ParserRunner.createConfig(isIdeMode, mode, false, null),
      testErrorReporter).ast;

View Full Code Here

  }

  private Node parse(String source, String... warnings) {
    TestErrorReporter testErrorReporter = new TestErrorReporter(null, warnings);
    Node script = ParserRunner.parse(
        new SimpleSourceFile("input", false),
        source,
        ParserRunner.createConfig(true, mode, false, null),
        testErrorReporter).ast;

    // verifying that all warnings were seen
View Full Code Here

    Config config =
        new Config(extraAnnotations, extraSuppressions,
            true, LanguageMode.ECMASCRIPT3, false);

    ParseResult result = ParserRunner.parse(
        new SimpleSourceFile("source", false), code, config, testErrorReporter);

    assertTrue("some expected warnings were not reported",
        testErrorReporter.hasEncounteredAllWarnings());
    return result.ast;
  }
View Full Code Here

      boolean parseFileOverview, String... warnings) {
    TestErrorReporter errorReporter = new TestErrorReporter(null, warnings);

    Config config = new Config(extraAnnotations, extraSuppressions,
        parseDocumentation, LanguageMode.ECMASCRIPT3, false);
    StaticSourceFile file = new SimpleSourceFile("testcode", false);
    Node associatedNode = new Node(Token.SCRIPT);
    associatedNode.setInputId(new InputId(file.getName()));
    associatedNode.setStaticSourceFile(file);

    JsDocInfoParser jsdocParser = new JsDocInfoParser(
        stream(comment),
        comment,
View Full Code Here

    this.putProp(STATIC_SOURCE_FILE, file);
  }

  /** Sets the source file to a non-extern file of the given name. */
  public void setSourceFileForTesting(String name) {
    this.putProp(STATIC_SOURCE_FILE, new SimpleSourceFile(name, false));
  }
View Full Code Here

  }

  public void putProp(int propType, Object value) {
    if (propType == SOURCENAME_PROP) {
      putProp(
          STATIC_SOURCE_FILE, new SimpleSourceFile((String) value, false));
      return;
    }

    removeProp(propType);
    if (value != null) {
View Full Code Here

    this.putProp(STATIC_SOURCE_FILE, file);
  }

  /** Sets the source file to a non-extern file of the given name. */
  public void setSourceFileForTesting(String name) {
    this.putProp(STATIC_SOURCE_FILE, new SimpleSourceFile(name, false));
  }
View Full Code Here

  private Node parseError(String string, String... errors) {
    TestErrorReporter testErrorReporter = new TestErrorReporter(errors, null);
    Node script = null;
    try {

      StaticSourceFile file = new SimpleSourceFile("input", false);
      script = ParserRunner.parse(
          file, string, ParserRunner.createConfig(isIdeMode, mode, false),
          testErrorReporter, Logger.getAnonymousLogger());
    } catch (IOException e) {
      throw new RuntimeException(e);
View Full Code Here

TOP

Related Classes of com.google.javascript.rhino.jstype.SimpleSourceFile

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.