Skip to content

Commit

Permalink
feat(di): drop support for injecting types with generics in Dart
Browse files Browse the repository at this point in the history
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 #7262
  • Loading branch information
tbosch committed Mar 1, 2016
1 parent f72f137 commit c9a3df9
Show file tree
Hide file tree
Showing 9 changed files with 1 addition and 144 deletions.
2 changes: 1 addition & 1 deletion modules/angular2/src/core/di.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export {
ResolvedProvider,
provide
} from './di/provider';
export {Key, TypeLiteral} from './di/key';
export {Key} from './di/key';
export {
NoProviderError,
AbstractProviderError,
Expand Down
10 changes: 0 additions & 10 deletions modules/angular2/src/core/di/key.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import {stringify, CONST, Type, isBlank} from 'angular2/src/facade/lang';
import {BaseException, WrappedException} from 'angular2/src/facade/exceptions';
import {TypeLiteral} from './type_literal';
import {resolveForwardRef} from './forward_ref';

export {TypeLiteral} from './type_literal';

/**
* A unique object used for retrieving items from the {@link Injector}.
*
Expand Down Expand Up @@ -53,13 +50,6 @@ export class KeyRegistry {
get(token: Object): Key {
if (token instanceof Key) return token;

// TODO: workaround for https://github.com/Microsoft/TypeScript/issues/3123
var theToken = token;
if (token instanceof TypeLiteral) {
theToken = token.type;
}
token = theToken;

if (this._allKeys.has(token)) {
return this._allKeys.get(token);
}
Expand Down
26 changes: 0 additions & 26 deletions modules/angular2/src/core/di/type_literal.dart

This file was deleted.

7 changes: 0 additions & 7 deletions modules/angular2/src/core/di/type_literal.ts

This file was deleted.

22 changes: 0 additions & 22 deletions modules/angular2/test/core/di/injector_dart_spec.dart

This file was deleted.

40 changes: 0 additions & 40 deletions modules/angular2/test/core/di/key_dart_spec.dart

This file was deleted.

34 changes: 0 additions & 34 deletions modules/angular2/test/core/linker/integration_dart_spec.dart
Original file line number Diff line number Diff line change
Expand Up @@ -42,27 +42,6 @@ void functionThatThrowsNonError() {
}

main() {
describe('TypeLiteral', () {
it(
'should publish via viewBindings',
inject([TestComponentBuilder, AsyncTestCompleter], (tb, async) {
tb
.overrideView(
Dummy,
new ViewMetadata(
template:
'<type-literal-component></type-literal-component>',
directives: [TypeLiteralComponent]))
.createAsync(Dummy)
.then((tc) {
tc.detectChanges();
expect(asNativeElements(tc.debugElement.children))
.toHaveText('[Hello, World]');
async.done();
});
}));
});

describe('Error handling', () {
it(
'should preserve Error stack traces thrown from components',
Expand Down Expand Up @@ -216,19 +195,6 @@ class Dummy {
dynamic value;
}

@Component(
selector: 'type-literal-component',
viewBindings: const [
const Binding(const TypeLiteral<List<String>>(),
toValue: const <String>['Hello', 'World'])
])
@View(template: '{{list}}')
class TypeLiteralComponent {
final List<String> list;

TypeLiteralComponent(this.list);
}

@Component(selector: 'throwing-component')
@View(template: '')
class ThrowingComponent {
Expand Down
2 changes: 0 additions & 2 deletions modules/angular2/test/public_api_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1313,8 +1313,6 @@ var NG_CORE = [
'GetTestability:dart',
'setTestabilityGetter()',
'Type:js',
'TypeLiteral',
'TypeLiteral.type',
'PACKAGE_ROOT_URL',
'View',
'View.directives',
Expand Down
2 changes: 0 additions & 2 deletions tools/public_api_guard/public_api_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -446,8 +446,6 @@ const CORE = [
'TypeDecorator',
'TypeDecorator.Class(obj:ClassDefinition):ConcreteType',
'TypeDecorator.annotations:any[]',
'TypeLiteral',
'TypeLiteral.type:any',
'ViewChildFactory',
'ViewChildMetadata',
'ViewChildMetadata.constructor(_selector:Type|string)',
Expand Down

0 comments on commit c9a3df9

Please sign in to comment.