fix(compiler): reexport less symbols in .ngfactory.ts
files (#19884)
* don't reexport symbols that the user already reexported * never reexport symbols that are part of arguments of non simple function calls Fixes #19883 PR Close #19884
This commit is contained in:

committed by
Matias Niemelä

parent
04eb80cc2b
commit
420852e2f5
@ -6,7 +6,9 @@
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {createLoweredSymbol, isLoweredSymbol} from '@angular/compiler';
|
||||
import * as ts from 'typescript';
|
||||
|
||||
import {CollectorOptions, MetadataCollector, MetadataValue, ModuleMetadata, isMetadataGlobalReferenceExpression} from '../metadata/index';
|
||||
|
||||
export interface LoweringRequest {
|
||||
@ -225,14 +227,12 @@ function shouldLower(node: ts.Node | undefined): boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
const REWRITE_PREFIX = '\u0275';
|
||||
|
||||
function isPrimitive(value: any): boolean {
|
||||
return Object(value) !== value;
|
||||
}
|
||||
|
||||
function isRewritten(value: any): boolean {
|
||||
return isMetadataGlobalReferenceExpression(value) && value.name.startsWith(REWRITE_PREFIX);
|
||||
return isMetadataGlobalReferenceExpression(value) && isLoweredSymbol(value.name);
|
||||
}
|
||||
|
||||
function isLiteralFieldNamed(node: ts.Node, names: Set<string>): boolean {
|
||||
@ -276,7 +276,7 @@ export class LowerMetadataCache implements RequestsMap {
|
||||
|
||||
private getMetadataAndRequests(sourceFile: ts.SourceFile): MetadataAndLoweringRequests {
|
||||
let identNumber = 0;
|
||||
const freshIdent = () => REWRITE_PREFIX + identNumber++;
|
||||
const freshIdent = () => createLoweredSymbol(identNumber++);
|
||||
const requests = new Map<number, LoweringRequest>();
|
||||
|
||||
const isExportedSymbol = (() => {
|
||||
|
Reference in New Issue
Block a user