Skip to content

Commit

Permalink
a
Browse files Browse the repository at this point in the history
  • Loading branch information
Dzmitry Shylovich authored and Dzmitry Shylovich committed Dec 29, 2016
1 parent 50d6e4e commit 139b1b9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion modules/@angular/compiler/src/compile_metadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export function identifierName(compileIdentifier: CompileIdentifierMetadata): st
if (symbols.has(ref)) {
return symbols.get(ref);
}
const symbolStr = `${ref.toString().replace(/\(|\)/g, '_')}${symbolIndex++}`;
const symbolStr = `_symbol_${_sanitizeIdentifier(ref.toString())}_${symbolIndex++}`;
symbols.set(ref, symbolStr);
return symbolStr;
}
Expand Down
8 changes: 6 additions & 2 deletions modules/@angular/compiler/test/integration_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ export function main() {
});

it('should not throw when Symbol is used as DI token', async(() => {
const SOME_SYMBOL = Symbol('SomeSymbol');
const SOME_SYMBOL = Symbol('Symbol');
const ANOTHER_SYMBOL = Symbol('Symbol');

@Component({selector: 'symbol', template: ''})
class CmpWithSymbol {
Expand All @@ -48,7 +49,10 @@ export function main() {

TestBed.configureTestingModule({
declarations: [CmpWithSymbol],
providers: [{provide: SOME_SYMBOL, useValue: 'value'}]
providers: [
{provide: SOME_SYMBOL, useValue: 'value'},
{provide: ANOTHER_SYMBOL, useValue: 'another value'}
]
});

const fixture = TestBed.createComponent(CmpWithSymbol);
Expand Down

0 comments on commit 139b1b9

Please sign in to comment.