Remove redundant parameters.

This commit is contained in:
Natalie Weizenbaum 2016-08-27 00:40:07 -07:00 committed by Natalie Weizenbaum
parent 4e0a511570
commit cba5881eb4
2 changed files with 9 additions and 8 deletions

View File

@ -53,21 +53,22 @@ class Environment {
Callable getFunction(String name) =>
_functions[_functionIndices[name] ?? 0][name];
void setFunction(String name, Callable callable) {
void setFunction(Callable callable) {
var index = _functions.length == 1
? 0
: _functionIndices.putIfAbsent(name, () => _functions.length - 1);
_functions[index][name] = callable;
: _functionIndices.putIfAbsent(
callable.name, () => _functions.length - 1);
_functions[index][callable.name] = callable;
}
Callable getMixin(String name) =>
_mixins[_mixinIndices[name] ?? 0][name];
void setMixin(String name, Callable callable) {
void setMixin(Callable callable) {
var index = _mixins.length == 1
? 0
: _mixinIndices.putIfAbsent(name, () => _mixins.length - 1);
_mixins[index][name] = callable;
: _mixinIndices.putIfAbsent(callable.name, () => _mixins.length - 1);
_mixins[index][callable.name] = callable;
}
/*=T*/ scope/*<T>*/(/*=T*/ callback()) {

View File

@ -124,7 +124,7 @@ class PerformVisitor extends StatementVisitor
}
void visitFunctionDeclaration(FunctionDeclaration node) {
_environment.setFunction(node.name, new Callable(
_environment.setFunction(new Callable(
node.name, node.arguments, node.children, _environment.closure(),
span: node.span));
}
@ -144,7 +144,7 @@ class PerformVisitor extends StatementVisitor
}
void visitMixinDeclaration(MixinDeclaration node) {
_environment.setMixin(node.name, new Callable(
_environment.setMixin(new Callable(
node.name, node.arguments, node.children, _environment.closure(),
span: node.span));
}