Revert "fix(compiler): shouldn't throw when Symbol is used as DI token (#13701)" (#15319)

This reverts commit 8b5c6b2732.

This feature is not compatible with the `Injector.get` which now only 
takes `Type` or `InjectableToken`. `Symbol` is not a valid type.

Closes #15183

PR Close #15319
This commit is contained in:
Miško Hevery
2017-03-20 15:04:20 -07:00
committed by Miško Hevery
parent d3eda7a5b5
commit fa36ffda14
2 changed files with 1 additions and 40 deletions

View File

@ -80,8 +80,6 @@ function _sanitizeIdentifier(name: string): string {
}
let _anonymousTypeIndex = 0;
let symbolId = 0;
const symbolIds = new Map<Symbol, string>();
export function identifierName(compileIdentifier: CompileIdentifierMetadata): string {
if (!compileIdentifier || !compileIdentifier.reference) {
@ -91,14 +89,6 @@ export function identifierName(compileIdentifier: CompileIdentifierMetadata): st
if (ref instanceof StaticSymbol) {
return ref.name;
}
if (isSymbol(ref)) {
if (symbolIds.has(ref)) {
return symbolIds.get(ref);
}
const symbolStr = `_symbol_${_sanitizeIdentifier(ref.toString())}_${symbolId++}`;
symbolIds.set(ref, symbolStr);
return symbolStr;
}
if (ref['__anonymousType']) {
return ref['__anonymousType'];
}
@ -113,10 +103,6 @@ export function identifierName(compileIdentifier: CompileIdentifierMetadata): st
return identifier;
}
function isSymbol(sym: any): sym is Symbol {
return typeof sym === 'symbol';
}
export function identifierModuleUrl(compileIdentifier: CompileIdentifierMetadata): string {
const ref = compileIdentifier.reference;
if (ref instanceof StaticSymbol) {