Search in sources :

Example 1 with UnaryOpGen

use of org.apache.sling.scripting.sightly.java.compiler.impl.operator.UnaryOpGen in project sling by apache.

the class TypeInference method evaluate.

@Override
public Type evaluate(UnaryOperation unaryOperation) {
    infer(unaryOperation.getTarget());
    UnaryOpGen opGen = Operators.generatorFor(unaryOperation.getOperator());
    return opGen.returnType(infer(unaryOperation.getTarget()));
}
Also used : UnaryOpGen(org.apache.sling.scripting.sightly.java.compiler.impl.operator.UnaryOpGen)

Example 2 with UnaryOpGen

use of org.apache.sling.scripting.sightly.java.compiler.impl.operator.UnaryOpGen in project sling by apache.

the class ExpressionTranslator method visit.

@Override
public void visit(UnaryOperation unaryOperation) {
    UnaryOperator operator = unaryOperation.getOperator();
    ExpressionNode operand = unaryOperation.getTarget();
    UnaryOpGen unaryOpGen = Operators.generatorFor(operator);
    source.startExpression();
    unaryOpGen.generate(source, this, typeInfo.getTyped(operand));
    source.endExpression();
}
Also used : ExpressionNode(org.apache.sling.scripting.sightly.compiler.expression.ExpressionNode) UnaryOpGen(org.apache.sling.scripting.sightly.java.compiler.impl.operator.UnaryOpGen) UnaryOperator(org.apache.sling.scripting.sightly.compiler.expression.nodes.UnaryOperator)

Aggregations

UnaryOpGen (org.apache.sling.scripting.sightly.java.compiler.impl.operator.UnaryOpGen)2 ExpressionNode (org.apache.sling.scripting.sightly.compiler.expression.ExpressionNode)1 UnaryOperator (org.apache.sling.scripting.sightly.compiler.expression.nodes.UnaryOperator)1