Class UnrollLoops
- All Implemented Interfaces:
AtRuleHandler,CssCompilerPass,CssTreeVisitor
For every loop, we iterate over the different values of the loop variables, create a copy of
the loop block and invoke LoopVariableReplacementPass to replace all references of the
loop variable with the current iteration value. So for a loop with N iterations, we'll replace
the loop block with N blocks which only differ in the replacement to the loop variable value.
NOTE: There is special treatment for @defs in this pass. Since
definition references might appear before declaration, it's easier for
LoopVariableReplacementPass to know all definitions declarations beforehand (the latter
pass needs to do name replacement for definitions declared inside the loop). That's why this pass
scrapes them prior to calling LoopVariableReplacementPass.
-
Constructor Summary
ConstructorsConstructorDescriptionUnrollLoops(MutatingVisitController visitController, ErrorManager errorManager) -
Method Summary
Modifier and TypeMethodDescriptionbooleanCalled before visiting aCssForLoopRuleNode's sub treesvoidrunPass()Methods inherited from class com.google.common.css.compiler.ast.DefaultTreeVisitor
enterArgumentNode, enterAttributeSelector, enterBlock, enterCharSet, enterClassSelector, enterCombinator, enterComponent, enterCompositeValueNode, enterCompositeValueNodeOperator, enterConditionalBlock, enterConditionalRule, enterDeclaration, enterDeclarationBlock, enterDefinition, enterFontFace, enterFunctionNode, enterIdSelector, enterImportBlock, enterImportRule, enterKey, enterKeyBlock, enterKeyframeRuleset, enterKeyframesRule, enterMediaRule, enterMediaTypeListDelimiter, enterMixin, enterMixinDefinition, enterPageRule, enterPageSelector, enterPropertyValue, enterProvideNode, enterPseudoClass, enterPseudoElement, enterRequireNode, enterRuleset, enterSelector, enterSelectorBlock, enterTree, enterUnknownAtRule, enterValueNode, leaveArgumentNode, leaveAttributeSelector, leaveBlock, leaveCharSet, leaveClassSelector, leaveCombinator, leaveComponent, leaveCompositeValueNode, leaveCompositeValueNodeOperator, leaveConditionalBlock, leaveConditionalRule, leaveDeclaration, leaveDeclarationBlock, leaveDefinition, leaveFontFace, leaveForLoop, leaveFunctionNode, leaveIdSelector, leaveImportBlock, leaveImportRule, leaveKey, leaveKeyBlock, leaveKeyframeRuleset, leaveKeyframesRule, leaveMediaRule, leaveMediaTypeListDelimiter, leaveMixin, leaveMixinDefinition, leavePageRule, leavePageSelector, leavePropertyValue, leaveProvideNode, leavePseudoClass, leavePseudoElement, leaveRequireNode, leaveRuleset, leaveSelector, leaveSelectorBlock, leaveTree, leaveUnknownAtRule, leaveValueNode
-
Constructor Details
-
UnrollLoops
-
-
Method Details
-
enterForLoop
Description copied from interface:CssTreeVisitorCalled before visiting aCssForLoopRuleNode's sub trees- Specified by:
enterForLoopin interfaceCssTreeVisitor- Overrides:
enterForLoopin classDefaultTreeVisitor
-
runPass
public void runPass()- Specified by:
runPassin interfaceCssCompilerPass
-