From 8c477b2f4539307cd1dfb35b706026f74ea96ef1 Mon Sep 17 00:00:00 2001 From: Steve Sewell Date: Tue, 11 Oct 2016 15:47:44 -0700 Subject: [PATCH] fix(compiler-cli): don't clone static symbols when simplifying annotation metadata (#12158) --- modules/@angular/compiler-cli/src/static_reflector.ts | 3 +++ modules/@angular/compiler-cli/test/static_reflector_spec.ts | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/modules/@angular/compiler-cli/src/static_reflector.ts b/modules/@angular/compiler-cli/src/static_reflector.ts index 1d221cea85..5e92309ab9 100644 --- a/modules/@angular/compiler-cli/src/static_reflector.ts +++ b/modules/@angular/compiler-cli/src/static_reflector.ts @@ -368,6 +368,9 @@ export class StaticReflector implements ReflectorReader { } return result; } + if (expression instanceof StaticSymbol) { + return expression; + } if (expression) { if (expression['__symbolic']) { let staticSymbol: StaticSymbol; diff --git a/modules/@angular/compiler-cli/test/static_reflector_spec.ts b/modules/@angular/compiler-cli/test/static_reflector_spec.ts index d909324ebf..fe6733321f 100644 --- a/modules/@angular/compiler-cli/test/static_reflector_spec.ts +++ b/modules/@angular/compiler-cli/test/static_reflector_spec.ts @@ -119,6 +119,11 @@ describe('StaticReflector', () => { expect(simplify(noContext, 'some value')).toBe('some value'); }); + it('should simplify a static symbol into itself', () => { + const staticSymbol = new StaticSymbol('', ''); + expect(simplify(noContext, staticSymbol)).toBe(staticSymbol); + }); + it('should simplify an array into a copy of the array', () => { expect(simplify(noContext, [1, 2, 3])).toEqual([1, 2, 3]); });