Package net.sourceforge.htmlunit.corejs.javascript.ast

Examples of net.sourceforge.htmlunit.corejs.javascript.ast.AstRoot


                                        String sourceLocation,
                                        int lineno,
                                        String mainClassName)
    {
        Parser p = new Parser(compilerEnv);
        AstRoot ast = p.parse(source, sourceLocation, lineno);
        IRFactory irf = new IRFactory(compilerEnv);
        ScriptNode tree = irf.transformTree(ast);

        // release reference to original parse tree & parser
        irf = null;
View Full Code Here


        Parser p = new Parser(compilerEnv, compilationErrorReporter);
        if (returnFunction) {
            p.calledByCompileFunction = true;
        }
        AstRoot ast;
        if (sourceString != null) {
            ast = p.parse(sourceString, sourceName, lineno);
        } else {
            ast = p.parse(sourceReader, sourceName, lineno);
        }
        if (returnFunction) {
            // parser no longer adds function to script node
            if (!(ast.getFirstChild() != null
                  && ast.getFirstChild().getType() == Token.FUNCTION))
            {
                // XXX: the check just looks for the first child
                // and allows for more nodes after it for compatibility
                // with sources like function() {};;;
                throw new IllegalArgumentException(
View Full Code Here

    private String instrument(final int lineNumber, final ScriptData data) {
        final Parser parser = new Parser();

        final String sourceUriAsString = data.getSourceUriAsString();
        final AstRoot root = parser.parse(data.getSourceCode(), sourceUriAsString, lineNumber);
        root.visit(new InstrumentingNodeVisitor(data, lineNumber - 1));

        final String treeSource = root.toSource();
        final StringBuilder buf = new StringBuilder(
                INITIALIZING_CODE.length() +
                data.getNumberOfStatements() * ARRAY_INITIALIZER.length() +
                treeSource.length());

View Full Code Here

TOP

Related Classes of net.sourceforge.htmlunit.corejs.javascript.ast.AstRoot

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.