Skip to content
This repository was archived by the owner on Dec 6, 2017. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions benchmark/injector_benchmark_common.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ class InjectorBenchmark extends BenchmarkBase {

setup() {
module = new Module()
..type(A)
..type(B)
..type(C)
..type(C, withAnnotation: AnnOne, implementedBy: COne )
..type(D)
..type(E)
..type(E, withAnnotation: AnnTwo, implementedBy: ETwo )
..type(F)
..type(G);
..bind(A)
..bind(B)
..bind(C)
..bind(C, withAnnotation: AnnOne, toImplementation: COne )
..bind(D)
..bind(E)
..bind(E, withAnnotation: AnnTwo, toImplementation: ETwo )
..bind(F)
..bind(G);
}

teardown() {
Expand Down
10 changes: 5 additions & 5 deletions benchmark/module_benchmark.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ class ModuleBenchmark extends BenchmarkBase {

void run() {
var m = new Module()
..type(A)
..type(B)
..type(C)
..type(D)
..type(E);
..bind(A)
..bind(B)
..bind(C)
..bind(D)
..bind(E);
}
}

Expand Down
4 changes: 2 additions & 2 deletions lib/src/module.dart
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ class Module {
void bindByKey(Key key, {dynamic toValue: _DEFAULT_VALUE,
FactoryFn toFactory: _DEFAULT_VALUE, Type toImplementation,
Visibility visibility}) {
_checkBindArgs(toValue, toFactory, toImplementation);
assert(_assertBindArgsValid(toValue, toFactory, toImplementation));
_dirty();
if (!identical(toValue, _DEFAULT_VALUE)) {
_providers[key.id] = new ValueProvider(key.type, toValue, visibility);
Expand All @@ -107,7 +107,7 @@ class Module {
}
}

_checkBindArgs(toValue, toFactory, toImplementation) {
_assertBindArgsValid(toValue, toFactory, toImplementation) {
int count = 0;
if (!identical(toValue, _DEFAULT_VALUE)) count++;
if (!identical(toFactory, _DEFAULT_VALUE)) count++;
Expand Down