From 4a3fd5e8559b75a776a3eff07234367d12af2df9 Mon Sep 17 00:00:00 2001 From: Tobias Bosch Date: Wed, 27 May 2015 10:28:15 -0700 Subject: [PATCH] =?UTF-8?q?fix(di):=20allow=20`@Inject(=E2=80=A6)`=20to=20?= =?UTF-8?q?work=20in=20dart2js=20and=20dynamic=20reflection?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Note: We can’t write a unit test for this as our unit tests are running in Dartium, where the error does not occur. However, we previously had a failure in our e2e tests in `hello_world/index_dynamic.html` when removing the TODOs in `application.ts`. Closes #2185 --- modules/angular2/src/core/application.ts | 11 ++--------- .../src/reflection/reflection_capabilities.dart | 4 ++-- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/modules/angular2/src/core/application.ts b/modules/angular2/src/core/application.ts index 9e13e6b339..a19481ada7 100644 --- a/modules/angular2/src/core/application.ts +++ b/modules/angular2/src/core/application.ts @@ -103,19 +103,12 @@ function _injectorBindings(appComponentType): List> { .toFactory((styleUrlResolver, doc) => new EmulatedUnscopedShadowDomStrategy(styleUrlResolver, doc.head), [StyleUrlResolver, DOCUMENT_TOKEN]), - // TODO(tbosch): We need an explicit factory here, as - // we are getting errors in dart2js with mirrors... - bind(DomRenderer) - .toFactory((eventManager, shadowDomStrategy, doc) => - new DomRenderer(eventManager, shadowDomStrategy, doc), - [EventManager, ShadowDomStrategy, DOCUMENT_TOKEN]), + DomRenderer, DefaultDomCompiler, bind(Renderer).toAlias(DomRenderer), bind(RenderCompiler).toAlias(DefaultDomCompiler), ProtoViewFactory, - // TODO(tbosch): We need an explicit factory here, as - // we are getting errors in dart2js with mirrors... - bind(AppViewPool).toFactory((capacity) => new AppViewPool(capacity), [APP_VIEW_POOL_CAPACITY]), + AppViewPool, bind(APP_VIEW_POOL_CAPACITY).toValue(10000), AppViewManager, AppViewManagerUtils, diff --git a/modules/angular2/src/reflection/reflection_capabilities.dart b/modules/angular2/src/reflection/reflection_capabilities.dart index 2583aa45cf..3aa12c029a 100644 --- a/modules/angular2/src/reflection/reflection_capabilities.dart +++ b/modules/angular2/src/reflection/reflection_capabilities.dart @@ -57,8 +57,8 @@ class ReflectionCapabilities { } List _convertParameter(ParameterMirror p) { - var t = p.type.reflectedType; - var res = t == dynamic ? [] : [t]; + var t = p.type; + var res = (!t.hasReflectedType || t.reflectedType == dynamic) ? [] : [t.reflectedType]; res.addAll(p.metadata.map((m) => m.reflectee)); return res; }