Skip to content

Commit 049fc79

Browse files
alan-agius4dgp1130
authored andcommitted
revert: "fix(@angular-devkit/build-optimizer): wrap classes which contain empty statements (#16538)"
This reverts commit 4cde922.
1 parent 0ef45f3 commit 049fc79

File tree

2 files changed

+0
-38
lines changed

2 files changed

+0
-38
lines changed

packages/angular_devkit/build_optimizer/src/transforms/wrap-enums.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -322,15 +322,7 @@ function findStatements(
322322

323323
for (let index = statementIndex + 1; index < statements.length; ++index) {
324324
const statement = statements[index];
325-
326325
if (!ts.isExpressionStatement(statement)) {
327-
// The below is a workaround for NGCC as TS will never emit an EmptyStatement.
328-
// See: https://github.com/angular/angular-cli/issues/16509#issuecomment-570198398
329-
if (ts.isEmptyStatement(statement)) {
330-
count++;
331-
continue;
332-
}
333-
334326
break;
335327
}
336328

packages/angular_devkit/build_optimizer/src/transforms/wrap-enums_spec.ts

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -88,36 +88,6 @@ describe('wrap enums and classes transformer', () => {
8888
expect(tags.oneLine`${transform(input)}`).toEqual(tags.oneLine`${output}`);
8989
});
9090

91-
it('should wrap classes which contain EmptyStatement', () => {
92-
const input = tags.stripIndent`
93-
let JigsawTrustedHtml = JigsawTrustedHtml_1 = class JigsawTrustedHtml {
94-
constructor(_sanitizer, zone) {
95-
}
96-
static _getContext(magicNumber) {
97-
return JigsawTrustedHtml_1._contexts[magicNumber];
98-
}
99-
};
100-
JigsawTrustedHtml.ɵfac = function JigsawTrustedHtml_Factory(t) { };
101-
// NGCC outputs an empty statement sometimes like the below:
102-
// https://github.com/angular/angular-cli/issues/16509#issuecomment-570198398
103-
JigsawTrustedHtml.ɵdir = ɵngcc0.ɵɵdefineDirective(); ;
104-
JigsawTrustedHtml.ctorParameters = () => [
105-
{ type: DomSanitizer },
106-
{ type: NgZone }
107-
];
108-
`;
109-
110-
const output = tags.stripIndent`
111-
let JigsawTrustedHtml = /*@__PURE__*/ (() => {
112-
${input}
113-
114-
return JigsawTrustedHtml;
115-
})();
116-
`;
117-
118-
expect(tags.oneLine`${transform(input)}`).toEqual(tags.oneLine`${output}`);
119-
});
120-
12191
it('should not wrap enum like which are inside of methods', () => {
12292
const input = tags.stripIndent`
12393
class LayoutDirective {

0 commit comments

Comments
 (0)