From ed27be468c3104620d5a880e7aee8b4deb4ca5f4 Mon Sep 17 00:00:00 2001 From: "Eevee (Alex Munroe)" Date: Fri, 29 Aug 2014 21:09:53 -0700 Subject: Use shiny new interpolation support on property names. --- scss/blockast.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/scss/blockast.py b/scss/blockast.py index f7ae857..812f98c 100644 --- a/scss/blockast.py +++ b/scss/blockast.py @@ -44,7 +44,7 @@ class Assignment(Declaration): @classmethod def parse(cls, name, value): # TODO pull off !default, !global - # TODO interp-parse the name + # TODO interp-parse the name? is that a thing? # TODO this is a bit naughty, but uses no state except the ast_cache -- # which should maybe be in the Compiler anyway...? @@ -58,25 +58,24 @@ class Assignment(Declaration): class CSSDeclaration(Declaration): - def __init__(self, prop, value_expression): - self.prop = prop + def __init__(self, prop_expression, value_expression): + self.prop_expression = prop_expression self.value_expression = value_expression @classmethod def parse(cls, prop, value): - # TODO prop needs parsing too, but interp-only! - # TODO this is a bit naughty, but uses no state except the ast_cache -- # which should maybe be in the Compiler anyway...? + prop_expression = Calculator().parse_interpolations(prop) value_expression = Calculator().parse_expression(value) - return cls(prop, value_expression) + return cls(prop_expression, value_expression) def evaluate(self, compilation): - prop = self.prop + prop = self.prop_expression.evaluate(compilation.current_calculator) value = self.value_expression.evaluate(compilation.current_calculator) # TODO this is where source maps would need to get their info - compilation.add_declaration(prop, value) + compilation.add_declaration(prop.value, value) class _AtRuleMixin(object): -- cgit v1.2.1