boolean resolveMixinReference ( String name , ArgumentsNode arguments ) { if ( ! isParserTranslationEnabled ( ) ) { return push ( new PlaceholderNode ( new SimpleNode ( name ) ) ) ; } // Walk down the stack, looking for a scope node that knows about a given rule set for ( Node node : getContext ( ) . getValueStack ( ) ) { if ( ! ( node instanceof ScopeNode ) ) { continue ; } ScopeNode scope = ( ScopeNode ) node ; RuleSetNode ruleSet = scope . getRuleSet ( name ) ; if ( ruleSet == null ) { continue ; } // Get the scope of the rule set we located and call it as a mixin ScopeNode ruleSetScope = NodeTreeUtils . getFirstChild ( ruleSet , ScopeNode . class ) . callMixin ( name , arguments ) ; return push ( ruleSetScope ) ; } // Record error location throw new UndefinedMixinException ( name ) ; }
Locates the referenced mixin in one of the scope nodes on the stack . If found the mixin s scope is cloned and placed onto the stack in place of the mixin reference . Additionally any arguments are applied to the mixin s scope .