-
Notifications
You must be signed in to change notification settings - Fork 83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Variable scope in parameters #139
Comments
The same here. |
Isn't this expected behavior? From a programming perspective, many languages don't allow use of the arguments within the function definition. I assume (hope) that defining $paramTwo within the mixin body would work as expected. |
It seems Ruby version works with that syntax. |
I see. I think the fix to this is changing extractArgs [1] to add the arguments to the scope as they are processed, rather than afterwards. Unfortunately, they are processed in process_arguments [2] before this, so it needs a comprehensive refactoring. If you think you can manage it, a PR will be happily accepted. [1] https://github.com/richthegeek/phpsass/blob/master/script/SassScriptFunction.php#L201 |
It might be possible to fix it within SassMixinNode [1] but then the behavior should also change in any other parametered directives, so if it can be fixed within SassScriptFunction then that'd be better. [1] https://github.com/richthegeek/phpsass/blob/master/tree/SassMixinNode.php#L71 |
Thanks, I'll see what I can do. |
This one's easier to explain in code:
You'd expect this to return
However when passing $paramOne to function foo $paramOne looses it's value.
The text was updated successfully, but these errors were encountered: