allow fallbacks within mixin scopes

This commit is contained in:
jtm 2012-04-23 18:59:39 +00:00
parent a6c53c67e7
commit c02ef34604
5 changed files with 38 additions and 4 deletions

@ -37,15 +37,24 @@ class Deferred(Node):
ident, args = self.tokens
ident.parse(scope)
mixins = scope.mixins(ident.raw())
if not mixins:
ident.parse(None)
mixins = scope.mixins(ident.raw())
if not mixins:
if scope.deferred:
store = [t for t in scope.deferred.tokens]
while scope.deferred.tokens:
scope.current = scope.deferred
ident.parse(scope)
mixins = scope.mixins(ident.raw())
scope.current = None
if mixins:
scope.deferred.tokens = store
break
scope.deferred.tokens.pop()
scope.deferred.parse(None)
if mixins:
for mixin in mixins:
res = mixin.call(scope, args)

@ -10,14 +10,11 @@ import bootstrap
def find():
svn = re.compile('\.svn')
test = re.compile('test.+\.py$')
# skip = re.compile('testissues.*')
alltests = unittest.TestSuite()
for path, _, files in os.walk(bootstrap.here):
if svn.search(path):
continue
for f in files:
# if skip.search(f):
# continue
if test.search(f):
module = __import__(f.split('.')[0])
alltests.addTest(unittest.findTestCases(module))

@ -0,0 +1,6 @@
span {
padding: 1px;
padding: 2px;
padding: 2px;
padding: 1px;
}

@ -0,0 +1 @@
span{padding:1px;padding:2px;padding:2px;padding:1px;}

@ -0,0 +1,21 @@
/*
*/
.a() {
padding: 1px;
.b() {
padding: 2px;
}
.c() {
.b();
}
.d() {
.a();
}
}
span {
.a(); // 1px
.a .b(); // 2px
.a .c(); // 2px
.a .d(); // 1px
}