Calls within inner scope
This commit is contained in:
@@ -94,17 +94,17 @@ class LessParser(object):
|
||||
for u in lst: self.post_parse(u)
|
||||
elif type(lst) is Block:
|
||||
try:
|
||||
lst.parsed = list(utility.flatten([t.parse(self.scope, True)
|
||||
lst.parsed = list(utility.flatten([t.parse(self.scope, self.verbose)
|
||||
if type(t) is Deferred else t
|
||||
for t in lst.parsed]))
|
||||
except SyntaxError as e:
|
||||
self.handle_error(e, 0)
|
||||
self.handle_error(e, 0, 'W')
|
||||
self.post_parse(lst.parsed)
|
||||
elif type(lst) is Deferred:
|
||||
try:
|
||||
lst = lst.parse(self.scope, True)
|
||||
except SyntaxError as e:
|
||||
self.handle_error(e, lst.lineno)
|
||||
self.handle_error(e, lst.lineno, 'W')
|
||||
|
||||
def scopemap(self):
|
||||
""" Output scopemap.
|
||||
@@ -311,8 +311,12 @@ class LessParser(object):
|
||||
def p_call_mixin(self, p):
|
||||
""" call_mixin : identifier t_popen mixin_args_list t_pclose ';'
|
||||
"""
|
||||
p[1].parse(None)
|
||||
# Try with scope first
|
||||
p[1].parse(self.scope)
|
||||
mixin = self.scope.mixins(p[1].raw())
|
||||
if not mixin:
|
||||
p[1].parse(None)
|
||||
mixin = self.scope.mixins(p[1].raw())
|
||||
res = False
|
||||
if mixin:
|
||||
for m in mixin:
|
||||
|
||||
@@ -69,7 +69,7 @@ class Block(Node):
|
||||
if self.parsed:
|
||||
fills.update({
|
||||
'identifier': name,
|
||||
'proplist': ''.join([p.fmt(fills) for p in self.parsed]),
|
||||
'proplist': ''.join([p.fmt(fills) for p in self.parsed if p]),
|
||||
})
|
||||
out.append(f % fills)
|
||||
if self.inner:
|
||||
|
||||
@@ -41,7 +41,7 @@ class Deferred(Node):
|
||||
res = self
|
||||
if error:
|
||||
raise SyntaxError('NameError `%s`' % self.mixin.raw(True))
|
||||
return False
|
||||
return res
|
||||
|
||||
def fmt(self, fills):
|
||||
"""
|
||||
|
||||
@@ -68,11 +68,12 @@ class Identifier(Node):
|
||||
parent = scope.scopename
|
||||
if parent:
|
||||
parent = parent[-1]
|
||||
return [self._pscn(part, n)
|
||||
if part[0] not in self._subp
|
||||
else n
|
||||
for part in parent.parsed
|
||||
for n in names]
|
||||
if parent.parsed:
|
||||
return [self._pscn(part, n)
|
||||
if part[0] not in self._subp
|
||||
else n
|
||||
for part in parent.parsed
|
||||
for n in names]
|
||||
return names
|
||||
|
||||
def _pscn(self, parent, name):
|
||||
|
||||
@@ -71,3 +71,6 @@
|
||||
.deferred {
|
||||
background-color: #705b4e;
|
||||
}
|
||||
span.callswithinscope {
|
||||
padding: 6px;
|
||||
}
|
||||
1
lesscpy/test/css/mixin-args-nested.min.css
vendored
1
lesscpy/test/css/mixin-args-nested.min.css
vendored
@@ -21,3 +21,4 @@
|
||||
.ty{padding:7px;margin:3px;}
|
||||
.font{font-family:Georgia,"Times New Roman",Times,serif;}
|
||||
.deferred{background-color:#705b4e;}
|
||||
span.callswithinscope{padding:6px;}
|
||||
|
||||
@@ -112,4 +112,18 @@
|
||||
}
|
||||
.deferred {
|
||||
.gradientBar(#555, #964);
|
||||
}
|
||||
/*
|
||||
Mixins called within own scope
|
||||
*/
|
||||
.callswithinscope {
|
||||
.inner() {
|
||||
.call(@index: 3px) {
|
||||
padding: @index;
|
||||
}
|
||||
.call(6px);
|
||||
}
|
||||
}
|
||||
span.callswithinscope {
|
||||
.callswithinscope > .inner();
|
||||
}
|
||||
Reference in New Issue
Block a user