Package org.mozilla.javascript.ast

Examples of org.mozilla.javascript.ast.AstRoot.visit()


        }
       
        // first time parsing - compute scopes and variable declarations
        AstRoot root = createParser().parse(_document.get(_region.getOffset(), _region.getLength()), null, 0);

        root.visit(new NodeVisitor() {

            public boolean visit(AstNode node) {
               
                Scope scope = node.getEnclosingScope();
                List<Integer> scopePath = new ArrayList<Integer>();
View Full Code Here


                    fVar.setType(resolvePackageOrConstructorCall(fVar.getValue(), false));
                } else {                                       
                    for (String value : varValues) {
                        AstRoot valueAst = createParser().parse(value, "", 0);
                        TypeVisitor visitor = new TypeVisitor(currentEnvironmentObject, visibleVars, _versionCompliance, _envFlags);
                        valueAst.visit(visitor);
                       
                        currentEnvironmentObject = visitor.getType();
                       
                        if (currentEnvironmentObject == null)  {
                            break;
View Full Code Here

                for (int i = 0; i < tokens.length; i++) {
                    String value = tokens[i];
                    if (!value.equals(".") && (i < tokens.length - 1)) {
                        AstRoot valueAst = createParser().parse(value, "", 0);
                        TypeVisitor visitor = new TypeVisitor(_env, retrieveVisibleVars(), _versionCompliance, _envFlags);
                        valueAst.visit(visitor);
                        _env = visitor.getType();
//                        if ((i == tokens.length - 3) || (i == tokens.length - 2)) {
//                            // last token - check if we have to wrap
//                            if (!visitor.skipJSWrapping()) {
//                                _env = ReflectionManager.jsWrap(_env);
View Full Code Here

                for (int i = tokenIndex; i < length; i++) {
                    if (!tokens[i].equals(".")) {
                        // further tokens to parse for method calls
                        AstRoot valueAst = createParser().parse(tokens[i], "", 0);
                        TypeVisitor visitor = new TypeVisitor(currentEnvironmentObject, new HashMap<String, TMLScriptVariableDeclaration>(), _versionCompliance, _envFlags);
                        valueAst.visit(visitor);
   
                        currentEnvironmentObject = visitor.getType();
   
                        if (currentEnvironmentObject == null) {
                            break;
View Full Code Here

                                String currentEnvironmentObject = ReflectionManager.GLOBAL_SCOPE_CLASSNAME;
                                String[] values = splitVariableValue(paramNode.toSource(), false);
                                for (String value : values) {
                                    AstRoot valueAst = createParser().parse(value, "", 0);
                                    TypeVisitor visitor = new TypeVisitor(currentEnvironmentObject, _visibleVars, _versionCompliance, _envFlags);
                                    valueAst.visit(visitor);
                                      
                                    currentEnvironmentObject = visitor.getType();
                                       
                                    if (currentEnvironmentObject == null)  {
                                        break;
View Full Code Here

    Parser parser = new Parser(env, errorReporter);
    Reader reader = new BufferedReader(new FileReader(source));
    try {
      AstRoot root = parser.parse(reader, source.getAbsolutePath(), 0);
      DependencyAccumulator visitor = new DependencyAccumulator(source);
      root.visit(visitor);

      // complain if no def was found in this source
      if (visitor.current == null) {
        log.warn("No class definition was found while processing: " + source);
      }
View Full Code Here

      modifier.setScopeName(scopename);

      modifier.start();

      /* recurse through AST */
      ast.visit(modifier);

      modifier.finish(ast);

      /* clean up */
      Context.exit();
 
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.