package cz.chovanecm.pascal.truffle.nodes.expression;

import com.oracle.truffle.api.dsl.NodeChild;
import com.oracle.truffle.api.dsl.NodeChildren;
import com.oracle.truffle.api.dsl.Specialization;
import com.oracle.truffle.api.nodes.NodeInfo;
import cz.chovanecm.pascal.truffle.nodes.ExpressionNode;

/**
 * Created by martin on 1/18/17.
 */

/**
 * Expression in parentheses,e g. 2 + >>>(3-1)<<<
 */
@NodeInfo(shortName = "parentheses")
@NodeChildren({@NodeChild("expression")})
public abstract class ParenthesisExpressionNode extends ExpressionNode {

    @Specialization
    public long execute(long expression) {
        return expression;
    }

    @Specialization
    public double execute(double expression) {
        return expression;
    }

}

@@ -746,10 +746,113 @@
 %0A    %7D%0A%0A
+    @Specialization%0A    public boolean execute(boolean expression) %7B%0A        return expression;%0A    %7D%0A%0A
 %7D%0A

Fix ParenthesisExpressionNode to support boolean