X Tutup
Skip to content

Commit c9a3df9

Browse files
committed
feat(di): drop support for injecting types with generics in Dart
BREAKING CHANGE: In Dart we used to support injecting types with generics. As this feature is hard to implement with the upcoming codegen we are dropping it. Merge cl/115454020 in G3 with this change. Closes angular#7262
1 parent f72f137 commit c9a3df9

File tree

9 files changed

+1
-144
lines changed

9 files changed

+1
-144
lines changed

modules/angular2/src/core/di.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export {
3131
ResolvedProvider,
3232
provide
3333
} from './di/provider';
34-
export {Key, TypeLiteral} from './di/key';
34+
export {Key} from './di/key';
3535
export {
3636
NoProviderError,
3737
AbstractProviderError,

modules/angular2/src/core/di/key.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
import {stringify, CONST, Type, isBlank} from 'angular2/src/facade/lang';
22
import {BaseException, WrappedException} from 'angular2/src/facade/exceptions';
3-
import {TypeLiteral} from './type_literal';
43
import {resolveForwardRef} from './forward_ref';
54

6-
export {TypeLiteral} from './type_literal';
7-
85
/**
96
* A unique object used for retrieving items from the {@link Injector}.
107
*
@@ -53,13 +50,6 @@ export class KeyRegistry {
5350
get(token: Object): Key {
5451
if (token instanceof Key) return token;
5552

56-
// TODO: workaround for https://github.com/Microsoft/TypeScript/issues/3123
57-
var theToken = token;
58-
if (token instanceof TypeLiteral) {
59-
theToken = token.type;
60-
}
61-
token = theToken;
62-
6353
if (this._allKeys.has(token)) {
6454
return this._allKeys.get(token);
6555
}

modules/angular2/src/core/di/type_literal.dart

Lines changed: 0 additions & 26 deletions
This file was deleted.

modules/angular2/src/core/di/type_literal.ts

Lines changed: 0 additions & 7 deletions
This file was deleted.

modules/angular2/test/core/di/injector_dart_spec.dart

Lines changed: 0 additions & 22 deletions
This file was deleted.

modules/angular2/test/core/di/key_dart_spec.dart

Lines changed: 0 additions & 40 deletions
This file was deleted.

modules/angular2/test/core/linker/integration_dart_spec.dart

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -42,27 +42,6 @@ void functionThatThrowsNonError() {
4242
}
4343

4444
main() {
45-
describe('TypeLiteral', () {
46-
it(
47-
'should publish via viewBindings',
48-
inject([TestComponentBuilder, AsyncTestCompleter], (tb, async) {
49-
tb
50-
.overrideView(
51-
Dummy,
52-
new ViewMetadata(
53-
template:
54-
'<type-literal-component></type-literal-component>',
55-
directives: [TypeLiteralComponent]))
56-
.createAsync(Dummy)
57-
.then((tc) {
58-
tc.detectChanges();
59-
expect(asNativeElements(tc.debugElement.children))
60-
.toHaveText('[Hello, World]');
61-
async.done();
62-
});
63-
}));
64-
});
65-
6645
describe('Error handling', () {
6746
it(
6847
'should preserve Error stack traces thrown from components',
@@ -216,19 +195,6 @@ class Dummy {
216195
dynamic value;
217196
}
218197

219-
@Component(
220-
selector: 'type-literal-component',
221-
viewBindings: const [
222-
const Binding(const TypeLiteral<List<String>>(),
223-
toValue: const <String>['Hello', 'World'])
224-
])
225-
@View(template: '{{list}}')
226-
class TypeLiteralComponent {
227-
final List<String> list;
228-
229-
TypeLiteralComponent(this.list);
230-
}
231-
232198
@Component(selector: 'throwing-component')
233199
@View(template: '')
234200
class ThrowingComponent {

modules/angular2/test/public_api_spec.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1313,8 +1313,6 @@ var NG_CORE = [
13131313
'GetTestability:dart',
13141314
'setTestabilityGetter()',
13151315
'Type:js',
1316-
'TypeLiteral',
1317-
'TypeLiteral.type',
13181316
'PACKAGE_ROOT_URL',
13191317
'View',
13201318
'View.directives',

tools/public_api_guard/public_api_spec.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -446,8 +446,6 @@ const CORE = [
446446
'TypeDecorator',
447447
'TypeDecorator.Class(obj:ClassDefinition):ConcreteType',
448448
'TypeDecorator.annotations:any[]',
449-
'TypeLiteral',
450-
'TypeLiteral.type:any',
451449
'ViewChildFactory',
452450
'ViewChildMetadata',
453451
'ViewChildMetadata.constructor(_selector:Type|string)',

0 commit comments

Comments
 (0)
X Tutup