Package com.google.gwt.dev.js.ast

Examples of com.google.gwt.dev.js.ast.JsVisitor


    assertNotNull(unit);
    List<JsniMethod> jsniMethods = unit.getJsniMethods();
    assertEquals(1, jsniMethods.size());
    JsniMethod jsniMethod = jsniMethods.get(0);
    final List<JsNameRef> foundRefs = new ArrayList<JsNameRef>();
    new JsVisitor() {
      @Override
      public void endVisit(JsNameRef x, JsContext ctx) {
        if (x.getIdent().startsWith("@")) {
          foundRefs.add(x);
        }
View Full Code Here


      if (x.isNative()) {
        // Manually rescue native parameter references
        final JsniMethodBody body = (JsniMethodBody) x.getBody();
        final JsFunction func = body.getFunc();

        new JsVisitor() {
          @Override
          public void endVisit(JsNameRef nameRef, JsContext<JsExpression> ctx) {
            JsName ident = nameRef.getName();

            if (ident != null) {
View Full Code Here

      final Set<String> nameUsed = new HashSet<String>();
      final Map<JsName, Integer> nameToFragment = new HashMap<JsName, Integer>();

      for (int i = 0; i < jsProgram.getFragmentCount(); i++) {
        final Integer fragId = i;
        new JsVisitor() {
            @Override
          public void endVisit(JsForIn x, JsContext ctx) {
            if (x.getIterVarName() != null) {
              nameUsed.add(x.getIterVarName().getIdent());
            }
View Full Code Here

    public EvaluationOrderVisitor(List<JsName> toEvaluate, JsFunction callee) {
      this.toEvaluate = toEvaluate;
      this.unevaluated = Lists.newArrayList(toEvaluate);
      // collect params and locals from callee function
      new JsVisitor() {
        @Override
        public void endVisit(JsParameter x, JsContext ctx) {
          paramsOrLocals.add(x.getName());
        }
View Full Code Here

    }
  }

  private static Set<JsName> collectReferencedNames(JsProgram program) {
    final Set<JsName> referenced = new HashSet<JsName>();
    new JsVisitor() {
      @Override
      public void endVisit(JsForIn x, JsContext ctx) {
        reference(x.getIterVarName());
      }
View Full Code Here

*/
public abstract class JsNamer {

  private static Set<JsName> collectReferencedNames(JsProgram program) {
    final Set<JsName> referenced = new HashSet<JsName>();
    new JsVisitor() {
      public void endVisit(JsForIn x, JsContext ctx) {
        reference(x.getIterVarName());
      }

      public void endVisit(JsFunction x, JsContext ctx) {
View Full Code Here

      if (x.isNative()) {
        // Manually rescue native parameter references
        final JsniMethodBody body = (JsniMethodBody) x.getBody();
        final JsFunction func = body.getFunc();

        new JsVisitor() {
          @Override
          public void endVisit(JsNameRef nameRef, JsContext ctx) {
            JsName ident = nameRef.getName();

            if (ident != null) {
View Full Code Here

    StringReader sr = new StringReader(syntheticFnHeader + '\n' + jsniCode);
    try {
      // start at -1 to avoid counting our synthetic header
      List<JsStatement> result = JsParser.parse(SourceOrigin.UNKNOWN,
          jsProgram.getScope(), sr);
      new JsVisitor() {
        @Override
        public void endVisit(JsNameRef x, JsContext ctx) {
          String ident = x.getIdent();
          if (ident.charAt(0) == '@') {
            jsniRefs.add(ident.substring(1));
View Full Code Here

      if (x.isNative()) {
        // Manually rescue native parameter references
        final JsniMethodBody body = (JsniMethodBody) x.getBody();
        final JsFunction func = body.getFunc();

        new JsVisitor() {
          @Override
          public void endVisit(JsNameRef nameRef, JsContext ctx) {
            JsName ident = nameRef.getName();

            if (ident != null) {
View Full Code Here

    syntheticFnHeader += ')';
    StringReader sr = new StringReader(syntheticFnHeader + '\n' + jsniCode);
    try {
      // start at -1 to avoid counting our synthetic header
      JsStatements result = jsParser.parse(jsProgram.getScope(), sr, -1);
      new JsVisitor() {
        public void endVisit(JsNameRef x, JsContext ctx) {
          String ident = x.getIdent();
          if (ident.charAt(0) == '@') {
            String className = ident.substring(1, ident.indexOf(':'));
            jsniClasses.add(className);
View Full Code Here

TOP

Related Classes of com.google.gwt.dev.js.ast.JsVisitor

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.