Class UnusedVariableRemoval
java.lang.Object
org.apache.sling.scripting.sightly.impl.compiler.visitor.UniformVisitor
org.apache.sling.scripting.sightly.impl.compiler.visitor.TrackingVisitor<org.apache.sling.scripting.sightly.impl.compiler.optimization.UnusedVariableRemoval.VariableActivity>
org.apache.sling.scripting.sightly.impl.compiler.optimization.UnusedVariableRemoval
- All Implemented Interfaces:
CommandVisitor
,EmitterVisitor
public final class UnusedVariableRemoval
extends TrackingVisitor<org.apache.sling.scripting.sightly.impl.compiler.optimization.UnusedVariableRemoval.VariableActivity>
implements EmitterVisitor
This optimization removes variables which are bound but never used in the command stream.
-
Field Summary
Fields inherited from class org.apache.sling.scripting.sightly.impl.compiler.visitor.TrackingVisitor
tracker
-
Method Summary
Modifier and TypeMethodDescriptionprotected org.apache.sling.scripting.sightly.impl.compiler.optimization.UnusedVariableRemoval.VariableActivity
assignDefault
(Command command) Get the output streamprotected void
void
visit
(VariableBinding.End variableBindingEnd) Process aVariableBinding.End
command.void
visit
(VariableBinding.Start variableBindingStart) Process aVariableBinding.Start
command.Methods inherited from class org.apache.sling.scripting.sightly.impl.compiler.visitor.TrackingVisitor
visit, visit
Methods inherited from class org.apache.sling.scripting.sightly.impl.compiler.visitor.UniformVisitor
visit, visit, visit, visit, visit, visit, visit, visit
-
Field Details
-
TRANSFORMER
-
-
Method Details
-
getOutputStream
Description copied from interface:EmitterVisitor
Get the output stream- Specified by:
getOutputStream
in interfaceEmitterVisitor
- Returns:
- the output stream of this visitor
-
visit
Description copied from interface:CommandVisitor
Process aVariableBinding.Start
command.- Specified by:
visit
in interfaceCommandVisitor
- Overrides:
visit
in classTrackingVisitor<org.apache.sling.scripting.sightly.impl.compiler.optimization.UnusedVariableRemoval.VariableActivity>
- Parameters:
variableBindingStart
- the command
-
visit
Description copied from interface:CommandVisitor
Process aVariableBinding.End
command.- Specified by:
visit
in interfaceCommandVisitor
- Overrides:
visit
in classTrackingVisitor<org.apache.sling.scripting.sightly.impl.compiler.optimization.UnusedVariableRemoval.VariableActivity>
- Parameters:
variableBindingEnd
- the command
-
assignDefault
protected org.apache.sling.scripting.sightly.impl.compiler.optimization.UnusedVariableRemoval.VariableActivity assignDefault(Command command) - Specified by:
assignDefault
in classTrackingVisitor<org.apache.sling.scripting.sightly.impl.compiler.optimization.UnusedVariableRemoval.VariableActivity>
-
onCommand
- Specified by:
onCommand
in classUniformVisitor
-