Examples of JsCodeScope


Examples of com.google.collide.client.code.autocomplete.codegraph.js.JsCodeScope

    JsIndexUpdater indexUpdater = new JsIndexUpdater();
    indexUpdater.onBeforeParse();

    previousLine = TaggableLineUtil.getPreviousLine(line);
    indexUpdater.onParseLine(previousLine, line, tokens1);
    JsCodeScope aScope = line.getTag(JsIndexUpdater.TAG_SCOPE);
    assertNotNull(aScope);
    assertEquals("a", aScope.getName());

    line = line.getNextLine();
    previousLine = TaggableLineUtil.getPreviousLine(line);
    indexUpdater.onParseLine(previousLine, line, tokens2);
    JsCodeScope dProtoScope = line.getTag(JsIndexUpdater.TAG_SCOPE);
    assertNotNull(dProtoScope);
    assertEquals("d.prototype", dProtoScope.getName());
    assertTrue(dProtoScope.getParent() == aScope);
    assertEquals("a-d-prototype", JsCodeScope.buildPrefix(dProtoScope).join("-"));

    line = line.getNextLine();
    previousLine = TaggableLineUtil.getPreviousLine(line);
    indexUpdater.onParseLine(previousLine, line, tokens3);
    assertTrue(line.getTag(JsIndexUpdater.TAG_SCOPE) == aScope);

    line = line.getNextLine();
    previousLine = TaggableLineUtil.getPreviousLine(line);
    indexUpdater.onParseLine(previousLine, line, tokens4);
    assertFalse(line.getTag(JsIndexUpdater.TAG_SCOPE) == aScope);

    line = line.getNextLine();
    previousLine = TaggableLineUtil.getPreviousLine(line);
    indexUpdater.onParseLine(previousLine, line, tokens5);
    JsCodeScope eScope = line.getTag(JsIndexUpdater.TAG_SCOPE);
    assertNotNull(eScope);
    assertEquals("e", eScope.getName());
    assertFalse(eScope.getParent() == aScope);

    line = line.getNextLine();
    previousLine = TaggableLineUtil.getPreviousLine(line);
    indexUpdater.onParseLine(previousLine, line, tokens6);
    JsCodeScope fScope = line.getTag(JsIndexUpdater.TAG_SCOPE);
    assertNotNull(fScope);
    assertEquals("f", fScope.getName());
    assertTrue(fScope.getParent() == eScope);

    line = line.getNextLine();
    previousLine = TaggableLineUtil.getPreviousLine(line);
    indexUpdater.onParseLine(previousLine, line, tokens7);
    JsCodeScope namelessScope = line.getTag(JsIndexUpdater.TAG_SCOPE);
    assertNotNull(namelessScope);
    assertNull(namelessScope.getName());
    assertTrue(namelessScope.getParent() == fScope);

    indexUpdater.onAfterParse();
  }
View Full Code Here

Examples of com.google.collide.client.code.autocomplete.codegraph.js.JsCodeScope

      }
      return result;
    }

    // Fallback - use pre-calculated results (valid at the end of line).
    JsCodeScope jsScope = line.getTag(JsIndexUpdater.TAG_SCOPE);

    @SuppressWarnings("unchecked")
    // Trying to get results up to cursor position.
    ParseResult<State> parseResult = context.getParseResult();
    if (parseResult != null) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.