Package org.apache.sling.scripting.sightly.impl.compiler.optimization

## Class SyntheticMapRemoval

- java.lang.Object
- - org.apache.sling.scripting.sightly.impl.compiler.visitor.UniformVisitor
  - - org.apache.sling.scripting.sightly.impl.compiler.visitor.TrackingVisitor<MapLiteral>
    - - org.apache.sling.scripting.sightly.impl.compiler.optimization.SyntheticMapRemoval

All Implemented Interfaces:
  `CommandVisitor`, `EmitterVisitor`

    public final class SyntheticMapRemoval
    extends TrackingVisitor<MapLiteral>
    implements EmitterVisitor

This optimization handles variables initialized to map literals. It initially assigns the values in the map to variables and wherever the map literal is accessed, the property access is replaced with the value variable, thus removing the need for a map lookup.

### Field Summary

Fields
`static StreamTransformer` `TRANSFORMER`

### Fields inherited from class org.apache.sling.scripting.sightly.impl.compiler.visitor.TrackingVisitor

`tracker`

### Method Summary

All Methods Instance Methods Concrete Methods
`protected MapLiteral` `assignDefault​(Command command)`
`PushStream` `getOutputStream()` Get the output stream
`void` `onCommand​(Command command)`
`void` `visit​(VariableBinding.End variableBindingEnd)` Process a `VariableBinding.End` command.
`void` `visit​(VariableBinding.Start variableBindingStart)` Process a `VariableBinding.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`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Methods inherited from interface org.apache.sling.scripting.sightly.compiler.commands.CommandVisitor

`visit, visit, visit, visit, visit, visit, visit, visit, visit, visit`

### Field Detail

#### TRANSFORMER

    public static final StreamTransformer TRANSFORMER

### Method Detail

#### visit

    public void visit​(VariableBinding.Start variableBindingStart)

Description copied from interface: `CommandVisitor`
Process a `VariableBinding.Start` command.

Specified by:
  `visit` in interface `CommandVisitor`
Overrides:
  `visit` in class `TrackingVisitor<MapLiteral>`
Parameters:
  `variableBindingStart` - the command

#### visit

    public void visit​(VariableBinding.End variableBindingEnd)

Description copied from interface: `CommandVisitor`
Process a `VariableBinding.End` command.

Specified by:
  `visit` in interface `CommandVisitor`
Overrides:
  `visit` in class `TrackingVisitor<MapLiteral>`
Parameters:
  `variableBindingEnd` - the command

#### assignDefault

    protected MapLiteral assignDefault​(Command command)

Specified by:
  `assignDefault` in class `TrackingVisitor<MapLiteral>`

#### onCommand

    public void onCommand​(Command command)

Specified by:
  `onCommand` in class `UniformVisitor`

#### getOutputStream

    public PushStream getOutputStream()

Description copied from interface: `EmitterVisitor`
Get the output stream

Specified by:
  `getOutputStream` in interface `EmitterVisitor`
Returns:
  the output stream of this visitor