From aa40366a92739b92a0d6499cbe6451efa8fc5a1c Mon Sep 17 00:00:00 2001 From: Victor Berchet Date: Wed, 14 Dec 2016 14:01:50 -0800 Subject: [PATCH] fix(compiler): fix simplify a reference without a name closes #13470 --- modules/@angular/compiler/src/aot/static_reflector.ts | 3 +++ modules/@angular/compiler/test/aot/static_reflector_spec.ts | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/modules/@angular/compiler/src/aot/static_reflector.ts b/modules/@angular/compiler/src/aot/static_reflector.ts index ed22fb3d4a..1b8d2dc070 100644 --- a/modules/@angular/compiler/src/aot/static_reflector.ts +++ b/modules/@angular/compiler/src/aot/static_reflector.ts @@ -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); diff --git a/modules/@angular/compiler/test/aot/static_reflector_spec.ts b/modules/@angular/compiler/test/aot/static_reflector_spec.ts index 21ee4f0f4c..d38d5af3da 100644 --- a/modules/@angular/compiler/test/aot/static_reflector_spec.ts +++ b/modules/@angular/compiler/test/aot/static_reflector_spec.ts @@ -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', ''),