From 61218f5f0b11b806961717c49d8f159313bfa529 Mon Sep 17 00:00:00 2001 From: Alex Rickabaugh Date: Fri, 10 Aug 2018 11:26:41 +0100 Subject: [PATCH] fix(ivy): ensure factory statements are emitted correctly (#25406) PR Close #25406 --- packages/compiler/src/render3/r3_factory.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/compiler/src/render3/r3_factory.ts b/packages/compiler/src/render3/r3_factory.ts index b07f91a925..00e91bba2a 100644 --- a/packages/compiler/src/render3/r3_factory.ts +++ b/packages/compiler/src/render3/r3_factory.ts @@ -181,8 +181,10 @@ export function compileFactoryFunction(meta: R3FactoryMetadata): } else { const baseFactory = o.variable(`ɵ${meta.name}_BaseFactory`); const getInheritedFactory = o.importExpr(R3.getInheritedFactory); - const baseFactoryStmt = baseFactory.set(getInheritedFactory.callFn([meta.type])) - .toDeclStmt(o.INFERRED_TYPE, [o.StmtModifier.Final]); + const baseFactoryStmt = + baseFactory.set(getInheritedFactory.callFn([meta.type])).toDeclStmt(o.INFERRED_TYPE, [ + o.StmtModifier.Exported, o.StmtModifier.Final + ]); statements.push(baseFactoryStmt); // There is no constructor, use the base class' factory to construct typeForCtor. @@ -206,8 +208,10 @@ export function compileFactoryFunction(meta: R3FactoryMetadata): if (meta.delegate.isEquivalent(meta.type)) { throw new Error(`Illegal state: compiling factory that delegates to itself`); } - const delegateFactoryStmt = delegateFactory.set(getFactoryOf.callFn([meta.delegate])) - .toDeclStmt(o.INFERRED_TYPE, [o.StmtModifier.Final]); + const delegateFactoryStmt = + delegateFactory.set(getFactoryOf.callFn([meta.delegate])).toDeclStmt(o.INFERRED_TYPE, [ + o.StmtModifier.Exported, o.StmtModifier.Final + ]); statements.push(delegateFactoryStmt); const r = makeConditionalFactory(delegateFactory.callFn([]));