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

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


        data.addExecutableLine(lineNr);
        block.addChildBefore(newInstrumentationNode(lineNr), elseIfStatement);
    }

    private AstNode newInstrumentationNode(final int lineNr) {
        final ExpressionStatement instrumentationNode = new ExpressionStatement();
        final UnaryExpression inc = new UnaryExpression();

        inc.setIsPostfix(true);
        inc.setOperator(Token.INC);

        final ElementGet outer = new ElementGet();
        final ElementGet inner = new ElementGet();

        outer.setTarget(inner);

        final Name covDataVar = new Name();
        covDataVar.setIdentifier(ScriptInstrumenter.COVERAGE_VARIABLE_NAME);

        inner.setTarget(covDataVar);

        final StringLiteral fileName = new StringLiteral();
        fileName.setValue(data.getSourceUriAsString());
        fileName.setQuoteCharacter('\'');

        inner.setElement(fileName);

        final NumberLiteral index = new NumberLiteral();
        index.setNumber(lineNr);
        index.setValue(Integer.toString(lineNr));

        outer.setElement(index);

        inc.setOperand(outer);

        instrumentationNode.setExpression(inc);
        instrumentationNode.setHasResult();

        return instrumentationNode;
    }
View Full Code Here

TOP

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

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.