diff options
author | German M. Bravo <german.mb@deipi.com> | 2013-10-08 13:18:43 -0700 |
---|---|---|
committer | German M. Bravo <german.mb@deipi.com> | 2013-10-08 13:18:43 -0700 |
commit | 3d0bf012b4867fa19ace15ba26359ba5cff07a28 (patch) | |
tree | 357f5c734ce6e0cd728086ca48fe17efaf1bd3be | |
parent | bbc97c38f36eedac64b55bb7aa130a1d8f2f9598 (diff) | |
download | pyscss-3d0bf012b4867fa19ace15ba26359ba5cff07a28.tar.gz |
Pass source_file and lineno of the definition point of the mixin to newly created rule
-rw-r--r-- | scss/__init__.py | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/scss/__init__.py b/scss/__init__.py index 458bc94..00a366f 100644 --- a/scss/__init__.py +++ b/scss/__init__.py @@ -706,10 +706,12 @@ class Scss(object): if default is not None: defaults[var_name] = default - mixin = [None, None, block.unparsed_contents, rule.namespace, argspec_node, rule.import_key] + mixin = [rule.source_file, block.lineno, block.unparsed_contents, rule.namespace, argspec_node, rule.import_key] if block.directive == '@function': def _call(mixin): def __call(namespace, *args, **kwargs): + source_file = mixin[0] + lineno = mixin[1] m_codestr = mixin[2] pristine_callee_namespace = mixin[3] callee_namespace = pristine_callee_namespace.derive() @@ -726,9 +728,9 @@ class Scss(object): callee_namespace, mixin, args, kwargs) _rule = SassRule( - source_file=block.parent_rule.source_file, + source_file=source_file, + lineno=lineno, unparsed_contents=m_codestr, - lineno=block.lineno, namespace=callee_namespace, # rule @@ -794,6 +796,8 @@ class Scss(object): args = [List(args, use_comma=True)] # TODO what happens to kwargs? + source_file = mixin[0] + lineno = mixin[1] m_codestr = mixin[2] pristine_callee_namespace = mixin[3] callee_argspec = mixin[4] @@ -810,9 +814,9 @@ class Scss(object): callee_namespace, mixin, args, kwargs) _rule = SassRule( - source_file=block.parent_rule.source_file, + source_file=source_file, + lineno=lineno, unparsed_contents=m_codestr, - lineno=block.lineno, namespace=callee_namespace, # rule @@ -889,8 +893,8 @@ class Scss(object): _rule = SassRule( source_file=source_file, - import_key=import_key, lineno=block.lineno, + import_key=import_key, unparsed_contents=source_file.contents, # rule |