( compiled: CompiledClass, out: OutputSourceMapBuilder, printer: ExpressionPrinter, ctx: HybridCompilerContext, )
| 2079 | } |
| 2080 | |
| 2081 | function appendCompiledClass( |
| 2082 | compiled: CompiledClass, |
| 2083 | out: OutputSourceMapBuilder, |
| 2084 | printer: ExpressionPrinter, |
| 2085 | ctx: HybridCompilerContext, |
| 2086 | ): void { |
| 2087 | const { |
| 2088 | classMeta: {span}, |
| 2089 | fields, |
| 2090 | ngModule, |
| 2091 | classMetadataStmt, |
| 2092 | debugInfoStmt, |
| 2093 | hmrInitializerStmt, |
| 2094 | } = compiled; |
| 2095 | |
| 2096 | for (const field of fields) { |
| 2097 | const compiledFactory = field.factory ? compileFactoryField(field.factory, printer, ctx) : ''; |
| 2098 | const compiledDef = createStaticField( |
| 2099 | field.def.name, |
| 2100 | printer.print(field.def.def.expression), |
| 2101 | printer.emitTypes ? printer.printType(field.def.def.type) : null, |
| 2102 | true, |
| 2103 | ctx.isClosureCompilerEnabled, |
| 2104 | ); |
| 2105 | out.appendLeft(span.end - 1, compiledFactory + compiledDef + (field.coercionMembers ?? '')); |
| 2106 | } |
| 2107 | |
| 2108 | let ngModuleStatements = ''; |
| 2109 | if (ngModule !== null) { |
| 2110 | const compiledFac = compileFactoryField(ngModule.factory, printer, ctx); |
| 2111 | const compiledMod = createStaticField( |
| 2112 | 'ɵmod', |
| 2113 | printer.print(ngModule.mod.expression), |
| 2114 | printer.emitTypes ? printer.printType(ngModule.mod.type) : null, |
| 2115 | true, |
| 2116 | ctx.isClosureCompilerEnabled, |
| 2117 | ); |
| 2118 | if (ngModule.statements.length > 0) { |
| 2119 | ngModuleStatements = ngModule.statements |
| 2120 | .map((stmt) => printer.printStatement(stmt, 0)) |
| 2121 | .join('\n'); |
| 2122 | } |
| 2123 | const compiledInj = createStaticField( |
| 2124 | 'ɵinj', |
| 2125 | printer.print(ngModule.inj.expression), |
| 2126 | printer.emitTypes ? printer.printType(ngModule.inj.type) : null, |
| 2127 | true, |
| 2128 | ctx.isClosureCompilerEnabled, |
| 2129 | ); |
| 2130 | out.appendLeft(span.end - 1, compiledFac + compiledMod + compiledInj); |
| 2131 | } |
| 2132 | |
| 2133 | if (classMetadataStmt !== null) { |
| 2134 | const emitOutsideClass = |
| 2135 | !!ctx.complianceMode || !!compiled.classMeta.hasNonAngularClassDecorators; |
| 2136 | const metadata = printSetClassMetadata(classMetadataStmt, printer, emitOutsideClass); |
| 2137 | if (emitOutsideClass) { |
| 2138 | out.appendRight(span.end, '\n' + metadata); |
no test coverage detected