Skip to content

Commit 016977c

Browse files
filipesilvavikerman
authored andcommitted
fix(@angular-devkit/build-optimizer): remove unecessary scrub file checks
1 parent f1b87da commit 016977c

File tree

1 file changed

+8
-10
lines changed
  • packages/angular_devkit/build_optimizer/src/transforms

1 file changed

+8
-10
lines changed

packages/angular_devkit/build_optimizer/src/transforms/scrub-file.ts

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -50,21 +50,19 @@ function scrubFileTransformer(checker: ts.TypeChecker, isAngularCoreFile: boolea
5050
return ts.forEachChild(node, checkNodeForDecorators);
5151
}
5252
const exprStmt = node as ts.ExpressionStatement;
53-
if (isDecoratorAssignmentExpression(exprStmt)) {
53+
// Do checks that don't need the typechecker first and bail early.
54+
if (isCtorParamsAssignmentExpression(exprStmt)) {
55+
nodes.push(node);
56+
} else if (isDecoratorAssignmentExpression(exprStmt)) {
5457
nodes.push(...pickDecorationNodesToRemove(exprStmt, ngMetadata, checker));
55-
}
56-
if (isDecorateAssignmentExpression(exprStmt, tslibImports, checker)) {
58+
} else if (isDecorateAssignmentExpression(exprStmt, tslibImports, checker)) {
5759
nodes.push(...pickDecorateNodesToRemove(exprStmt, tslibImports, ngMetadata, checker));
58-
}
59-
if (isAngularDecoratorMetadataExpression(exprStmt, ngMetadata, tslibImports, checker)) {
60+
} else if (isAngularDecoratorMetadataExpression(exprStmt,
61+
ngMetadata, tslibImports, checker)) {
6062
nodes.push(node);
61-
}
62-
if (isPropDecoratorAssignmentExpression(exprStmt)) {
63+
} else if (isPropDecoratorAssignmentExpression(exprStmt)) {
6364
nodes.push(...pickPropDecorationNodesToRemove(exprStmt, ngMetadata, checker));
6465
}
65-
if (isCtorParamsAssignmentExpression(exprStmt)) {
66-
nodes.push(node);
67-
}
6866
}
6967

7068
const visitor: ts.Visitor = (node: ts.Node): ts.VisitResult<ts.Node> => {

0 commit comments

Comments
 (0)