Commits

Victor Kotseruba committed 989fba5

mixin delayed resolution

Comments (0)

Files changed (2)

             if mixin_use_match:
                 data = mixin_use_match.groupdict()
                 name, args = data['name'], data['args']
-                mixin = mixins.get(name, self.mixins.get(name, None))
-                assert mixin, 'mixin "%s" not found' % name
+                #mixin = mixins.get(name, self.mixins.get(name, None))
+                #assert mixin, 'mixin "%s" not found' % name
                 if args:
                     args = map(Expression, map(str.strip, args.split(',')))
-                    call_args = dict(zip(mixin.args, args))
-                else:
-                    call_args = {}
-                parents[level].mixins.append(MixinCall(mixin, call_args))
+                    #call_args = dict(zip(mixin.args, args))
+                #else:
+                #    call_args = {}
+                parents[level].mixins.append(MixinCall(name, args))
             
             else:
                 
         return node.__class__(node.selector, props, nodes)
     
     def expand_mixin(self, call, context, mixins):
+        mixin = mixins[call.mixin]
         call_args = {}
-        for key, value in call.args.items():
+        for key, value in zip(mixin.args, call.args):
             call_args[key] = value.evaluate(context)
         context = context.extend(call_args)
-        props = list(self.evaluate_properties(call.mixin.properties, context))
-        nodes = list(self.expand(call.mixin.nodes, context, mixins))
-        for _call in call.mixin.mixins:
+        props = list(self.evaluate_properties(mixin.properties, context))
+        nodes = list(self.expand(mixin.nodes, context, mixins))
+        for _call in mixin.mixins:
             _nodes, _properties = self.expand_mixin(_call, context, mixins)
             props += _properties
             nodes += _nodes
-
-=box-font(!size)
-  :font-size = !size / 5
 
 =square(!width)
   :width = !width
   :margin = !width / 20 - 1px 0 0 0
   +box-font(!width)
 
+=box-font(!size)
+  :font-size = !size / 5
+
+
 .box
   +square(100px)