Skip to content

Commit

Permalink
Set mixin/function arguments locally. (#63)
Browse files Browse the repository at this point in the history
  • Loading branch information
nex3 committed Dec 10, 2016
1 parent 5d96a2a commit 779edfa
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

* Fix a bug where `**/` would fail to close a loud comment.

* Fix a bug where mixin and function calls could set variables incorrectly.

## 1.0.0-alpha.4

* Add support for bracketed lists.
Expand Down
7 changes: 4 additions & 3 deletions lib/src/visitor/perform.dart
Original file line number Diff line number Diff line change
Expand Up @@ -958,12 +958,13 @@ class _PerformVisitor
var declaredArguments = callable.declaration.arguments.arguments;
var minLength = math.min(positional.length, declaredArguments.length);
for (var i = 0; i < minLength; i++) {
_environment.setVariable(declaredArguments[i].name, positional[i]);
_environment.setLocalVariable(
declaredArguments[i].name, positional[i]);
}

for (var i = positional.length; i < declaredArguments.length; i++) {
var argument = declaredArguments[i];
_environment.setVariable(
_environment.setLocalVariable(
argument.name,
named.remove(argument.name) ??
argument.defaultValue?.accept(this));
Expand All @@ -980,7 +981,7 @@ class _PerformVisitor
separator == ListSeparator.undecided
? ListSeparator.comma
: separator);
_environment.setVariable(
_environment.setLocalVariable(
callable.declaration.arguments.restArgument, argumentList);
}

Expand Down

0 comments on commit 779edfa

Please sign in to comment.