refactor(ngcc): move `stripParentheses` to `Esm5ReflectionHost` for re-use (#33777)
PR Close #33777
This commit is contained in:
parent
7f24975a60
commit
9c6ee5fcd0
|
@ -14,8 +14,6 @@ import {getNameText, hasNameIdentifier, stripDollarSuffix} from '../utils';
|
|||
import {Esm2015ReflectionHost, ParamInfo, getPropertyValueFromSymbol, isAssignmentStatement} from './esm2015_host';
|
||||
import {NgccClassSymbol} from './ngcc_host';
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* ESM5 packages contain ECMAScript IIFE functions that act like classes. For example:
|
||||
*
|
||||
|
@ -834,3 +832,7 @@ function isUndefinedComparison(expression: ts.Expression): expression is ts.Expr
|
|||
expression.operatorToken.kind === ts.SyntaxKind.EqualsEqualsEqualsToken &&
|
||||
ts.isVoidExpression(expression.right) && ts.isIdentifier(expression.left);
|
||||
}
|
||||
|
||||
export function stripParentheses(node: ts.Node): ts.Node {
|
||||
return ts.isParenthesizedExpression(node) ? node.expression : node;
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ import {absoluteFrom} from '../../../src/ngtsc/file_system';
|
|||
import {Declaration, Import} from '../../../src/ngtsc/reflection';
|
||||
import {Logger} from '../logging/logger';
|
||||
import {BundleProgram} from '../packages/bundle_program';
|
||||
import {Esm5ReflectionHost} from './esm5_host';
|
||||
import {Esm5ReflectionHost, stripParentheses} from './esm5_host';
|
||||
|
||||
export class UmdReflectionHost extends Esm5ReflectionHost {
|
||||
protected umdModules = new Map<ts.SourceFile, UmdModule|null>();
|
||||
|
@ -279,7 +279,3 @@ function findNamespaceOfIdentifier(id: ts.Identifier): ts.Identifier|null {
|
|||
id.parent.expression :
|
||||
null;
|
||||
}
|
||||
|
||||
export function stripParentheses(node: ts.Node): ts.Node {
|
||||
return ts.isParenthesizedExpression(node) ? node.expression : node;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue