Skip to content

Commit

Permalink
fix(compiler): fix simplify a reference without a name
Browse files Browse the repository at this point in the history
closes #13470
  • Loading branch information
vicb committed Dec 15, 2016
1 parent cd03c77 commit 1c279b3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions modules/@angular/compiler/src/aot/static_reflector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -640,6 +640,9 @@ export class StaticReflector implements ReflectorReader {
return simplifyInContext(selectContext, selectTarget[member], depth + 1);
return null;
case 'reference':
if (!expression['name']) {
return context;
}
if (!expression.module) {
const name: string = expression['name'];
const localValue = scope.resolve(name);
Expand Down
6 changes: 6 additions & 0 deletions modules/@angular/compiler/test/aot/static_reflector_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,12 @@ describe('StaticReflector', () => {
.toEqual('s');
});

it('should not simplify a module reference without a name', () => {
const staticSymbol = new StaticSymbol('/src/cases', '');
expect(simplify(staticSymbol, ({__symbolic: 'reference', module: './extern', name: ''})))
.toEqual(staticSymbol);
});

it('should simplify a non existing reference as a static symbol', () => {
expect(simplify(
new StaticSymbol('/src/cases', ''),
Expand Down

0 comments on commit 1c279b3

Please sign in to comment.