diff --git a/benchmark/injector_benchmark_common.dart b/benchmark/injector_benchmark_common.dart index ce1cbd9..8fe3840 100644 --- a/benchmark/injector_benchmark_common.dart +++ b/benchmark/injector_benchmark_common.dart @@ -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() { diff --git a/benchmark/module_benchmark.dart b/benchmark/module_benchmark.dart index cb18a5a..a92c6db 100644 --- a/benchmark/module_benchmark.dart +++ b/benchmark/module_benchmark.dart @@ -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); } } diff --git a/lib/src/module.dart b/lib/src/module.dart index 020ea8d..fb94152 100644 --- a/lib/src/module.dart +++ b/lib/src/module.dart @@ -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); @@ -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++;