/** * Parse this node. * Set passed arguments and any optional arguments not passed to their * defaults, then render the children of the mixin definition. * @param SassContext the context in which this node is parsed * @return array the parsed node */ public function parse($pcontext) { $mixin = $pcontext->getMixin($this->name); $context = new SassContext($pcontext); $context->content = $this->children; $argc = count($this->args); $count = 0; list($arguments) = SassScriptFunction::fill_parameters($mixin->args, $this->args, $context, $this); $context->setVariables($arguments); $children = array(); foreach ($mixin->children as $child) { $child->parent = $this; $children = array_merge($children, $child->parse($context)); } // $context->merge(); return $children; }
/** * Evalutes the function in the given context, with the provided arguments * @param SassContext - the parent context * @param array - the list of provided variables * @throws SassReturn - if the @return is fired then this is thrown to break early * @return SassBoolean(false) - if no @return was fired, return false */ public function execute($pcontext, $provided) { list($arguments, $context) = SassScriptFunction::fill_parameters($this->args, $provided, $pcontext, $this); $context->setVariables($arguments); $parser = $this->parent->parser; $children = array(); try { foreach ($this->children as $child) { $child->parent = $this; $children = array_merge($children, $child->parse($context)); } } catch (SassReturn $e) { return $e->value; } return new SassBoolean('false'); }