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

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


        }

        if (type == CASE) {
            handleSwitchCase((SwitchCase) node);
        } else if (type == IF && parentType == IF) {
            final IfStatement elseIfStatement = (IfStatement) node;
            final IfStatement ifStatement = (IfStatement) parent;

            if (ifStatement.getElsePart() == elseIfStatement) {
                flattenElseIf(elseIfStatement, ifStatement);
                data.addExecutableLine(getActualLineNumber(node));
            }
        } else if (parentType != CASE) {
            // issue #54
            if (parent.getClass() == LabeledStatement.class) {
                return;
            }

            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) {
                        ifStatement.setThenPart(block);
                    } else if (ifStatement.getElsePart() == node) {
                        ifStatement.setElsePart(block);
                    }
                } else if (parentType == WHILE || parentType == FOR || parentType == DO) {
                    ((Loop) parent).setBody(block);
                } else {
                    logger.warn("Cannot handle node with parent that has no children, parent class: {}, parent source:\n{}",
View Full Code Here

TOP

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

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.