diff --git a/packages/core/src/reflection/reflection_capabilities.ts b/packages/core/src/reflection/reflection_capabilities.ts index 57e58c2f18..ca3e397df9 100644 --- a/packages/core/src/reflection/reflection_capabilities.ts +++ b/packages/core/src/reflection/reflection_capabilities.ts @@ -18,9 +18,9 @@ import {GetterFn, MethodFn, SetterFn} from './types'; * Attention: These regex has to hold even if the code is minified! */ export const DELEGATE_CTOR = /^function\s+\S+\(\)\s*{[\s\S]+\.apply\(this,\s*arguments\)/; -export const INHERITED_CLASS = /^class\s+[A-Za-z\d$_]*\s*extends\s+[A-Za-z\d$_]+\s*{/; +export const INHERITED_CLASS = /^class\s+[A-Za-z\d$_]*\s*extends\s+[^{]+{/; export const INHERITED_CLASS_WITH_CTOR = - /^class\s+[A-Za-z\d$_]*\s*extends\s+[A-Za-z\d$_]+\s*{[\s\S]*constructor\s*\(/; + /^class\s+[A-Za-z\d$_]*\s*extends\s+[^{]+{[\s\S]*constructor\s*\(/; export class ReflectionCapabilities implements PlatformReflectionCapabilities { private _reflect: any; diff --git a/packages/core/test/reflection/reflector_spec.ts b/packages/core/test/reflection/reflector_spec.ts index d24ff79e92..a8c2080e39 100644 --- a/packages/core/test/reflection/reflector_spec.ts +++ b/packages/core/test/reflection/reflector_spec.ts @@ -194,6 +194,10 @@ class TestObj { const ChildWithCtor = `class ChildWithCtor extends Parent {\n` + ` constructor() { super(); }` + `}\n`; + const ChildNoCtorComplexBase = `class ChildNoCtor extends Parent['foo'].bar(baz) {}\n`; + const ChildWithCtorComplexBase = `class ChildWithCtor extends Parent['foo'].bar(baz) {\n` + + ` constructor() { super(); }` + + `}\n`; const ChildNoCtorPrivateProps = `class ChildNoCtorPrivateProps extends Parent {\n` + ` private x = 10;\n` + `}\n`; @@ -204,6 +208,8 @@ class TestObj { expect(checkNoOwnMetadata(ChildNoCtor)).toBeTruthy(); expect(checkNoOwnMetadata(ChildNoCtorPrivateProps)).toBeTruthy(); expect(checkNoOwnMetadata(ChildWithCtor)).toBeFalsy(); + expect(checkNoOwnMetadata(ChildNoCtorComplexBase)).toBeTruthy(); + expect(checkNoOwnMetadata(ChildWithCtorComplexBase)).toBeFalsy(); }); it('should properly handle all class forms', () => {