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

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


            if (parent.hasChildren()) {
                parent.addChildBefore(newInstrumentationNode(getActualLineNumber(node)), node);
            } else {
                // if, else, while, do, for without {} around their respective 'blocks' for some reason
                // don't have children. Meh. Creating blocks to ease instrumentation.
                final Block block = newInstrumentedBlock(node);

                if (parentType == IF) {
                    final IfStatement ifStatement = (IfStatement) parent;

                    if (ifStatement.getThenPart() == node) {
View Full Code Here


     * when loops contain only ';' as body or nothing at all (happens when they are minified),
     * certain things might go horribly wrong (like the jquery 1.4.2 case)
     */
    private void fixLoops(final Loop loop) {
        if (loop.getBody().getType() == EMPTY) {
            loop.setBody(new Block());
        }
    }
View Full Code Here

     * The same as loops (the if (true); case)
     * @see #fixLoops(net.sourceforge.htmlunit.corejs.javascript.ast.Loop)
     */
    private void fixIf(final IfStatement ifStatement) {
        if (ifStatement.getThenPart().getType() == EMPTY) {
            ifStatement.setThenPart(new Block());
        }
    }
View Full Code Here

    private int getActualLineNumber(final AstNode node) {
        return node.getLineno() - lineNumberOffset;
    }

    private Block newInstrumentedBlock(final AstNode node) {
        final Block block = new Block();
        block.addChild(node);
        block.addChildBefore(newInstrumentationNode(getActualLineNumber(node)), node);
        return block;
    }
View Full Code Here

     * }
     * }
     * </pre>
     */
    private void flattenElseIf(final IfStatement elseIfStatement, final IfStatement ifStatement) {
        final Block block = new Block();
        block.addChild(elseIfStatement);

        ifStatement.setElsePart(block);

        final int lineNr = getActualLineNumber(elseIfStatement);

        data.addExecutableLine(lineNr);
        block.addChildBefore(newInstrumentationNode(lineNr), elseIfStatement);
    }
View Full Code Here

TOP

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

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.