Skip to content

Commit be2d52b

Browse files
alxhubFrederikSchlemmer
authored andcommitted
fix(ivy): ensure factory statements are emitted correctly (angular#25406)
PR Close angular#25406
1 parent 6304e79 commit be2d52b

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

packages/compiler/src/render3/r3_factory.ts

+8-4
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,10 @@ export function compileFactoryFunction(meta: R3FactoryMetadata):
181181
} else {
182182
const baseFactory = o.variable(${meta.name}_BaseFactory`);
183183
const getInheritedFactory = o.importExpr(R3.getInheritedFactory);
184-
const baseFactoryStmt = baseFactory.set(getInheritedFactory.callFn([meta.type]))
185-
.toDeclStmt(o.INFERRED_TYPE, [o.StmtModifier.Final]);
184+
const baseFactoryStmt =
185+
baseFactory.set(getInheritedFactory.callFn([meta.type])).toDeclStmt(o.INFERRED_TYPE, [
186+
o.StmtModifier.Exported, o.StmtModifier.Final
187+
]);
186188
statements.push(baseFactoryStmt);
187189

188190
// There is no constructor, use the base class' factory to construct typeForCtor.
@@ -206,8 +208,10 @@ export function compileFactoryFunction(meta: R3FactoryMetadata):
206208
if (meta.delegate.isEquivalent(meta.type)) {
207209
throw new Error(`Illegal state: compiling factory that delegates to itself`);
208210
}
209-
const delegateFactoryStmt = delegateFactory.set(getFactoryOf.callFn([meta.delegate]))
210-
.toDeclStmt(o.INFERRED_TYPE, [o.StmtModifier.Final]);
211+
const delegateFactoryStmt =
212+
delegateFactory.set(getFactoryOf.callFn([meta.delegate])).toDeclStmt(o.INFERRED_TYPE, [
213+
o.StmtModifier.Exported, o.StmtModifier.Final
214+
]);
211215

212216
statements.push(delegateFactoryStmt);
213217
const r = makeConditionalFactory(delegateFactory.callFn([]));

0 commit comments

Comments
 (0)