This commit is contained in:
robotis
2012-05-07 13:10:28 +00:00
parent 61c09ca2e0
commit 6360ff664a
2 changed files with 18 additions and 3 deletions

View File

@@ -14,7 +14,8 @@ class Deferred(Node):
def __init__(self, mixin, args, lineno=0):
"""This node represents mixin calls. The calls
to these mixins are deferred until the second
parse cycle.
parse cycle. lessc.js allows calls to mixins not
yet defined or known.
args:
mixin (Mixin): Mixin object
args (list): Call arguments
@@ -28,6 +29,12 @@ class Deferred(Node):
to global scope. The special scope.deferred
is used when local scope mixins are called
within parent mixins.
If nothing is found we fallback to block-mixin
as lessc.js allows calls to blocks and mixins to
be inter-changable.
clx: This method is a HACK that stems from
poor design elsewhere. I will fix it
when I have more time.
args:
scope (Scope): Current scope
returns:
@@ -65,6 +72,8 @@ class Deferred(Node):
for mixin in mixins:
res = mixin.call(scope, args)
if res:
# Add variables to scope to support
# closures
[scope.add_variable(v) for v in mixin.vars]
scope.deferred = ident
break
@@ -79,7 +88,7 @@ class Deferred(Node):
return res
def copy(self):
""" Returns self (used when Block objects are copyd)
""" Returns self (used when Block objects are copy'd)
returns:
self
"""

View File

@@ -69,7 +69,13 @@ class Mixin(Node):
Variable(['@arguments', None, arguments]).parse(scope)
def _parse_arg(self, var, arg, scope):
"""
""" Parse a single argument to mixin.
args:
var (Variable object): variable
arg (mixed): argument
scope (Scope object): current scope
returns:
Variable object or None
"""
if type(var) is Variable:
# kwarg