All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.sourceforge.pmd.lang.ecmascript.ast.AbstractInfixEcmascriptNode Maven / Gradle / Ivy

/**
 * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
 */

package net.sourceforge.pmd.lang.ecmascript.ast;

import org.mozilla.javascript.Token;
import org.mozilla.javascript.ast.AstRoot;
import org.mozilla.javascript.ast.InfixExpression;

public class AbstractInfixEcmascriptNode extends AbstractEcmascriptNode {

    public AbstractInfixEcmascriptNode(T infixExpression) {
        this(infixExpression, true);
    }

    public AbstractInfixEcmascriptNode(T infixExpression, boolean setImage) {
        super(infixExpression);
        if (setImage) {
            if (infixExpression.getOperator() == Token.ASSIGN_BITXOR) {
                super.setImage("^=");
            } else {
                super.setImage(AstRoot.operatorToString(infixExpression.getOperator()));
            }
        }
    }

    public EcmascriptNode getLeft() {
        return (EcmascriptNode) jjtGetChild(0);
    }

    public EcmascriptNode getRight() {
        return (EcmascriptNode) jjtGetChild(1);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy