From c1154b30c7323b70777cd40745c0e01eadc64f5d Mon Sep 17 00:00:00 2001 From: Alex Eagle Date: Sat, 7 May 2016 08:58:20 -0600 Subject: [PATCH] fix(compiler): allow decorators defined in the same file --- .../integrationtest/src/a/multiple_components.ts | 6 ++++++ modules/@angular/compiler_cli/src/static_reflector.ts | 6 +++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/modules/@angular/compiler_cli/integrationtest/src/a/multiple_components.ts b/modules/@angular/compiler_cli/integrationtest/src/a/multiple_components.ts index e632ad8d80..28a29c3ed8 100644 --- a/modules/@angular/compiler_cli/integrationtest/src/a/multiple_components.ts +++ b/modules/@angular/compiler_cli/integrationtest/src/a/multiple_components.ts @@ -19,3 +19,9 @@ export function NotADirective(c: any): void {} @NotADirective export class HasCustomDecorator { } + +// Verify that custom decorators have metadata collected, eg Ionic +export function Page(c: any): (f: Function) => void {return c;} + +@Page({template: 'Ionic template'}) +export class AnIonicPage {} diff --git a/modules/@angular/compiler_cli/src/static_reflector.ts b/modules/@angular/compiler_cli/src/static_reflector.ts index c2feed5ef1..80f2ac8bda 100644 --- a/modules/@angular/compiler_cli/src/static_reflector.ts +++ b/modules/@angular/compiler_cli/src/static_reflector.ts @@ -345,8 +345,12 @@ export class StaticReflector implements ReflectorReader { case "new": case "call": let target = expression['expression']; - staticSymbol = + if (target['module']) { + staticSymbol = _this.host.findDeclaration(target['module'], target['name'], context.filePath); + } else { + staticSymbol = _this.host.getStaticSymbol(context.filePath, target['name']); + } let converter = _this.conversionMap.get(staticSymbol); if (converter) { let args = expression['arguments'];