Class ExpressionReducer
java.lang.Object
org.apache.sling.scripting.sightly.impl.compiler.optimization.reduce.ExpressionReducer
- All Implemented Interfaces:
NodeVisitor<EvalResult>
Try to evaluate constant parts in expressions
-
Method Summary
Modifier and TypeMethodDescriptionevaluate
(ArrayLiteral arrayLiteral) Evaluate aArrayLiteral
node.evaluate
(BinaryOperation binaryOperation) Evaluate aBinaryOperation
node.evaluate
(BooleanConstant booleanConstant) Evaluate aBooleanConstant
node.evaluate
(Identifier identifier) Evaluate anIdentifier
node.evaluate
(MapLiteral mapLiteral) Evaluate aMapLiteral
node.evaluate
(NullLiteral nullLiteral) Evaluate aNullLiteral
node.evaluate
(NumericConstant numericConstant) Evaluate aNumericConstant
node.evaluate
(PropertyAccess propertyAccess) Evaluate aPropertyAccess
node.evaluate
(RuntimeCall runtimeCall) Evaluate aRuntimeCall
node.evaluate
(StringConstant text) Evaluate aStringConstant
node.evaluate
(TernaryOperator ternaryOperator) Evaluate aTernaryOperator
node.evaluate
(UnaryOperation unaryOperation) Evaluate aUnaryOperation
node.static EvalResult
reduce
(ExpressionNode node, VariableTracker<EvalResult> tracker)
-
Method Details
-
reduce
-
evaluate
Description copied from interface:NodeVisitor
Evaluate aPropertyAccess
node.- Specified by:
evaluate
in interfaceNodeVisitor<EvalResult>
- Parameters:
propertyAccess
- the node to evaluate- Returns:
- the evaluation result
-
evaluate
Description copied from interface:NodeVisitor
Evaluate anIdentifier
node.- Specified by:
evaluate
in interfaceNodeVisitor<EvalResult>
- Parameters:
identifier
- the node to evaluate- Returns:
- the evaluation result
-
evaluate
Description copied from interface:NodeVisitor
Evaluate aStringConstant
node.- Specified by:
evaluate
in interfaceNodeVisitor<EvalResult>
- Parameters:
text
- the node to evaluate- Returns:
- the evaluation result
-
evaluate
Description copied from interface:NodeVisitor
Evaluate aBinaryOperation
node.- Specified by:
evaluate
in interfaceNodeVisitor<EvalResult>
- Parameters:
binaryOperation
- the node to evaluate- Returns:
- the evaluation result
-
evaluate
Description copied from interface:NodeVisitor
Evaluate aBooleanConstant
node.- Specified by:
evaluate
in interfaceNodeVisitor<EvalResult>
- Parameters:
booleanConstant
- the node to evaluate- Returns:
- the evaluation result
-
evaluate
Description copied from interface:NodeVisitor
Evaluate aNumericConstant
node.- Specified by:
evaluate
in interfaceNodeVisitor<EvalResult>
- Parameters:
numericConstant
- the node to evaluate- Returns:
- the evaluation result
-
evaluate
Description copied from interface:NodeVisitor
Evaluate aUnaryOperation
node.- Specified by:
evaluate
in interfaceNodeVisitor<EvalResult>
- Parameters:
unaryOperation
- the node to evaluate- Returns:
- the evaluation result
-
evaluate
Description copied from interface:NodeVisitor
Evaluate aTernaryOperator
node.- Specified by:
evaluate
in interfaceNodeVisitor<EvalResult>
- Parameters:
ternaryOperator
- the node to evaluate- Returns:
- the evaluation result
-
evaluate
Description copied from interface:NodeVisitor
Evaluate aRuntimeCall
node.- Specified by:
evaluate
in interfaceNodeVisitor<EvalResult>
- Parameters:
runtimeCall
- the node to evaluate- Returns:
- the evaluation result
-
evaluate
Description copied from interface:NodeVisitor
Evaluate aMapLiteral
node.- Specified by:
evaluate
in interfaceNodeVisitor<EvalResult>
- Parameters:
mapLiteral
- the node to evaluate- Returns:
- the evaluation result
-
evaluate
Description copied from interface:NodeVisitor
Evaluate aArrayLiteral
node.- Specified by:
evaluate
in interfaceNodeVisitor<EvalResult>
- Parameters:
arrayLiteral
- the node to evaluate- Returns:
- the evaluation result
-
evaluate
Description copied from interface:NodeVisitor
Evaluate aNullLiteral
node.- Specified by:
evaluate
in interfaceNodeVisitor<EvalResult>
- Parameters:
nullLiteral
- the node to evaluate- Returns:
- the evaluation result
-