From 67280b6fb07ee06757c8d4c61c5e341031bbb3c2 Mon Sep 17 00:00:00 2001 From: David Sherret Date: Fri, 3 Dec 2021 21:35:16 -0500 Subject: [PATCH] fix(es/typescript): Run `resolver` before `typescript::strip` (#2951) swc_ecma_transforms_base: - `resolver`: Handle some typescript nodes. swc_ecma_transforms_typescript: - `strip`: Use identifier span hygiene information for stripping types. --- crates/swc/benches/typescript.rs | 10 +- crates/swc/src/config/mod.rs | 6 +- .../tests/fixture/issue-1160/output/entry.ts | 6 +- .../fixture/issue-1515/case1/output/input.ts | 8 +- .../tests/fixture/issue-2214/output/index.tsx | 2 +- .../input.ts/es2015.1.normal/output.js | 6 +- .../input.ts/es2015.2.minified/output.js | 10 +- .../input.ts/es5.1.normal/output.js | 2 +- .../input.ts/es5.2.minified/output.js | 2 +- .../input.ts/es2015.1.normal/output.js | 4 +- .../input.ts/es5.1.normal/output.js | 4 +- .../input.ts/es5.2.minified/output.js | 5 +- .../input.ts/es2015.1.normal/output.js | 6 +- .../input.ts/es5.1.normal/output.js | 6 +- .../input.ts/es5.2.minified/output.js | 7 +- .../input.ts/es2015.1.normal/output.js | 10 +- .../input.ts/es5.1.normal/output.js | 10 +- .../input.ts/es5.2.minified/output.js | 10 +- .../input.ts/es2015.1.normal/output.js | 8 +- .../input.ts/es2015.2.minified/output.js | 8 +- .../input.ts/es5.1.normal/output.js | 8 +- .../input.ts/es5.2.minified/output.js | 8 +- .../input.ts/es2015.1.normal/output.js | 8 +- .../input.ts/es2015.2.minified/output.js | 8 +- .../input.ts/es5.1.normal/output.js | 8 +- .../input.ts/es5.2.minified/output.js | 8 +- .../input.ts/es2015.1.normal/output.js | 4 +- .../input.ts/es2015.2.minified/output.js | 6 +- .../input.ts/es5.1.normal/output.js | 4 +- .../input.ts/es5.2.minified/output.js | 6 +- .../input.ts/es2015.1.normal/output.js | 4 +- .../input.ts/es2015.2.minified/output.js | 6 +- .../input.ts/es5.1.normal/output.js | 4 +- .../input.ts/es5.2.minified/output.js | 6 +- .../input.ts/es2015.1.normal/output.js | 4 +- .../input.ts/es2015.2.minified/output.js | 6 +- .../input.ts/es5.1.normal/output.js | 4 +- .../input.ts/es5.2.minified/output.js | 6 +- .../input.ts/es2015.1.normal/output.js | 4 +- .../input.ts/es2015.2.minified/output.js | 6 +- .../input.ts/es5.1.normal/output.js | 4 +- .../input.ts/es5.2.minified/output.js | 6 +- .../input.ts/es2015.1.normal/output.js | 6 +- .../input.ts/es2015.2.minified/output.js | 6 +- .../input.ts/es5.1.normal/output.js | 6 +- .../input.ts/es5.2.minified/output.js | 6 +- .../input.ts/es2015.1.normal/output.js | 4 +- .../input.ts/es2015.2.minified/output.js | 6 +- .../input.ts/es5.1.normal/output.js | 4 +- .../input.ts/es5.2.minified/output.js | 4 +- .../input.ts/es2015.1.normal/output.js | 4 +- .../input.ts/es2015.2.minified/output.js | 6 +- .../input.ts/es5.1.normal/output.js | 4 +- .../input.ts/es5.2.minified/output.js | 4 +- .../input.ts/es2015.1.normal/output.js | 4 +- .../input.ts/es2015.2.minified/output.js | 6 +- .../input.ts/es5.1.normal/output.js | 4 +- .../input.ts/es5.2.minified/output.js | 4 +- .../input.ts/es2015.1.normal/output.js | 12 +- .../input.ts/es2015.2.minified/output.js | 8 +- .../input.ts/es5.1.normal/output.js | 12 +- .../input.ts/es5.2.minified/output.js | 8 +- .../input.ts/es2015.1.normal/output.js | 12 +- .../input.ts/es2015.2.minified/output.js | 8 +- .../input.ts/es5.1.normal/output.js | 12 +- .../input.ts/es5.2.minified/output.js | 8 +- .../input.ts/es2015.1.normal/output.js | 12 +- .../input.ts/es2015.2.minified/output.js | 8 +- .../input.ts/es5.1.normal/output.js | 12 +- .../input.ts/es5.2.minified/output.js | 8 +- .../input.ts/es2015.1.normal/output.js | 4 +- .../input.ts/es2015.2.minified/output.js | 6 +- .../for-of47/input.ts/es5.1.normal/output.js | 4 +- .../input.ts/es5.2.minified/output.js | 6 +- .../input.ts/es2015.1.normal/output.js | 4 +- .../input.ts/es2015.2.minified/output.js | 6 +- .../for-of48/input.ts/es5.1.normal/output.js | 4 +- .../input.ts/es5.2.minified/output.js | 6 +- .../input.ts/es2015.1.normal/output.js | 16 +- .../input.ts/es2015.2.minified/output.js | 8 +- .../input.ts/es5.1.normal/output.js | 16 +- .../input.ts/es5.2.minified/output.js | 12 +- .../input.ts/es2015.1.normal/output.js | 16 +- .../input.ts/es2015.2.minified/output.js | 8 +- .../input.ts/es5.1.normal/output.js | 16 +- .../input.ts/es5.2.minified/output.js | 12 +- .../input.ts/es2015.1.normal/output.js | 16 +- .../input.ts/es2015.2.minified/output.js | 8 +- .../input.ts/es5.1.normal/output.js | 16 +- .../input.ts/es5.2.minified/output.js | 12 +- .../input.ts/es2015.1.normal/output.js | 16 +- .../input.ts/es2015.2.minified/output.js | 9 +- .../input.ts/es5.1.normal/output.js | 16 +- .../input.ts/es5.2.minified/output.js | 9 +- .../input.ts/es2015.1.normal/output.js | 16 +- .../input.ts/es2015.2.minified/output.js | 9 +- .../input.ts/es5.1.normal/output.js | 16 +- .../input.ts/es5.2.minified/output.js | 9 +- .../input.ts/es2015.1.normal/output.js | 16 +- .../input.ts/es2015.2.minified/output.js | 9 +- .../input.ts/es5.1.normal/output.js | 16 +- .../input.ts/es5.2.minified/output.js | 9 +- .../input.ts/es2015.1.normal/output.js | 8 +- .../input.ts/es2015.2.minified/output.js | 6 +- .../input.ts/es5.1.normal/output.js | 8 +- .../input.ts/es5.2.minified/output.js | 6 +- .../input.ts/es2015.1.normal/output.js | 6 +- .../input.ts/es2015.2.minified/output.js | 6 +- .../input.ts/es5.1.normal/output.js | 6 +- .../input.ts/es5.2.minified/output.js | 6 +- .../input.ts/es2015.1.normal/output.js | 6 +- .../input.ts/es2015.2.minified/output.js | 6 +- .../input.ts/es5.1.normal/output.js | 6 +- .../input.ts/es5.2.minified/output.js | 6 +- .../input.ts/es2015.1.normal/output.js | 12 +- .../input.ts/es2015.2.minified/output.js | 8 +- .../input.ts/es5.1.normal/output.js | 12 +- .../input.ts/es5.2.minified/output.js | 8 +- .../input.ts/es2015.1.normal/output.js | 8 +- .../input.ts/es2015.2.minified/output.js | 6 +- .../input.ts/es5.1.normal/output.js | 8 +- .../input.ts/es5.2.minified/output.js | 6 +- .../input.ts/es2015.1.normal/output.js | 6 +- .../input.ts/es2015.2.minified/output.js | 6 +- .../input.ts/es5.1.normal/output.js | 6 +- .../input.ts/es5.2.minified/output.js | 6 +- .../input.ts/es2015.1.normal/output.js | 6 +- .../input.ts/es2015.2.minified/output.js | 6 +- .../input.ts/es5.1.normal/output.js | 6 +- .../input.ts/es5.2.minified/output.js | 6 +- .../input.ts/es2015.1.normal/output.js | 32 +-- .../input.ts/es2015.2.minified/output.js | 8 +- .../input.ts/es5.1.normal/output.js | 32 +-- .../input.ts/es5.2.minified/output.js | 26 +-- .../input.ts/es2015.1.normal/output.js | 6 +- .../input.ts/es2015.2.minified/output.js | 6 +- .../input.ts/es5.1.normal/output.js | 6 +- .../input.ts/es5.2.minified/output.js | 6 +- .../input.ts/es2015.1.normal/output.js | 8 +- .../input.ts/es2015.2.minified/output.js | 6 +- .../input.ts/es5.1.normal/output.js | 8 +- .../input.ts/es5.2.minified/output.js | 6 +- .../input.ts/es2015.1.normal/output.js | 6 +- .../input.ts/es2015.2.minified/output.js | 6 +- .../input.ts/es5.1.normal/output.js | 6 +- .../input.ts/es5.2.minified/output.js | 6 +- .../input.ts/es2015.1.normal/output.js | 8 +- .../input.ts/es2015.2.minified/output.js | 6 +- .../input.ts/es5.1.normal/output.js | 8 +- .../input.ts/es5.2.minified/output.js | 6 +- .../input.ts/es2015.1.normal/output.js | 6 +- .../input.ts/es2015.2.minified/output.js | 6 +- .../input.ts/es5.1.normal/output.js | 6 +- .../input.ts/es5.2.minified/output.js | 6 +- .../input.ts/es2015.1.normal/output.js | 8 +- .../input.ts/es2015.2.minified/output.js | 6 +- .../input.ts/es5.1.normal/output.js | 8 +- .../input.ts/es5.2.minified/output.js | 6 +- .../input.ts/es2015.1.normal/output.js | 8 +- .../input.ts/es2015.2.minified/output.js | 6 +- .../input.ts/es5.1.normal/output.js | 8 +- .../input.ts/es5.2.minified/output.js | 6 +- .../input.ts/es2015.1.normal/output.js | 8 +- .../input.ts/es2015.2.minified/output.js | 6 +- .../input.ts/es5.1.normal/output.js | 8 +- .../input.ts/es5.2.minified/output.js | 6 +- .../input.ts/es2015.1.normal/output.js | 12 +- .../input.ts/es2015.2.minified/output.js | 8 +- .../input.ts/es5.1.normal/output.js | 12 +- .../input.ts/es5.2.minified/output.js | 8 +- .../input.ts/es2015.1.normal/output.js | 8 +- .../input.ts/es2015.2.minified/output.js | 6 +- .../input.ts/es5.1.normal/output.js | 8 +- .../input.ts/es5.2.minified/output.js | 6 +- .../input.ts/es2015.1.normal/output.js | 6 +- .../input.ts/es2015.2.minified/output.js | 6 +- .../input.ts/es5.1.normal/output.js | 6 +- .../input.ts/es5.2.minified/output.js | 6 +- .../input.ts/es2015.1.normal/output.js | 8 +- .../input.ts/es2015.2.minified/output.js | 6 +- .../input.ts/es5.1.normal/output.js | 8 +- .../input.ts/es5.2.minified/output.js | 6 +- .../input.ts/es2015.1.normal/output.js | 6 +- .../input.ts/es2015.2.minified/output.js | 6 +- .../input.ts/es5.1.normal/output.js | 6 +- .../input.ts/es5.2.minified/output.js | 6 +- .../input.ts/es2015.1.normal/output.js | 12 +- .../input.ts/es2015.2.minified/output.js | 8 +- .../input.ts/es5.1.normal/output.js | 12 +- .../input.ts/es5.2.minified/output.js | 8 +- .../input.ts/es2015.1.normal/output.js | 8 +- .../input.ts/es2015.2.minified/output.js | 6 +- .../input.ts/es5.1.normal/output.js | 8 +- .../input.ts/es5.2.minified/output.js | 6 +- .../input.ts/es2015.1.normal/output.js | 6 +- .../input.ts/es2015.2.minified/output.js | 6 +- .../input.ts/es5.1.normal/output.js | 6 +- .../input.ts/es5.2.minified/output.js | 6 +- .../input.ts/es2015.1.normal/output.js | 6 +- .../input.ts/es2015.2.minified/output.js | 6 +- .../input.ts/es5.1.normal/output.js | 6 +- .../input.ts/es5.2.minified/output.js | 6 +- .../input.ts/es2015.1.normal/output.js | 8 +- .../input.ts/es2015.2.minified/output.js | 4 +- .../input.ts/es5.1.normal/output.js | 8 +- .../input.ts/es5.2.minified/output.js | 4 +- .../input.ts/es2015.1.normal/output.js | 8 +- .../input.ts/es2015.2.minified/output.js | 4 +- .../input.ts/es5.1.normal/output.js | 8 +- .../input.ts/es5.2.minified/output.js | 4 +- .../input.ts/es2015.1.normal/output.js | 8 +- .../input.ts/es2015.2.minified/output.js | 6 +- .../input.ts/es5.1.normal/output.js | 8 +- .../input.ts/es5.2.minified/output.js | 6 +- .../input.ts/es2015.1.normal/output.js | 8 +- .../input.ts/es2015.2.minified/output.js | 4 +- .../input.ts/es5.1.normal/output.js | 8 +- .../input.ts/es5.2.minified/output.js | 4 +- .../input.ts/es2015.1.normal/output.js | 8 +- .../input.ts/es2015.2.minified/output.js | 4 +- .../input.ts/es5.1.normal/output.js | 8 +- .../input.ts/es5.2.minified/output.js | 4 +- .../input.ts/es2015.1.normal/output.js | 8 +- .../input.ts/es2015.2.minified/output.js | 4 +- .../input.ts/es5.1.normal/output.js | 8 +- .../input.ts/es5.2.minified/output.js | 4 +- .../input.ts/es2015.1.normal/output.js | 8 +- .../input.ts/es2015.2.minified/output.js | 6 +- .../input.ts/es5.1.normal/output.js | 8 +- .../input.ts/es5.2.minified/output.js | 6 +- .../input.ts/es2015.1.normal/output.js | 4 +- .../input.ts/es2015.2.minified/output.js | 6 +- .../input.ts/es5.1.normal/output.js | 4 +- .../input.ts/es5.2.minified/output.js | 6 +- .../input.ts/es2015.1.normal/output.js | 6 +- .../input.ts/es2015.2.minified/output.js | 4 +- .../input.ts/es5.1.normal/output.js | 6 +- .../input.ts/es5.2.minified/output.js | 4 +- .../input.ts/es2015.1.normal/output.js | 8 +- .../input.ts/es2015.2.minified/output.js | 6 +- .../input.ts/es5.1.normal/output.js | 8 +- .../input.ts/es5.2.minified/output.js | 6 +- .../input.ts/es2015.1.normal/output.js | 8 +- .../input.ts/es2015.2.minified/output.js | 18 +- .../input.ts/es5.1.normal/output.js | 8 +- .../input.ts/es5.2.minified/output.js | 18 +- .../input.ts/es2015.1.normal/output.js | 2 +- .../input.ts/es2015.1.normal/output.js | 10 +- .../input.ts/es2015.2.minified/output.js | 10 +- .../input.ts/es5.1.normal/output.js | 10 +- .../input.ts/es5.2.minified/output.js | 6 +- .../input.ts/es2015.1.normal/output.js | 8 +- .../input.ts/es2015.2.minified/output.js | 6 +- .../input.ts/es5.1.normal/output.js | 8 +- .../input.ts/es5.2.minified/output.js | 6 +- .../input.ts/es2015.1.normal/output.js | 2 +- .../input.ts/es2015.2.minified/output.js | 3 +- .../input.ts/es2015.1.normal/output.js | 2 +- .../input.ts/es2015.2.minified/output.js | 7 +- .../input.ts/es2015.1.normal/output.js | 8 +- .../input.ts/es2015.2.minified/output.js | 6 +- .../input.ts/es5.1.normal/output.js | 8 +- .../input.ts/es5.2.minified/output.js | 6 +- .../input.ts/es2015.1.normal/output.js | 8 +- .../input.ts/es2015.2.minified/output.js | 6 +- .../input.ts/es5.1.normal/output.js | 8 +- .../input.ts/es5.2.minified/output.js | 6 +- .../input.ts/es2015.1.normal/output.js | 8 +- .../input.ts/es2015.2.minified/output.js | 6 +- .../input.ts/es5.1.normal/output.js | 8 +- .../input.ts/es5.2.minified/output.js | 6 +- .../input.ts/es2015.1.normal/output.js | 8 +- .../input.ts/es2015.2.minified/output.js | 6 +- .../input.ts/es5.1.normal/output.js | 8 +- .../input.ts/es5.2.minified/output.js | 6 +- .../input.ts/es2015.1.normal/output.js | 8 +- .../input.ts/es2015.2.minified/output.js | 6 +- .../input.ts/es5.1.normal/output.js | 8 +- .../input.ts/es5.2.minified/output.js | 6 +- .../input.ts/es2015.1.normal/output.js | 8 +- .../input.ts/es2015.2.minified/output.js | 6 +- .../input.ts/es5.1.normal/output.js | 8 +- .../input.ts/es5.2.minified/output.js | 6 +- .../input.ts/es2015.1.normal/output.js | 8 +- .../input.ts/es2015.2.minified/output.js | 6 +- .../input.ts/es5.1.normal/output.js | 8 +- .../input.ts/es5.2.minified/output.js | 6 +- .../input.ts/es2015.1.normal/output.js | 8 +- .../input.ts/es2015.2.minified/output.js | 6 +- .../input.ts/es5.1.normal/output.js | 8 +- .../input.ts/es5.2.minified/output.js | 6 +- .../input.ts/es2015.1.normal/output.js | 8 +- .../input.ts/es2015.2.minified/output.js | 6 +- .../input.ts/es5.1.normal/output.js | 8 +- .../input.ts/es5.2.minified/output.js | 8 +- .../input.ts/es2015.1.normal/output.js | 8 +- .../input.ts/es2015.2.minified/output.js | 6 +- .../input.ts/es5.1.normal/output.js | 8 +- .../input.ts/es5.2.minified/output.js | 6 +- .../input.ts/es2015.1.normal/output.js | 6 +- .../input.ts/es2015.2.minified/output.js | 9 +- .../input.ts/es5.1.normal/output.js | 4 +- .../input.ts/es5.2.minified/output.js | 6 +- .../input.ts/es2015.1.normal/output.js | 4 +- .../input.ts/es2015.2.minified/output.js | 6 +- .../input.ts/es5.1.normal/output.js | 4 +- .../input.ts/es5.2.minified/output.js | 6 +- .../input.ts/es2015.1.normal/output.js | 8 +- .../input.ts/es2015.2.minified/output.js | 6 +- .../input.ts/es5.1.normal/output.js | 8 +- .../input.ts/es5.2.minified/output.js | 6 +- .../input.ts/es2015.1.normal/output.js | 8 +- .../input.ts/es2015.2.minified/output.js | 4 +- .../input.ts/es5.1.normal/output.js | 8 +- .../input.ts/es5.2.minified/output.js | 5 +- .../input.ts/es2015.1.normal/output.js | 8 +- .../input.ts/es2015.2.minified/output.js | 4 +- .../input.ts/es5.1.normal/output.js | 8 +- .../input.ts/es5.2.minified/output.js | 5 +- .../input.ts/es2015.1.normal/output.js | 16 +- .../input.ts/es2015.2.minified/output.js | 8 +- .../input.ts/es5.1.normal/output.js | 16 +- .../input.ts/es5.2.minified/output.js | 11 +- .../input.ts/es2015.1.normal/output.js | 8 +- .../input.ts/es2015.2.minified/output.js | 8 +- .../input.ts/es5.1.normal/output.js | 8 +- .../input.ts/es5.2.minified/output.js | 8 +- .../input.ts/es2015.1.normal/output.js | 16 +- .../input.ts/es2015.2.minified/output.js | 8 +- .../input.ts/es5.1.normal/output.js | 16 +- .../input.ts/es5.2.minified/output.js | 11 +- .../input.ts/es2015.1.normal/output.js | 8 +- .../input.ts/es2015.2.minified/output.js | 8 +- .../input.ts/es5.1.normal/output.js | 8 +- .../input.ts/es5.2.minified/output.js | 8 +- .../input.ts/es2015.1.normal/output.js | 8 +- .../input.ts/es2015.2.minified/output.js | 6 +- .../input.ts/es5.1.normal/output.js | 8 +- .../input.ts/es5.2.minified/output.js | 6 +- .../input.ts/es2015.1.normal/output.js | 2 +- .../input.ts/es2015.2.minified/output.js | 5 +- .../input.ts/es2015.1.normal/output.js | 4 +- .../input.ts/es2015.2.minified/output.js | 2 +- .../input.ts/es5.1.normal/output.js | 4 +- .../input.ts/es5.2.minified/output.js | 2 +- .../input.ts/es2015.1.normal/output.js | 12 +- .../input.ts/es2015.2.minified/output.js | 6 +- .../input.ts/es5.1.normal/output.js | 12 +- .../input.ts/es5.2.minified/output.js | 10 +- .../input.ts/es2015.1.normal/output.js | 2 +- .../input.ts/es2015.2.minified/output.js | 5 +- .../input.ts/es2015.1.normal/output.js | 12 +- .../input.ts/es2015.2.minified/output.js | 10 +- .../input.ts/es5.1.normal/output.js | 12 +- .../input.ts/es5.2.minified/output.js | 12 +- .../input.ts/es2015.1.normal/output.js | 10 +- .../input.ts/es2015.2.minified/output.js | 13 +- .../input.ts/es5.1.normal/output.js | 8 +- .../input.ts/es5.2.minified/output.js | 12 +- .../input.ts/es2015.1.normal/output.js | 6 +- .../input.ts/es2015.2.minified/output.js | 8 +- .../input.ts/es5.1.normal/output.js | 4 +- .../input.ts/es5.2.minified/output.js | 6 +- .../input.ts/es2015.1.normal/output.js | 2 +- .../input.ts/es2015.2.minified/output.js | 3 +- .../input.ts/es2015.1.normal/output.js | 8 +- .../input.ts/es2015.2.minified/output.js | 6 +- .../input.ts/es5.1.normal/output.js | 8 +- .../input.ts/es5.2.minified/output.js | 6 +- .../input.ts/es2015.1.normal/output.js | 8 +- .../input.ts/es2015.2.minified/output.js | 6 +- .../input.ts/es5.1.normal/output.js | 8 +- .../input.ts/es5.2.minified/output.js | 6 +- .../input.ts/es2015.1.normal/output.js | 4 +- .../input.ts/es2015.2.minified/output.js | 6 +- .../input.ts/es5.1.normal/output.js | 4 +- .../input.ts/es5.2.minified/output.js | 6 +- .../input.ts/es2015.1.normal/output.js | 10 +- .../input.ts/es2015.2.minified/output.js | 8 +- .../input.ts/es5.1.normal/output.js | 10 +- .../input.ts/es5.2.minified/output.js | 12 +- .../input.ts/es2015.1.normal/output.js | 12 +- .../input.ts/es2015.2.minified/output.js | 15 +- .../input.ts/es5.1.normal/output.js | 6 +- .../input.ts/es5.2.minified/output.js | 15 +- .../input.ts/es2015.1.normal/output.js | 6 +- .../input.ts/es2015.2.minified/output.js | 15 +- .../input.ts/es5.1.normal/output.js | 6 +- .../input.ts/es5.2.minified/output.js | 15 +- .../input.ts/es2015.1.normal/output.js | 6 +- .../input.ts/es2015.2.minified/output.js | 8 +- .../input.ts/es5.1.normal/output.js | 6 +- .../input.ts/es5.2.minified/output.js | 12 +- .../input.ts/es2015.1.normal/output.js | 16 +- .../input.ts/es2015.2.minified/output.js | 15 +- .../input.ts/es5.1.normal/output.js | 10 +- .../input.ts/es5.2.minified/output.js | 15 +- .../input.ts/es2015.1.normal/output.js | 4 +- .../input.ts/es2015.2.minified/output.js | 2 +- .../input.ts/es2015.1.normal/output.js | 8 +- .../input.ts/es2015.2.minified/output.js | 19 +- .../input.ts/es5.1.normal/output.js | 6 +- .../input.ts/es5.2.minified/output.js | 6 +- .../input.ts/es2015.1.normal/output.js | 4 +- .../input.ts/es2015.2.minified/output.js | 7 +- .../input.ts/es2015.1.normal/output.js | 6 +- .../input.ts/es2015.2.minified/output.js | 28 ++- .../input.ts/es5.1.normal/output.js | 4 +- .../input.ts/es5.2.minified/output.js | 4 +- .../input.ts/es2015.1.normal/output.js | 6 +- .../input.ts/es2015.2.minified/output.js | 5 +- .../input.ts/es2015.1.normal/output.js | 14 +- .../input.ts/es2015.2.minified/output.js | 33 +-- .../input.ts/es5.1.normal/output.js | 10 +- .../input.ts/es5.2.minified/output.js | 8 +- .../input.ts/es2015.1.normal/output.js | 6 +- .../input.ts/es2015.2.minified/output.js | 26 ++- .../input.ts/es5.1.normal/output.js | 4 +- .../input.ts/es5.2.minified/output.js | 4 +- .../input.ts/es2015.1.normal/output.js | 16 +- .../input.ts/es2015.2.minified/output.js | 18 +- .../input.ts/es5.1.normal/output.js | 20 +- .../input.ts/es5.2.minified/output.js | 12 +- .../input.ts/es2015.1.normal/output.js | 7 - .../input.ts/es5.1.normal/output.js | 7 - .../input.ts/es2015.1.normal/output.js | 5 +- .../input.ts/es2015.2.minified/output.js | 2 +- .../input.ts/es5.1.normal/output.js | 1 + .../input.ts/es5.2.minified/output.js | 2 +- .../input.ts/es2015.1.normal/output.js | 2 +- .../input.ts/es2015.2.minified/output.js | 7 +- .../input.ts/es2015.1.normal/output.js | 7 +- .../input.ts/es2015.2.minified/output.js | 8 +- .../input.ts/es5.1.normal/output.js | 7 +- .../input.ts/es5.2.minified/output.js | 7 +- .../input.ts/es2015.1.normal/output.js | 10 +- .../input.ts/es2015.2.minified/output.js | 11 +- .../input.ts/es5.1.normal/output.js | 10 +- .../input.ts/es5.2.minified/output.js | 8 +- .../input.ts/es2015.1.normal/output.js | 6 +- .../input.ts/es2015.2.minified/output.js | 6 +- .../input.ts/es5.1.normal/output.js | 6 +- .../input.ts/es5.2.minified/output.js | 6 +- .../input.ts/es2015.1.normal/output.js | 16 +- .../input.ts/es2015.2.minified/output.js | 23 +- .../input.ts/es5.1.normal/output.js | 32 +-- .../input.ts/es5.2.minified/output.js | 34 +-- .../input.ts/es2015.1.normal/output.js | 6 +- .../input.ts/es2015.2.minified/output.js | 7 +- .../input.ts/es5.1.normal/output.js | 6 +- .../input.ts/es5.2.minified/output.js | 6 +- .../input.ts/es2015.1.normal/output.js | 4 +- .../input.ts/es2015.2.minified/output.js | 5 +- .../input.ts/es2015.1.normal/output.js | 4 +- .../input.ts/es2015.2.minified/output.js | 5 +- .../input.ts/es2015.1.normal/output.js | 2 +- .../input.ts/es2015.2.minified/output.js | 2 +- .../input.tsx/es2015.1.normal/output.js | 8 +- .../input.tsx/es2015.2.minified/output.js | 13 +- .../input.tsx/es5.1.normal/output.js | 6 +- .../input.tsx/es5.2.minified/output.js | 7 +- .../input.tsx/es2015.1.normal/output.js | 4 +- .../input.tsx/es2015.2.minified/output.js | 4 +- .../input.tsx/es5.1.normal/output.js | 4 +- .../input.tsx/es5.2.minified/output.js | 4 +- .../input.tsx/es2015.1.normal/output.js | 2 +- .../input.tsx/es2015.2.minified/output.js | 3 +- .../input.tsx/es5.1.normal/output.js | 2 +- .../input.tsx/es5.2.minified/output.js | 3 +- .../input.ts/es2015.1.normal/output.js | 10 +- .../input.ts/es2015.2.minified/output.js | 6 +- .../input.ts/es5.1.normal/output.js | 10 +- .../input.ts/es5.2.minified/output.js | 6 +- .../input.ts/es2015.1.normal/output.js | 10 +- .../input.ts/es2015.2.minified/output.js | 6 +- .../input.ts/es5.1.normal/output.js | 10 +- .../input.ts/es5.2.minified/output.js | 6 +- .../input.ts/es2015.1.normal/output.js | 8 +- .../input.ts/es2015.2.minified/output.js | 6 +- .../input.ts/es5.1.normal/output.js | 8 +- .../input.ts/es5.2.minified/output.js | 6 +- .../input.ts/es2015.1.normal/output.js | 6 +- .../input.ts/es2015.2.minified/output.js | 6 +- .../input.ts/es5.1.normal/output.js | 6 +- .../input.ts/es5.2.minified/output.js | 6 +- .../input.ts/es2015.1.normal/output.js | 4 +- .../input.ts/es2015.2.minified/output.js | 6 +- .../input.ts/es5.1.normal/output.js | 4 +- .../input.ts/es5.2.minified/output.js | 6 +- .../input.ts/es2015.1.normal/output.js | 10 +- .../input.ts/es2015.2.minified/output.js | 6 +- .../input.ts/es5.1.normal/output.js | 10 +- .../input.ts/es5.2.minified/output.js | 6 +- .../input.ts/es2015.1.normal/output.js | 10 +- .../input.ts/es2015.2.minified/output.js | 6 +- .../input.ts/es5.1.normal/output.js | 10 +- .../input.ts/es5.2.minified/output.js | 6 +- .../input.ts/es2015.1.normal/output.js | 4 +- .../input.ts/es2015.2.minified/output.js | 6 +- .../input.ts/es5.1.normal/output.js | 4 +- .../input.ts/es5.2.minified/output.js | 6 +- .../input.ts/es2015.1.normal/output.js | 4 +- .../input.ts/es2015.2.minified/output.js | 6 +- .../input.ts/es5.1.normal/output.js | 4 +- .../input.ts/es5.2.minified/output.js | 6 +- .../input.ts/es2015.1.normal/output.js | 2 +- .../input.ts/es2015.2.minified/output.js | 2 +- .../input.ts/es2015.1.normal/output.js | 216 +++++++++--------- .../input.ts/es2015.2.minified/output.js | 10 +- .../input.ts/es5.1.normal/output.js | 214 ++++++++--------- .../input.ts/es5.2.minified/output.js | 10 +- .../input.ts/es2015.1.normal/output.js | 12 +- .../input.ts/es2015.2.minified/output.js | 8 +- .../input.ts/es5.1.normal/output.js | 12 +- .../input.ts/es5.2.minified/output.js | 6 +- .../input.ts/es2015.1.normal/output.js | 62 ++--- .../input.ts/es2015.2.minified/output.js | 62 +++-- .../input.ts/es5.1.normal/output.js | 62 ++--- .../input.ts/es5.2.minified/output.js | 34 +-- .../input.ts/es2015.1.normal/output.js | 10 +- .../input.ts/es2015.2.minified/output.js | 7 +- .../input.ts/es5.1.normal/output.js | 10 +- .../input.ts/es5.2.minified/output.js | 6 +- .../input.ts/es2015.1.normal/output.js | 22 +- .../input.ts/es2015.2.minified/output.js | 10 +- .../input.ts/es5.1.normal/output.js | 22 +- .../input.ts/es5.2.minified/output.js | 10 +- .../input.ts/es2015.1.normal/output.js | 6 +- .../input.ts/es2015.2.minified/output.js | 6 +- .../input.ts/es5.1.normal/output.js | 6 +- .../input.ts/es5.2.minified/output.js | 6 +- .../input.ts/es2015.1.normal/output.js | 6 +- .../input.ts/es2015.2.minified/output.js | 6 +- .../input.ts/es5.1.normal/output.js | 6 +- .../input.ts/es5.2.minified/output.js | 8 +- .../input.ts/es2015.1.normal/output.js | 4 +- .../input.ts/es2015.2.minified/output.js | 6 +- .../input.ts/es5.1.normal/output.js | 4 +- .../input.ts/es5.2.minified/output.js | 6 +- .../input.ts/es2015.1.normal/output.js | 4 +- .../input.ts/es2015.2.minified/output.js | 6 +- .../input.ts/es5.1.normal/output.js | 4 +- .../input.ts/es5.2.minified/output.js | 6 +- .../input.ts/es2015.1.normal/output.js | 14 +- .../input.ts/es2015.2.minified/output.js | 6 +- .../input.ts/es5.1.normal/output.js | 14 +- .../input.ts/es5.2.minified/output.js | 6 +- .../input.ts/es2015.1.normal/output.js | 14 +- .../input.ts/es2015.2.minified/output.js | 8 +- .../input.ts/es5.1.normal/output.js | 14 +- .../input.ts/es5.2.minified/output.js | 8 +- .../input.ts/es2015.1.normal/output.js | 8 +- .../input.ts/es2015.2.minified/output.js | 6 +- .../input.ts/es5.1.normal/output.js | 8 +- .../input.ts/es5.2.minified/output.js | 6 +- .../input.ts/es2015.1.normal/output.js | 8 +- .../input.ts/es2015.2.minified/output.js | 6 +- .../input.ts/es5.1.normal/output.js | 8 +- .../input.ts/es5.2.minified/output.js | 6 +- .../input.ts/es2015.1.normal/output.js | 8 +- .../input.ts/es2015.2.minified/output.js | 6 +- .../input.ts/es5.1.normal/output.js | 8 +- .../input.ts/es5.2.minified/output.js | 6 +- .../input.ts/es2015.1.normal/output.js | 6 +- .../input.ts/es2015.2.minified/output.js | 6 +- .../input.ts/es5.1.normal/output.js | 6 +- .../input.ts/es5.2.minified/output.js | 6 +- .../input.ts/es2015.1.normal/output.js | 8 +- .../input.ts/es2015.2.minified/output.js | 6 +- .../input.ts/es5.1.normal/output.js | 8 +- .../input.ts/es5.2.minified/output.js | 6 +- .../input.ts/es2015.1.normal/output.js | 8 +- .../input.ts/es2015.2.minified/output.js | 6 +- .../input.ts/es5.1.normal/output.js | 8 +- .../input.ts/es5.2.minified/output.js | 6 +- .../input.ts/es2015.1.normal/output.js | 8 +- .../input.ts/es2015.2.minified/output.js | 6 +- .../input.ts/es5.1.normal/output.js | 8 +- .../input.ts/es5.2.minified/output.js | 6 +- .../input.ts/es2015.1.normal/output.js | 8 +- .../input.ts/es2015.2.minified/output.js | 6 +- .../input.ts/es5.1.normal/output.js | 8 +- .../input.ts/es5.2.minified/output.js | 6 +- .../input.ts/es2015.1.normal/output.js | 11 +- .../input.ts/es5.1.normal/output.js | 11 +- .../input.ts/es5.2.minified/output.js | 16 +- .../input.ts/es2015.1.normal/output.js | 10 +- .../input.ts/es2015.2.minified/output.js | 6 +- .../input.ts/es5.1.normal/output.js | 10 +- .../input.ts/es5.2.minified/output.js | 8 +- .../input.ts/es2015.1.normal/output.js | 8 +- .../input.ts/es2015.2.minified/output.js | 6 +- .../input.ts/es5.1.normal/output.js | 8 +- .../input.ts/es5.2.minified/output.js | 6 +- .../input.ts/es2015.1.normal/output.js | 4 +- .../input.ts/es2015.2.minified/output.js | 4 +- .../input.ts/es5.1.normal/output.js | 4 +- .../input.ts/es5.2.minified/output.js | 4 +- .../input.ts/es2015.1.normal/output.js | 12 +- .../input.ts/es2015.2.minified/output.js | 8 +- .../input.ts/es5.1.normal/output.js | 12 +- .../input.ts/es5.2.minified/output.js | 8 +- .../input.ts/es2015.1.normal/output.js | 6 +- .../input.ts/es2015.2.minified/output.js | 6 +- .../input.ts/es5.1.normal/output.js | 6 +- .../input.ts/es5.2.minified/output.js | 6 +- .../input.ts/es2015.1.normal/output.js | 4 +- .../input.ts/es2015.2.minified/output.js | 6 +- .../input.ts/es5.1.normal/output.js | 4 +- .../input.ts/es5.2.minified/output.js | 6 +- .../input.ts/es2015.1.normal/output.js | 4 +- .../input.ts/es2015.2.minified/output.js | 6 +- .../input.ts/es5.1.normal/output.js | 4 +- .../input.ts/es5.2.minified/output.js | 6 +- .../input.ts/es2015.1.normal/output.js | 4 +- .../input.ts/es2015.2.minified/output.js | 6 +- .../input.ts/es5.1.normal/output.js | 4 +- .../input.ts/es5.2.minified/output.js | 6 +- .../input.ts/es2015.1.normal/output.js | 4 +- .../input.ts/es2015.2.minified/output.js | 6 +- .../input.ts/es5.1.normal/output.js | 4 +- .../input.ts/es5.2.minified/output.js | 6 +- .../input.ts/es2015.1.normal/output.js | 4 +- .../input.ts/es2015.2.minified/output.js | 6 +- .../input.ts/es5.1.normal/output.js | 4 +- .../input.ts/es5.2.minified/output.js | 6 +- .../input.ts/es2015.1.normal/output.js | 4 +- .../input.ts/es2015.2.minified/output.js | 6 +- .../input.ts/es5.1.normal/output.js | 4 +- .../input.ts/es5.2.minified/output.js | 6 +- .../input.ts/es2015.1.normal/output.js | 4 +- .../input.ts/es2015.2.minified/output.js | 6 +- .../input.ts/es5.1.normal/output.js | 4 +- .../input.ts/es5.2.minified/output.js | 6 +- .../input.ts/es2015.1.normal/output.js | 4 +- .../input.ts/es2015.2.minified/output.js | 6 +- .../input.ts/es5.1.normal/output.js | 4 +- .../input.ts/es5.2.minified/output.js | 6 +- .../input.ts/es2015.1.normal/output.js | 4 +- .../input.ts/es2015.2.minified/output.js | 6 +- .../input.ts/es5.1.normal/output.js | 4 +- .../input.ts/es5.2.minified/output.js | 5 +- .../input.ts/es2015.1.normal/output.js | 1 + .../input.ts/es5.1.normal/output.js | 1 + .../input.ts/es2015.1.normal/output.js | 8 +- .../input.ts/es2015.2.minified/output.js | 6 +- .../input.ts/es5.1.normal/output.js | 8 +- .../input.ts/es5.2.minified/output.js | 10 +- .../input.ts/es2015.1.normal/output.js | 4 +- .../input.ts/es2015.2.minified/output.js | 6 +- .../input.ts/es5.1.normal/output.js | 4 +- .../input.ts/es5.2.minified/output.js | 6 +- .../input.ts/es2015.1.normal/output.js | 4 +- .../input.ts/es2015.2.minified/output.js | 6 +- .../input.ts/es5.1.normal/output.js | 4 +- .../input.ts/es5.2.minified/output.js | 6 +- .../input.ts/es2015.1.normal/output.js | 4 +- .../input.ts/es2015.2.minified/output.js | 4 +- .../input.ts/es5.1.normal/output.js | 4 +- .../input.ts/es5.2.minified/output.js | 6 +- .../input.ts/es2015.1.normal/output.js | 4 +- .../input.ts/es2015.2.minified/output.js | 6 +- .../input.ts/es5.1.normal/output.js | 4 +- .../input.ts/es5.2.minified/output.js | 6 +- .../input.ts/es2015.1.normal/output.js | 4 +- .../input.ts/es2015.2.minified/output.js | 7 +- .../input.ts/es2015.1.normal/output.js | 4 +- .../input.ts/es2015.2.minified/output.js | 7 +- .../input.ts/es2015.1.normal/output.js | 8 +- .../input.ts/es2015.2.minified/output.js | 6 +- .../input.ts/es5.1.normal/output.js | 8 +- .../input.ts/es5.2.minified/output.js | 6 +- .../input.ts/es2015.1.normal/output.js | 8 +- .../input.ts/es2015.2.minified/output.js | 12 +- .../input.ts/es5.1.normal/output.js | 8 +- .../input.ts/es5.2.minified/output.js | 16 +- .../input.ts/es2015.1.normal/output.js | 4 +- .../input.ts/es2015.2.minified/output.js | 6 +- .../input.ts/es5.1.normal/output.js | 4 +- .../input.ts/es5.2.minified/output.js | 6 +- .../input.ts/es2015.1.normal/output.js | 4 +- .../input.ts/es2015.2.minified/output.js | 4 +- .../input.ts/es5.1.normal/output.js | 4 +- .../input.ts/es5.2.minified/output.js | 6 +- .../input.ts/es2015.1.normal/output.js | 4 +- .../input.ts/es2015.2.minified/output.js | 6 +- .../input.ts/es5.1.normal/output.js | 4 +- .../input.ts/es5.2.minified/output.js | 6 +- .../input.ts/es2015.1.normal/output.js | 4 +- .../input.ts/es2015.2.minified/output.js | 4 +- .../input.ts/es5.1.normal/output.js | 4 +- .../input.ts/es5.2.minified/output.js | 6 +- .../input.ts/es2015.1.normal/output.js | 8 +- .../input.ts/es2015.2.minified/output.js | 14 +- .../input.ts/es5.1.normal/output.js | 8 +- .../input.ts/es5.2.minified/output.js | 14 +- .../input.ts/es2015.1.normal/output.js | 8 +- .../input.ts/es2015.2.minified/output.js | 8 +- .../input.ts/es5.1.normal/output.js | 8 +- .../input.ts/es5.2.minified/output.js | 8 +- .../input.ts/es2015.1.normal/output.js | 4 +- .../input.ts/es2015.2.minified/output.js | 6 +- .../input.ts/es5.1.normal/output.js | 4 +- .../input.ts/es5.2.minified/output.js | 6 +- .../input.ts/es2015.1.normal/output.js | 4 +- .../input.ts/es2015.2.minified/output.js | 6 +- .../input.ts/es5.1.normal/output.js | 4 +- .../input.ts/es5.2.minified/output.js | 4 +- .../input.ts/es2015.1.normal/output.js | 4 +- .../input.ts/es2015.2.minified/output.js | 6 +- .../input.ts/es5.1.normal/output.js | 4 +- .../input.ts/es5.2.minified/output.js | 6 +- .../input.ts/es2015.1.normal/output.js | 4 +- .../input.ts/es2015.2.minified/output.js | 6 +- .../input.ts/es5.1.normal/output.js | 4 +- .../input.ts/es5.2.minified/output.js | 6 +- .../input.ts/es2015.1.normal/output.js | 4 +- .../input.ts/es2015.2.minified/output.js | 6 +- .../input.ts/es5.1.normal/output.js | 4 +- .../input.ts/es5.2.minified/output.js | 6 +- .../input.ts/es2015.1.normal/output.js | 6 +- .../input.ts/es2015.2.minified/output.js | 6 +- .../input.ts/es5.1.normal/output.js | 6 +- .../input.ts/es5.2.minified/output.js | 4 +- .../input.ts/es2015.1.normal/output.js | 4 +- .../input.ts/es2015.2.minified/output.js | 6 +- .../input.ts/es5.1.normal/output.js | 4 +- .../input.ts/es5.2.minified/output.js | 6 +- .../input.ts/es2015.1.normal/output.js | 10 +- .../input.ts/es2015.2.minified/output.js | 8 +- .../input.ts/es5.1.normal/output.js | 10 +- .../input.ts/es5.2.minified/output.js | 8 +- .../input.ts/es2015.1.normal/output.js | 4 +- .../input.ts/es2015.2.minified/output.js | 6 +- .../input.ts/es5.1.normal/output.js | 4 +- .../input.ts/es5.2.minified/output.js | 6 +- .../input.ts/es2015.1.normal/output.js | 4 +- .../input.ts/es2015.2.minified/output.js | 6 +- .../input.ts/es5.1.normal/output.js | 4 +- .../input.ts/es5.2.minified/output.js | 6 +- .../input.ts/es2015.1.normal/output.js | 14 +- .../input.ts/es2015.2.minified/output.js | 28 +-- .../input.ts/es5.1.normal/output.js | 16 +- .../input.ts/es5.2.minified/output.js | 16 +- .../input.ts/es2015.1.normal/output.js | 8 +- .../input.ts/es2015.2.minified/output.js | 8 +- .../input.ts/es5.1.normal/output.js | 8 +- .../input.ts/es5.2.minified/output.js | 8 +- .../input.ts/es2015.1.normal/output.js | 16 +- .../input.ts/es2015.2.minified/output.js | 8 +- .../input.ts/es5.1.normal/output.js | 16 +- .../input.ts/es5.2.minified/output.js | 8 +- crates/swc_bundler/tests/common/mod.rs | 21 +- .../src/compress/optimize/if_return.rs | 3 + .../swc_ecma_transforms/tests/decorators.rs | 132 +++++------ .../src/resolver/mod.rs | 79 +++---- .../tests/common_js.rs | 2 +- .../tests/simplify.rs | 24 +- .../tests/simplify_dce.rs | 66 ++++-- .../tests/simplify_inlining.rs | 53 ++++- .../benches/compat.rs | 14 +- .../examples/ts_to_js.rs | 21 +- .../src/strip.rs | 43 +++- .../tests/fixture/issue-1653/output.js | 8 +- .../tests/fixture/issue-2234/output.js | 2 +- .../fixture/next/server/render/1/output.js | 52 ++--- .../tests/strip.rs | 208 +++++++++++++---- .../tests/strip_correctness.rs | 20 +- crates/swc_estree_compat/benches/babelify.rs | 8 +- crates/swc_node_bundler/benches/bench.rs | 10 +- 770 files changed, 3661 insertions(+), 3269 deletions(-) diff --git a/crates/swc/benches/typescript.rs b/crates/swc/benches/typescript.rs index 0181cc6fd23..09924612f8a 100644 --- a/crates/swc/benches/typescript.rs +++ b/crates/swc/benches/typescript.rs @@ -10,10 +10,10 @@ use std::{ sync::Arc, }; use swc::config::{Config, IsModule, JscConfig, Options, SourceMapsConfig}; -use swc_common::{errors::Handler, FileName, FilePathMapping, SourceFile, SourceMap}; +use swc_common::{errors::Handler, FileName, FilePathMapping, Mark, SourceFile, SourceMap}; use swc_ecma_ast::{EsVersion, Program}; use swc_ecma_parser::{Syntax, TsConfig}; -use swc_ecma_transforms::{fixer, hygiene, resolver, typescript}; +use swc_ecma_transforms::{fixer, hygiene, resolver, resolver_with_mark, typescript}; use swc_ecma_visit::FoldWith; use test::Bencher; @@ -50,8 +50,10 @@ fn parse(c: &swc::Compiler) -> (Arc, Program) { fn as_es(c: &swc::Compiler) -> Program { let program = parse(c).1; - - program.fold_with(&mut typescript::strip()) + let mark = Mark::fresh(Mark::root()); + program + .fold_with(&mut resolver_with_mark(mark)) + .fold_with(&mut typescript::strip(mark)) } #[bench] diff --git a/crates/swc/src/config/mod.rs b/crates/swc/src/config/mod.rs index 3e38570dcb0..aea8866aa32 100644 --- a/crates/swc/src/config/mod.rs +++ b/crates/swc/src/config/mod.rs @@ -365,6 +365,11 @@ impl Options { syntax.decorators() ), import_assertions(), + // Do a resolver pass after decorators as it might + // emit runtime declarations and do it before + // type stripping as we need to know scope information + // for emitting enums and namespaces. + resolver_with_mark(top_level_mark), Optional::new( typescript::strip_with_jsx( cm.clone(), @@ -378,7 +383,6 @@ impl Options { ), syntax.typescript() ), - resolver_with_mark(top_level_mark), crate::plugin::plugins(experimental.plugins), custom_before_pass(&program), // handle jsx diff --git a/crates/swc/tests/fixture/issue-1160/output/entry.ts b/crates/swc/tests/fixture/issue-1160/output/entry.ts index ab5ee70eb6a..133bc1d089a 100644 --- a/crates/swc/tests/fixture/issue-1160/output/entry.ts +++ b/crates/swc/tests/fixture/issue-1160/output/entry.ts @@ -34,9 +34,9 @@ function _initializerDefineProperty(target, property, descriptor, context) { } var _class, _descriptor, _dec, _dec1; var MyEnum; -(function(MyEnum1) { - MyEnum1["x"] = "xxx"; - MyEnum1["y"] = "yyy"; +(function(MyEnum) { + MyEnum["x"] = "xxx"; + MyEnum["y"] = "yyy"; })(MyEnum || (MyEnum = { })); let Xpto = ((_class = class Xpto { diff --git a/crates/swc/tests/fixture/issue-1515/case1/output/input.ts b/crates/swc/tests/fixture/issue-1515/case1/output/input.ts index ebc6430e0d5..aa380e77d7f 100644 --- a/crates/swc/tests/fixture/issue-1515/case1/output/input.ts +++ b/crates/swc/tests/fixture/issue-1515/case1/output/input.ts @@ -11,7 +11,7 @@ class ServiceError extends Error { } exports.ServiceError = ServiceError; (function(ServiceError1) { - var Code1; + let Code; (function(Code) { Code[Code["serviceNotFound"] = 404] = "serviceNotFound"; Code[Code["serviceNotCompatible"] = 426] = "serviceNotCompatible"; @@ -20,13 +20,13 @@ exports.ServiceError = ServiceError; Code[Code["timedOut"] = 504] = "timedOut"; Code[Code["badRequest"] = 400] = "badRequest"; Code[Code["badResponse"] = 422] = "badResponse"; - })(Code1 || (Code1 = { + })(Code || (Code = { })); class ServiceNotFound extends ServiceError { constructor(...args){ super(...args); // Service was probably not registered, or using the wrong channel - this.code = Code1.serviceNotFound; + this.code = Code.serviceNotFound; this.name = "ServiceError.ServiceNotFound"; } } @@ -37,6 +37,6 @@ exports.ServiceError = ServiceError; }; } ServiceError1.toMessageBody = toMessageBody; - ServiceError1.Code = Code1; + ServiceError1.Code = Code; })(ServiceError || (ServiceError = { })); diff --git a/crates/swc/tests/fixture/issue-2214/output/index.tsx b/crates/swc/tests/fixture/issue-2214/output/index.tsx index 7271315caf7..8319ffd644a 100644 --- a/crates/swc/tests/fixture/issue-2214/output/index.tsx +++ b/crates/swc/tests/fixture/issue-2214/output/index.tsx @@ -1,4 +1,4 @@ -import React1 from "react"; +import React from "react"; export var Test; (function(Test1) { Test1.content = /*#__PURE__*/ React.createElement("div", null, "Content"); diff --git a/crates/swc/tests/tsc-references/classes/classDeclarations/classHeritageSpecification/classExtendsItselfIndirectly2/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/classes/classDeclarations/classHeritageSpecification/classExtendsItselfIndirectly2/input.ts/es2015.1.normal/output.js index 6cd4d99fab2..17cbb7a22b4 100644 --- a/crates/swc/tests/tsc-references/classes/classDeclarations/classHeritageSpecification/classExtendsItselfIndirectly2/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/classes/classDeclarations/classHeritageSpecification/classExtendsItselfIndirectly2/input.ts/es2015.1.normal/output.js @@ -16,16 +16,16 @@ var N; })); var O; (function(O) { - class C2 extends Q1.E2 { + class C2 extends Q.E2 { } // error - var P1; + let P1; (function(P) { class D2 extends C2 { } P.D2 = D2; })(P1 || (P1 = { })); - var Q1; + let Q1; (function(Q) { class E2 extends P1.D2 { } diff --git a/crates/swc/tests/tsc-references/classes/classDeclarations/classHeritageSpecification/classExtendsItselfIndirectly2/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/classes/classDeclarations/classHeritageSpecification/classExtendsItselfIndirectly2/input.ts/es2015.2.minified/output.js index a3c8dc15ab9..54c7e851507 100644 --- a/crates/swc/tests/tsc-references/classes/classDeclarations/classHeritageSpecification/classExtendsItselfIndirectly2/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/classes/classDeclarations/classHeritageSpecification/classExtendsItselfIndirectly2/input.ts/es2015.2.minified/output.js @@ -9,16 +9,18 @@ class C extends N.E { N1.E = E; })(N || (N = { })), (function(O) { - var P, Q1; - class C2 extends Q1.E2 { + class C2 extends Q.E2 { } + let P; (P || (P = { })).D2 = class extends C2 { - }, (function(Q) { + }; + let Q1; + !function(Q) { class E2 extends P.D2 { } Q.E2 = E2; - })(Q1 || (Q1 = { + }(Q1 || (Q1 = { })); })(O || (O = { })); diff --git a/crates/swc/tests/tsc-references/classes/classDeclarations/classHeritageSpecification/classExtendsItselfIndirectly2/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/classes/classDeclarations/classHeritageSpecification/classExtendsItselfIndirectly2/input.ts/es5.1.normal/output.js index c1af9c25f9a..e57b6bb55d3 100644 --- a/crates/swc/tests/tsc-references/classes/classDeclarations/classHeritageSpecification/classExtendsItselfIndirectly2/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/classes/classDeclarations/classHeritageSpecification/classExtendsItselfIndirectly2/input.ts/es5.1.normal/output.js @@ -122,7 +122,7 @@ var O; } return C2; } // error - (Q1.E2); + (Q.E2); var P1; (function(P) { var D2 = /*#__PURE__*/ function(C2) { diff --git a/crates/swc/tests/tsc-references/classes/classDeclarations/classHeritageSpecification/classExtendsItselfIndirectly2/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/classes/classDeclarations/classHeritageSpecification/classExtendsItselfIndirectly2/input.ts/es5.2.minified/output.js index f5b950fc6f5..212ae6a69d1 100644 --- a/crates/swc/tests/tsc-references/classes/classDeclarations/classHeritageSpecification/classExtendsItselfIndirectly2/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/classes/classDeclarations/classHeritageSpecification/classExtendsItselfIndirectly2/input.ts/es5.2.minified/output.js @@ -87,7 +87,7 @@ var M, N, O, C = function(_E) { return _classCallCheck(this, C2), _super.apply(this, arguments); } return C2; - }(Q1.E2); + }(Q.E2); (function(P) { var D2 = function(C2) { "use strict"; diff --git a/crates/swc/tests/tsc-references/classes/propertyMemberDeclarations/constructorParameterShadowsOuterScopes/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/classes/propertyMemberDeclarations/constructorParameterShadowsOuterScopes/input.ts/es2015.1.normal/output.js index 823a085ab83..530bd8729f1 100644 --- a/crates/swc/tests/tsc-references/classes/propertyMemberDeclarations/constructorParameterShadowsOuterScopes/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/classes/propertyMemberDeclarations/constructorParameterShadowsOuterScopes/input.ts/es2015.1.normal/output.js @@ -6,7 +6,7 @@ var x = 1; class C { constructor(x1){ this.b // error, evaluated in scope of constructor, cannot reference x - = x1; + = x; x1 = 2; // error, x is string } } @@ -14,7 +14,7 @@ var y = 1; class D { constructor(x){ this.b // error, evaluated in scope of constructor, cannot reference y - = y1; + = y; var y1 = ""; } } diff --git a/crates/swc/tests/tsc-references/classes/propertyMemberDeclarations/constructorParameterShadowsOuterScopes/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/classes/propertyMemberDeclarations/constructorParameterShadowsOuterScopes/input.ts/es5.1.normal/output.js index 4ceec1369f6..36966011370 100644 --- a/crates/swc/tests/tsc-references/classes/propertyMemberDeclarations/constructorParameterShadowsOuterScopes/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/classes/propertyMemberDeclarations/constructorParameterShadowsOuterScopes/input.ts/es5.1.normal/output.js @@ -12,7 +12,7 @@ var C = function C(x1) { "use strict"; _classCallCheck(this, C); this.b // error, evaluated in scope of constructor, cannot reference x - = x1; + = x; x1 = 2; // error, x is string }; var y = 1; @@ -20,6 +20,6 @@ var D = function D(x) { "use strict"; _classCallCheck(this, D); this.b // error, evaluated in scope of constructor, cannot reference y - = y1; + = y; var y1 = ""; }; diff --git a/crates/swc/tests/tsc-references/classes/propertyMemberDeclarations/constructorParameterShadowsOuterScopes/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/classes/propertyMemberDeclarations/constructorParameterShadowsOuterScopes/input.ts/es5.2.minified/output.js index 47adde0d627..3c56095df5e 100644 --- a/crates/swc/tests/tsc-references/classes/propertyMemberDeclarations/constructorParameterShadowsOuterScopes/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/classes/propertyMemberDeclarations/constructorParameterShadowsOuterScopes/input.ts/es5.2.minified/output.js @@ -3,9 +3,8 @@ function _classCallCheck(instance, Constructor) { } var C = function(x) { "use strict"; - _classCallCheck(this, C), this.b = x, x = 2; + _classCallCheck(this, C), this.b = 1; }, D = function(x) { "use strict"; - _classCallCheck(this, D), this.b = y; - var y = ""; + _classCallCheck(this, D), this.b = 1; }; diff --git a/crates/swc/tests/tsc-references/classes/propertyMemberDeclarations/constructorParameterShadowsOuterScopes2/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/classes/propertyMemberDeclarations/constructorParameterShadowsOuterScopes2/input.ts/es2015.1.normal/output.js index b806abeeeed..26938911125 100644 --- a/crates/swc/tests/tsc-references/classes/propertyMemberDeclarations/constructorParameterShadowsOuterScopes2/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/classes/propertyMemberDeclarations/constructorParameterShadowsOuterScopes2/input.ts/es2015.1.normal/output.js @@ -13,19 +13,19 @@ var x = 1; class C { constructor(x1){ this.b // ok - = x1; + = x; } } var y = 1; class D { constructor(x){ this.b // ok - = y1; + = y; var y1 = ""; } } class E { - constructor(z){ + constructor(z1){ this.b // not ok = z; } diff --git a/crates/swc/tests/tsc-references/classes/propertyMemberDeclarations/constructorParameterShadowsOuterScopes2/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/classes/propertyMemberDeclarations/constructorParameterShadowsOuterScopes2/input.ts/es5.1.normal/output.js index 30e409f3353..2b08202622b 100644 --- a/crates/swc/tests/tsc-references/classes/propertyMemberDeclarations/constructorParameterShadowsOuterScopes2/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/classes/propertyMemberDeclarations/constructorParameterShadowsOuterScopes2/input.ts/es5.1.normal/output.js @@ -19,17 +19,17 @@ var C = function C(x1) { "use strict"; _classCallCheck(this, C); this.b // ok - = x1; + = x; }; var y = 1; var D = function D(x) { "use strict"; _classCallCheck(this, D); this.b // ok - = y1; + = y; var y1 = ""; }; -var E = function E(z) { +var E = function E(z1) { "use strict"; _classCallCheck(this, E); this.b // not ok diff --git a/crates/swc/tests/tsc-references/classes/propertyMemberDeclarations/constructorParameterShadowsOuterScopes2/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/classes/propertyMemberDeclarations/constructorParameterShadowsOuterScopes2/input.ts/es5.2.minified/output.js index cc99cdc6480..43bd128e889 100644 --- a/crates/swc/tests/tsc-references/classes/propertyMemberDeclarations/constructorParameterShadowsOuterScopes2/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/classes/propertyMemberDeclarations/constructorParameterShadowsOuterScopes2/input.ts/es5.2.minified/output.js @@ -3,12 +3,11 @@ function _classCallCheck(instance, Constructor) { } var C = function(x) { "use strict"; - _classCallCheck(this, C), this.b = x; + _classCallCheck(this, C), this.b = 1; }, D = function(x) { "use strict"; - _classCallCheck(this, D), this.b = y; - var y = ""; -}, E = function(z) { + _classCallCheck(this, D), this.b = 1; +}, E = function(z1) { "use strict"; _classCallCheck(this, E), this.b = z; }; diff --git a/crates/swc/tests/tsc-references/classes/propertyMemberDeclarations/initializerReferencingConstructorParameters/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/classes/propertyMemberDeclarations/initializerReferencingConstructorParameters/input.ts/es2015.1.normal/output.js index 25f2754e980..78bd601ec7f 100644 --- a/crates/swc/tests/tsc-references/classes/propertyMemberDeclarations/initializerReferencingConstructorParameters/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/classes/propertyMemberDeclarations/initializerReferencingConstructorParameters/input.ts/es2015.1.normal/output.js @@ -1,13 +1,13 @@ // Initializer expressions for instance member variables are evaluated in the scope of the class constructor body but are not permitted to reference parameters or local variables of the constructor. class C { - constructor(x){ + constructor(x1){ this.a // error = x; } } class D { - constructor(x){ - this.x = x; + constructor(x2){ + this.x = x2; this.a // error = x; } @@ -20,8 +20,8 @@ class E { } } class F { - constructor(x){ - this.x = x; + constructor(x3){ + this.x = x3; this.a // ok = this.x; this.b // error diff --git a/crates/swc/tests/tsc-references/classes/propertyMemberDeclarations/initializerReferencingConstructorParameters/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/classes/propertyMemberDeclarations/initializerReferencingConstructorParameters/input.ts/es5.1.normal/output.js index 7af9169e2f0..fb01ef4234f 100644 --- a/crates/swc/tests/tsc-references/classes/propertyMemberDeclarations/initializerReferencingConstructorParameters/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/classes/propertyMemberDeclarations/initializerReferencingConstructorParameters/input.ts/es5.1.normal/output.js @@ -3,17 +3,17 @@ function _classCallCheck(instance, Constructor) { throw new TypeError("Cannot call a class as a function"); } } -var C = function C(x) { +var C = function C(x1) { "use strict"; _classCallCheck(this, C); // Initializer expressions for instance member variables are evaluated in the scope of the class constructor body but are not permitted to reference parameters or local variables of the constructor. this.a // error = x; }; -var D = function D(x) { +var D = function D(x2) { "use strict"; _classCallCheck(this, D); - this.x = x; + this.x = x2; this.a // error = x; }; @@ -24,10 +24,10 @@ var E = function E(x) { this.a // ok = this.x; }; -var F = function F(x) { +var F = function F(x3) { "use strict"; _classCallCheck(this, F); - this.x = x; + this.x = x3; this.a // ok = this.x; this.b // error diff --git a/crates/swc/tests/tsc-references/classes/propertyMemberDeclarations/initializerReferencingConstructorParameters/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/classes/propertyMemberDeclarations/initializerReferencingConstructorParameters/input.ts/es5.2.minified/output.js index 61df2c9e683..7b7a6b00d13 100644 --- a/crates/swc/tests/tsc-references/classes/propertyMemberDeclarations/initializerReferencingConstructorParameters/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/classes/propertyMemberDeclarations/initializerReferencingConstructorParameters/input.ts/es5.2.minified/output.js @@ -1,16 +1,16 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function"); } -var C = function(x) { +var C = function(x1) { "use strict"; _classCallCheck(this, C), this.a = x; -}, D = function(x) { +}, D = function(x2) { "use strict"; - _classCallCheck(this, D), this.x = x, this.a = x; + _classCallCheck(this, D), this.x = x2, this.a = x; }, E = function(x) { "use strict"; _classCallCheck(this, E), this.x = x, this.a = this.x; -}, F = function(x) { +}, F = function(x3) { "use strict"; - _classCallCheck(this, F), this.x = x, this.a = this.x, this.b = x; + _classCallCheck(this, F), this.x = x3, this.a = this.x, this.b = x; }; diff --git a/crates/swc/tests/tsc-references/es6/computedProperties/computedPropertyNames47_ES5/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/es6/computedProperties/computedPropertyNames47_ES5/input.ts/es2015.1.normal/output.js index 5de70bb77de..68d1944da66 100644 --- a/crates/swc/tests/tsc-references/es6/computedProperties/computedPropertyNames47_ES5/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/es6/computedProperties/computedPropertyNames47_ES5/input.ts/es2015.1.normal/output.js @@ -1,12 +1,12 @@ var // @target: es5 E1; -(function(E11) { - E11[E11["x"] = 0] = "x"; +(function(E1) { + E1[E1["x"] = 0] = "x"; })(E1 || (E1 = { })); var E2; -(function(E21) { - E21[E21["x"] = 0] = "x"; +(function(E2) { + E2[E2["x"] = 0] = "x"; })(E2 || (E2 = { })); var o = { diff --git a/crates/swc/tests/tsc-references/es6/computedProperties/computedPropertyNames47_ES5/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/es6/computedProperties/computedPropertyNames47_ES5/input.ts/es2015.2.minified/output.js index 2280b3f45a2..e6bdced7351 100644 --- a/crates/swc/tests/tsc-references/es6/computedProperties/computedPropertyNames47_ES5/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/es6/computedProperties/computedPropertyNames47_ES5/input.ts/es2015.2.minified/output.js @@ -1,4 +1,4 @@ -var E1, E2, E11, E21; -(E1 = E11 || (E11 = { -}))[E1.x = 0] = "x", (E2 = E21 || (E21 = { -}))[E2.x = 0] = "x", E11.x || E21.x; +var E1, E2, E1, E2; +(E1 = E1 || (E1 = { +}))[E1.x = 0] = "x", (E2 = E2 || (E2 = { +}))[E2.x = 0] = "x", E1.x || E2.x; diff --git a/crates/swc/tests/tsc-references/es6/computedProperties/computedPropertyNames47_ES5/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/es6/computedProperties/computedPropertyNames47_ES5/input.ts/es5.1.normal/output.js index 74fa35a3a22..6ba2499d0ae 100644 --- a/crates/swc/tests/tsc-references/es6/computedProperties/computedPropertyNames47_ES5/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/es6/computedProperties/computedPropertyNames47_ES5/input.ts/es5.1.normal/output.js @@ -13,13 +13,13 @@ function _defineProperty(obj, key, value) { } var // @target: es5 E1; -(function(E11) { - E11[E11["x"] = 0] = "x"; +(function(E1) { + E1[E1["x"] = 0] = "x"; })(E1 || (E1 = { })); var E2; -(function(E21) { - E21[E21["x"] = 0] = "x"; +(function(E2) { + E2[E2["x"] = 0] = "x"; })(E2 || (E2 = { })); var o = _defineProperty({ diff --git a/crates/swc/tests/tsc-references/es6/computedProperties/computedPropertyNames47_ES5/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/es6/computedProperties/computedPropertyNames47_ES5/input.ts/es5.2.minified/output.js index 3b06667f287..1f52ee3b48e 100644 --- a/crates/swc/tests/tsc-references/es6/computedProperties/computedPropertyNames47_ES5/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/es6/computedProperties/computedPropertyNames47_ES5/input.ts/es5.2.minified/output.js @@ -1,8 +1,8 @@ -var E1, E2, obj, key, E11, E21; -(E1 = E11 || (E11 = { -}))[E1.x = 0] = "x", (E2 = E21 || (E21 = { +var E1, E2, obj, key, E1, E2; +(E1 = E1 || (E1 = { +}))[E1.x = 0] = "x", (E2 = E2 || (E2 = { }))[E2.x = 0] = "x", obj = { -}, (key = E11.x || E21.x) in obj ? Object.defineProperty(obj, key, { +}, (key = E1.x || E2.x) in obj ? Object.defineProperty(obj, key, { value: 0, enumerable: !0, configurable: !0, diff --git a/crates/swc/tests/tsc-references/es6/computedProperties/computedPropertyNames47_ES6/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/es6/computedProperties/computedPropertyNames47_ES6/input.ts/es2015.1.normal/output.js index 6598a065724..43fa0c237ab 100644 --- a/crates/swc/tests/tsc-references/es6/computedProperties/computedPropertyNames47_ES6/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/es6/computedProperties/computedPropertyNames47_ES6/input.ts/es2015.1.normal/output.js @@ -1,12 +1,12 @@ var // @target: es6 E1; -(function(E11) { - E11[E11["x"] = 0] = "x"; +(function(E1) { + E1[E1["x"] = 0] = "x"; })(E1 || (E1 = { })); var E2; -(function(E21) { - E21[E21["x"] = 0] = "x"; +(function(E2) { + E2[E2["x"] = 0] = "x"; })(E2 || (E2 = { })); var o = { diff --git a/crates/swc/tests/tsc-references/es6/computedProperties/computedPropertyNames47_ES6/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/es6/computedProperties/computedPropertyNames47_ES6/input.ts/es2015.2.minified/output.js index 2280b3f45a2..e6bdced7351 100644 --- a/crates/swc/tests/tsc-references/es6/computedProperties/computedPropertyNames47_ES6/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/es6/computedProperties/computedPropertyNames47_ES6/input.ts/es2015.2.minified/output.js @@ -1,4 +1,4 @@ -var E1, E2, E11, E21; -(E1 = E11 || (E11 = { -}))[E1.x = 0] = "x", (E2 = E21 || (E21 = { -}))[E2.x = 0] = "x", E11.x || E21.x; +var E1, E2, E1, E2; +(E1 = E1 || (E1 = { +}))[E1.x = 0] = "x", (E2 = E2 || (E2 = { +}))[E2.x = 0] = "x", E1.x || E2.x; diff --git a/crates/swc/tests/tsc-references/es6/computedProperties/computedPropertyNames47_ES6/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/es6/computedProperties/computedPropertyNames47_ES6/input.ts/es5.1.normal/output.js index e3b0da28ec8..0b650a3df64 100644 --- a/crates/swc/tests/tsc-references/es6/computedProperties/computedPropertyNames47_ES6/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/es6/computedProperties/computedPropertyNames47_ES6/input.ts/es5.1.normal/output.js @@ -13,13 +13,13 @@ function _defineProperty(obj, key, value) { } var // @target: es6 E1; -(function(E11) { - E11[E11["x"] = 0] = "x"; +(function(E1) { + E1[E1["x"] = 0] = "x"; })(E1 || (E1 = { })); var E2; -(function(E21) { - E21[E21["x"] = 0] = "x"; +(function(E2) { + E2[E2["x"] = 0] = "x"; })(E2 || (E2 = { })); var o = _defineProperty({ diff --git a/crates/swc/tests/tsc-references/es6/computedProperties/computedPropertyNames47_ES6/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/es6/computedProperties/computedPropertyNames47_ES6/input.ts/es5.2.minified/output.js index 3b06667f287..1f52ee3b48e 100644 --- a/crates/swc/tests/tsc-references/es6/computedProperties/computedPropertyNames47_ES6/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/es6/computedProperties/computedPropertyNames47_ES6/input.ts/es5.2.minified/output.js @@ -1,8 +1,8 @@ -var E1, E2, obj, key, E11, E21; -(E1 = E11 || (E11 = { -}))[E1.x = 0] = "x", (E2 = E21 || (E21 = { +var E1, E2, obj, key, E1, E2; +(E1 = E1 || (E1 = { +}))[E1.x = 0] = "x", (E2 = E2 || (E2 = { }))[E2.x = 0] = "x", obj = { -}, (key = E11.x || E21.x) in obj ? Object.defineProperty(obj, key, { +}, (key = E1.x || E2.x) in obj ? Object.defineProperty(obj, key, { value: 0, enumerable: !0, configurable: !0, diff --git a/crates/swc/tests/tsc-references/es6/computedProperties/computedPropertyNames48_ES5/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/es6/computedProperties/computedPropertyNames48_ES5/input.ts/es2015.1.normal/output.js index 398e888f30c..bd2300bb59e 100644 --- a/crates/swc/tests/tsc-references/es6/computedProperties/computedPropertyNames48_ES5/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/es6/computedProperties/computedPropertyNames48_ES5/input.ts/es2015.1.normal/output.js @@ -1,6 +1,6 @@ var E; -(function(E1) { - E1[E1["x"] = 0] = "x"; +(function(E) { + E[E["x"] = 0] = "x"; })(E || (E = { })); var a; diff --git a/crates/swc/tests/tsc-references/es6/computedProperties/computedPropertyNames48_ES5/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/es6/computedProperties/computedPropertyNames48_ES5/input.ts/es2015.2.minified/output.js index eb40b47347d..72e3201c4d7 100644 --- a/crates/swc/tests/tsc-references/es6/computedProperties/computedPropertyNames48_ES5/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/es6/computedProperties/computedPropertyNames48_ES5/input.ts/es2015.2.minified/output.js @@ -1,6 +1,6 @@ -var E, a, E1; -(E1 = E || (E = { -}))[E1.x = 0] = "x", extractIndexer({ +var E, a, E; +(E = E || (E = { +}))[E.x = 0] = "x", extractIndexer({ [a]: "" }), extractIndexer({ [E.x]: "" diff --git a/crates/swc/tests/tsc-references/es6/computedProperties/computedPropertyNames48_ES5/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/es6/computedProperties/computedPropertyNames48_ES5/input.ts/es5.1.normal/output.js index 06580cfb5a4..4a6581c042b 100644 --- a/crates/swc/tests/tsc-references/es6/computedProperties/computedPropertyNames48_ES5/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/es6/computedProperties/computedPropertyNames48_ES5/input.ts/es5.1.normal/output.js @@ -12,8 +12,8 @@ function _defineProperty(obj, key, value) { return obj; } var E; -(function(E1) { - E1[E1["x"] = 0] = "x"; +(function(E) { + E[E["x"] = 0] = "x"; })(E || (E = { })); var a; diff --git a/crates/swc/tests/tsc-references/es6/computedProperties/computedPropertyNames48_ES5/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/es6/computedProperties/computedPropertyNames48_ES5/input.ts/es5.2.minified/output.js index 81fe6edfac6..65d80ead422 100644 --- a/crates/swc/tests/tsc-references/es6/computedProperties/computedPropertyNames48_ES5/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/es6/computedProperties/computedPropertyNames48_ES5/input.ts/es5.2.minified/output.js @@ -1,4 +1,4 @@ -var E, a, E1; +var E, a, E; function _defineProperty(obj, key, value) { return key in obj ? Object.defineProperty(obj, key, { value: value, @@ -7,8 +7,8 @@ function _defineProperty(obj, key, value) { writable: !0 }) : obj[key] = value, obj; } -(E1 = E || (E = { -}))[E1.x = 0] = "x", extractIndexer(_defineProperty({ +(E = E || (E = { +}))[E.x = 0] = "x", extractIndexer(_defineProperty({ }, a, "")), extractIndexer(_defineProperty({ }, E.x, "")), extractIndexer(_defineProperty({ }, 0, "")); diff --git a/crates/swc/tests/tsc-references/es6/computedProperties/computedPropertyNames48_ES6/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/es6/computedProperties/computedPropertyNames48_ES6/input.ts/es2015.1.normal/output.js index 398e888f30c..bd2300bb59e 100644 --- a/crates/swc/tests/tsc-references/es6/computedProperties/computedPropertyNames48_ES6/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/es6/computedProperties/computedPropertyNames48_ES6/input.ts/es2015.1.normal/output.js @@ -1,6 +1,6 @@ var E; -(function(E1) { - E1[E1["x"] = 0] = "x"; +(function(E) { + E[E["x"] = 0] = "x"; })(E || (E = { })); var a; diff --git a/crates/swc/tests/tsc-references/es6/computedProperties/computedPropertyNames48_ES6/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/es6/computedProperties/computedPropertyNames48_ES6/input.ts/es2015.2.minified/output.js index eb40b47347d..72e3201c4d7 100644 --- a/crates/swc/tests/tsc-references/es6/computedProperties/computedPropertyNames48_ES6/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/es6/computedProperties/computedPropertyNames48_ES6/input.ts/es2015.2.minified/output.js @@ -1,6 +1,6 @@ -var E, a, E1; -(E1 = E || (E = { -}))[E1.x = 0] = "x", extractIndexer({ +var E, a, E; +(E = E || (E = { +}))[E.x = 0] = "x", extractIndexer({ [a]: "" }), extractIndexer({ [E.x]: "" diff --git a/crates/swc/tests/tsc-references/es6/computedProperties/computedPropertyNames48_ES6/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/es6/computedProperties/computedPropertyNames48_ES6/input.ts/es5.1.normal/output.js index 06580cfb5a4..4a6581c042b 100644 --- a/crates/swc/tests/tsc-references/es6/computedProperties/computedPropertyNames48_ES6/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/es6/computedProperties/computedPropertyNames48_ES6/input.ts/es5.1.normal/output.js @@ -12,8 +12,8 @@ function _defineProperty(obj, key, value) { return obj; } var E; -(function(E1) { - E1[E1["x"] = 0] = "x"; +(function(E) { + E[E["x"] = 0] = "x"; })(E || (E = { })); var a; diff --git a/crates/swc/tests/tsc-references/es6/computedProperties/computedPropertyNames48_ES6/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/es6/computedProperties/computedPropertyNames48_ES6/input.ts/es5.2.minified/output.js index 81fe6edfac6..65d80ead422 100644 --- a/crates/swc/tests/tsc-references/es6/computedProperties/computedPropertyNames48_ES6/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/es6/computedProperties/computedPropertyNames48_ES6/input.ts/es5.2.minified/output.js @@ -1,4 +1,4 @@ -var E, a, E1; +var E, a, E; function _defineProperty(obj, key, value) { return key in obj ? Object.defineProperty(obj, key, { value: value, @@ -7,8 +7,8 @@ function _defineProperty(obj, key, value) { writable: !0 }) : obj[key] = value, obj; } -(E1 = E || (E = { -}))[E1.x = 0] = "x", extractIndexer(_defineProperty({ +(E = E || (E = { +}))[E.x = 0] = "x", extractIndexer(_defineProperty({ }, a, "")), extractIndexer(_defineProperty({ }, E.x, "")), extractIndexer(_defineProperty({ }, 0, "")); diff --git a/crates/swc/tests/tsc-references/es6/computedProperties/computedPropertyNames7_ES5/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/es6/computedProperties/computedPropertyNames7_ES5/input.ts/es2015.1.normal/output.js index f9c397c2bd6..7ae07c1a013 100644 --- a/crates/swc/tests/tsc-references/es6/computedProperties/computedPropertyNames7_ES5/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/es6/computedProperties/computedPropertyNames7_ES5/input.ts/es2015.1.normal/output.js @@ -1,7 +1,7 @@ var // @target: es5 E; -(function(E1) { - E1[E1["member"] = 0] = "member"; +(function(E) { + E[E["member"] = 0] = "member"; })(E || (E = { })); var v = { diff --git a/crates/swc/tests/tsc-references/es6/computedProperties/computedPropertyNames7_ES5/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/es6/computedProperties/computedPropertyNames7_ES5/input.ts/es2015.2.minified/output.js index d9fd953e763..3bd7a9cd67f 100644 --- a/crates/swc/tests/tsc-references/es6/computedProperties/computedPropertyNames7_ES5/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/es6/computedProperties/computedPropertyNames7_ES5/input.ts/es2015.2.minified/output.js @@ -1,3 +1,3 @@ -var E, E1; -(E1 = E || (E = { -}))[E1.member = 0] = "member", E.member; +var E, E; +(E = E || (E = { +}))[E.member = 0] = "member", E.member; diff --git a/crates/swc/tests/tsc-references/es6/computedProperties/computedPropertyNames7_ES5/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/es6/computedProperties/computedPropertyNames7_ES5/input.ts/es5.1.normal/output.js index e38f9727f2c..9db26319fe1 100644 --- a/crates/swc/tests/tsc-references/es6/computedProperties/computedPropertyNames7_ES5/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/es6/computedProperties/computedPropertyNames7_ES5/input.ts/es5.1.normal/output.js @@ -13,8 +13,8 @@ function _defineProperty(obj, key, value) { } var // @target: es5 E; -(function(E1) { - E1[E1["member"] = 0] = "member"; +(function(E) { + E[E["member"] = 0] = "member"; })(E || (E = { })); var v = _defineProperty({ diff --git a/crates/swc/tests/tsc-references/es6/computedProperties/computedPropertyNames7_ES5/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/es6/computedProperties/computedPropertyNames7_ES5/input.ts/es5.2.minified/output.js index 23d65d3f2d3..2d42392864b 100644 --- a/crates/swc/tests/tsc-references/es6/computedProperties/computedPropertyNames7_ES5/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/es6/computedProperties/computedPropertyNames7_ES5/input.ts/es5.2.minified/output.js @@ -1,7 +1,7 @@ -var E, obj, key, E1; -(E = E1 || (E1 = { +var E, obj, key, E; +(E = E || (E = { }))[E.member = 0] = "member", obj = { -}, (key = E1.member) in obj ? Object.defineProperty(obj, key, { +}, (key = E.member) in obj ? Object.defineProperty(obj, key, { value: 0, enumerable: !0, configurable: !0, diff --git a/crates/swc/tests/tsc-references/es6/computedProperties/computedPropertyNames7_ES6/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/es6/computedProperties/computedPropertyNames7_ES6/input.ts/es2015.1.normal/output.js index 930c66daffc..1a5c6787e61 100644 --- a/crates/swc/tests/tsc-references/es6/computedProperties/computedPropertyNames7_ES6/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/es6/computedProperties/computedPropertyNames7_ES6/input.ts/es2015.1.normal/output.js @@ -1,7 +1,7 @@ var // @target: es6 E; -(function(E1) { - E1[E1["member"] = 0] = "member"; +(function(E) { + E[E["member"] = 0] = "member"; })(E || (E = { })); var v = { diff --git a/crates/swc/tests/tsc-references/es6/computedProperties/computedPropertyNames7_ES6/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/es6/computedProperties/computedPropertyNames7_ES6/input.ts/es2015.2.minified/output.js index d9fd953e763..3bd7a9cd67f 100644 --- a/crates/swc/tests/tsc-references/es6/computedProperties/computedPropertyNames7_ES6/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/es6/computedProperties/computedPropertyNames7_ES6/input.ts/es2015.2.minified/output.js @@ -1,3 +1,3 @@ -var E, E1; -(E1 = E || (E = { -}))[E1.member = 0] = "member", E.member; +var E, E; +(E = E || (E = { +}))[E.member = 0] = "member", E.member; diff --git a/crates/swc/tests/tsc-references/es6/computedProperties/computedPropertyNames7_ES6/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/es6/computedProperties/computedPropertyNames7_ES6/input.ts/es5.1.normal/output.js index f3ee2c5fdc4..6fd132b925b 100644 --- a/crates/swc/tests/tsc-references/es6/computedProperties/computedPropertyNames7_ES6/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/es6/computedProperties/computedPropertyNames7_ES6/input.ts/es5.1.normal/output.js @@ -13,8 +13,8 @@ function _defineProperty(obj, key, value) { } var // @target: es6 E; -(function(E1) { - E1[E1["member"] = 0] = "member"; +(function(E) { + E[E["member"] = 0] = "member"; })(E || (E = { })); var v = _defineProperty({ diff --git a/crates/swc/tests/tsc-references/es6/computedProperties/computedPropertyNames7_ES6/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/es6/computedProperties/computedPropertyNames7_ES6/input.ts/es5.2.minified/output.js index 23d65d3f2d3..2d42392864b 100644 --- a/crates/swc/tests/tsc-references/es6/computedProperties/computedPropertyNames7_ES6/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/es6/computedProperties/computedPropertyNames7_ES6/input.ts/es5.2.minified/output.js @@ -1,7 +1,7 @@ -var E, obj, key, E1; -(E = E1 || (E1 = { +var E, obj, key, E; +(E = E || (E = { }))[E.member = 0] = "member", obj = { -}, (key = E1.member) in obj ? Object.defineProperty(obj, key, { +}, (key = E.member) in obj ? Object.defineProperty(obj, key, { value: 0, enumerable: !0, configurable: !0, diff --git a/crates/swc/tests/tsc-references/es6/destructuring/destructuringObjectBindingPatternAndAssignment7/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/es6/destructuring/destructuringObjectBindingPatternAndAssignment7/input.ts/es2015.1.normal/output.js index 3b5f7fff42a..7c73a1c7536 100644 --- a/crates/swc/tests/tsc-references/es6/destructuring/destructuringObjectBindingPatternAndAssignment7/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/es6/destructuring/destructuringObjectBindingPatternAndAssignment7/input.ts/es2015.1.normal/output.js @@ -1,8 +1,8 @@ var // @target: es5,esnext K; -(function(K1) { - K1["a"] = "a"; - K1["b"] = "b"; +(function(K) { + K["a"] = "a"; + K["b"] = "b"; })(K || (K = { })); const { [K.a]: aVal , [K.b]: bVal } = (()=>{ diff --git a/crates/swc/tests/tsc-references/es6/destructuring/destructuringObjectBindingPatternAndAssignment7/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/es6/destructuring/destructuringObjectBindingPatternAndAssignment7/input.ts/es2015.2.minified/output.js index 88303bf7a93..58fa0a3f68c 100644 --- a/crates/swc/tests/tsc-references/es6/destructuring/destructuringObjectBindingPatternAndAssignment7/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/es6/destructuring/destructuringObjectBindingPatternAndAssignment7/input.ts/es2015.2.minified/output.js @@ -1,6 +1,6 @@ -var K, K1; -(K1 = K || (K = { -})).a = "a", K1.b = "b"; +var K, K; +(K = K || (K = { +})).a = "a", K.b = "b"; const { [K.a]: aVal , [K.b]: bVal } = { [K.a]: 1, [K.b]: 1 diff --git a/crates/swc/tests/tsc-references/es6/destructuring/destructuringObjectBindingPatternAndAssignment7/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/es6/destructuring/destructuringObjectBindingPatternAndAssignment7/input.ts/es5.1.normal/output.js index 8bf727cc078..a740debe435 100644 --- a/crates/swc/tests/tsc-references/es6/destructuring/destructuringObjectBindingPatternAndAssignment7/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/es6/destructuring/destructuringObjectBindingPatternAndAssignment7/input.ts/es5.1.normal/output.js @@ -13,9 +13,9 @@ function _defineProperty(obj, key, value) { } var // @target: es5,esnext K; -(function(K1) { - K1["a"] = "a"; - K1["b"] = "b"; +(function(K) { + K["a"] = "a"; + K["b"] = "b"; })(K || (K = { })); var _obj; diff --git a/crates/swc/tests/tsc-references/es6/destructuring/destructuringObjectBindingPatternAndAssignment7/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/es6/destructuring/destructuringObjectBindingPatternAndAssignment7/input.ts/es5.2.minified/output.js index e79fa2fa984..f3d8c3d4165 100644 --- a/crates/swc/tests/tsc-references/es6/destructuring/destructuringObjectBindingPatternAndAssignment7/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/es6/destructuring/destructuringObjectBindingPatternAndAssignment7/input.ts/es5.2.minified/output.js @@ -6,8 +6,8 @@ function _defineProperty(obj, key, value) { writable: !0 }) : obj[key] = value, obj; } -(K = K1 || (K1 = { +(K = K || (K = { })).a = "a", K.b = "b"; -var K, K1, _obj, ref = (_defineProperty(_obj = { -}, K1.a, 1), _defineProperty(_obj, K1.b, 1), _obj), aVal = ref[K1.a], bVal = ref[K1.b]; +var K, K, _obj, ref = (_defineProperty(_obj = { +}, K.a, 1), _defineProperty(_obj, K.b, 1), _obj), aVal = ref[K.a], bVal = ref[K.b]; console.log(aVal, bVal); diff --git a/crates/swc/tests/tsc-references/es6/destructuring/destructuringParameterDeclaration1ES5/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/es6/destructuring/destructuringParameterDeclaration1ES5/input.ts/es2015.1.normal/output.js index 134a1d688ce..1edb6b30471 100644 --- a/crates/swc/tests/tsc-references/es6/destructuring/destructuringParameterDeclaration1ES5/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/es6/destructuring/destructuringParameterDeclaration1ES5/input.ts/es2015.1.normal/output.js @@ -102,8 +102,8 @@ b7([ ]); // Shouldn't be an error var // If the declaration specifies a binding pattern, the parameter type is the implied type of that binding pattern (section 5.1.3) Foo; -(function(Foo1) { - Foo1[Foo1["a"] = 0] = "a"; +(function(Foo) { + Foo[Foo["a"] = 0] = "a"; })(Foo || (Foo = { })); function c0({ z: { x , y: { j } } }) { diff --git a/crates/swc/tests/tsc-references/es6/destructuring/destructuringParameterDeclaration1ES5/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/es6/destructuring/destructuringParameterDeclaration1ES5/input.ts/es2015.2.minified/output.js index 3eb7d01ec16..b9d5ec8aebb 100644 --- a/crates/swc/tests/tsc-references/es6/destructuring/destructuringParameterDeclaration1ES5/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/es6/destructuring/destructuringParameterDeclaration1ES5/input.ts/es2015.2.minified/output.js @@ -1,4 +1,4 @@ -var Foo, Foo1; +var Foo, Foo; function a1([a, b, [[c]]]) { } function b2(z = null, o = { @@ -39,8 +39,8 @@ a1([ }), b2("string", { x: 200, y: !0 -}), (Foo1 = Foo || (Foo = { -}))[Foo1.a = 0] = "a", c0({ +}), (Foo = Foo || (Foo = { +}))[Foo.a = 0] = "a", c0({ z: { x: 1, y: { diff --git a/crates/swc/tests/tsc-references/es6/destructuring/destructuringParameterDeclaration1ES5/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/es6/destructuring/destructuringParameterDeclaration1ES5/input.ts/es5.1.normal/output.js index 2ec00168618..84405635958 100644 --- a/crates/swc/tests/tsc-references/es6/destructuring/destructuringParameterDeclaration1ES5/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/es6/destructuring/destructuringParameterDeclaration1ES5/input.ts/es5.1.normal/output.js @@ -160,8 +160,8 @@ b7([ ]); // Shouldn't be an error var // If the declaration specifies a binding pattern, the parameter type is the implied type of that binding pattern (section 5.1.3) Foo; -(function(Foo1) { - Foo1[Foo1["a"] = 0] = "a"; +(function(Foo) { + Foo[Foo["a"] = 0] = "a"; })(Foo || (Foo = { })); function c0(param) { diff --git a/crates/swc/tests/tsc-references/es6/destructuring/destructuringParameterDeclaration1ES5/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/es6/destructuring/destructuringParameterDeclaration1ES5/input.ts/es5.2.minified/output.js index 0d997333ddd..d34eb2b4c14 100644 --- a/crates/swc/tests/tsc-references/es6/destructuring/destructuringParameterDeclaration1ES5/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/es6/destructuring/destructuringParameterDeclaration1ES5/input.ts/es5.2.minified/output.js @@ -119,7 +119,7 @@ a1([ !1 ] ] -]), (Foo = Foo1 || (Foo1 = { +]), (Foo = Foo || (Foo = { }))[Foo.a = 0] = "a", c0({ z: { x: 1, @@ -164,7 +164,7 @@ a1([ !1, !0 ]); -var Foo, Foo1, C2 = function() { +var Foo, Foo, C2 = function() { "use strict"; function C2() { _classCallCheck(this, C2); diff --git a/crates/swc/tests/tsc-references/es6/destructuring/destructuringParameterDeclaration1ES5iterable/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/es6/destructuring/destructuringParameterDeclaration1ES5iterable/input.ts/es2015.1.normal/output.js index c6e9585a8c5..bcd151c3896 100644 --- a/crates/swc/tests/tsc-references/es6/destructuring/destructuringParameterDeclaration1ES5iterable/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/es6/destructuring/destructuringParameterDeclaration1ES5iterable/input.ts/es2015.1.normal/output.js @@ -103,8 +103,8 @@ b7([ ]); // Shouldn't be an error var // If the declaration specifies a binding pattern, the parameter type is the implied type of that binding pattern (section 5.1.3) Foo; -(function(Foo1) { - Foo1[Foo1["a"] = 0] = "a"; +(function(Foo) { + Foo[Foo["a"] = 0] = "a"; })(Foo || (Foo = { })); function c0({ z: { x , y: { j } } }) { diff --git a/crates/swc/tests/tsc-references/es6/destructuring/destructuringParameterDeclaration1ES5iterable/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/es6/destructuring/destructuringParameterDeclaration1ES5iterable/input.ts/es2015.2.minified/output.js index 3eb7d01ec16..b9d5ec8aebb 100644 --- a/crates/swc/tests/tsc-references/es6/destructuring/destructuringParameterDeclaration1ES5iterable/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/es6/destructuring/destructuringParameterDeclaration1ES5iterable/input.ts/es2015.2.minified/output.js @@ -1,4 +1,4 @@ -var Foo, Foo1; +var Foo, Foo; function a1([a, b, [[c]]]) { } function b2(z = null, o = { @@ -39,8 +39,8 @@ a1([ }), b2("string", { x: 200, y: !0 -}), (Foo1 = Foo || (Foo = { -}))[Foo1.a = 0] = "a", c0({ +}), (Foo = Foo || (Foo = { +}))[Foo.a = 0] = "a", c0({ z: { x: 1, y: { diff --git a/crates/swc/tests/tsc-references/es6/destructuring/destructuringParameterDeclaration1ES5iterable/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/es6/destructuring/destructuringParameterDeclaration1ES5iterable/input.ts/es5.1.normal/output.js index 7dd62c28ef2..d6b666a72c3 100644 --- a/crates/swc/tests/tsc-references/es6/destructuring/destructuringParameterDeclaration1ES5iterable/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/es6/destructuring/destructuringParameterDeclaration1ES5iterable/input.ts/es5.1.normal/output.js @@ -161,8 +161,8 @@ b7([ ]); // Shouldn't be an error var // If the declaration specifies a binding pattern, the parameter type is the implied type of that binding pattern (section 5.1.3) Foo; -(function(Foo1) { - Foo1[Foo1["a"] = 0] = "a"; +(function(Foo) { + Foo[Foo["a"] = 0] = "a"; })(Foo || (Foo = { })); function c0(param) { diff --git a/crates/swc/tests/tsc-references/es6/destructuring/destructuringParameterDeclaration1ES5iterable/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/es6/destructuring/destructuringParameterDeclaration1ES5iterable/input.ts/es5.2.minified/output.js index 0d997333ddd..d34eb2b4c14 100644 --- a/crates/swc/tests/tsc-references/es6/destructuring/destructuringParameterDeclaration1ES5iterable/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/es6/destructuring/destructuringParameterDeclaration1ES5iterable/input.ts/es5.2.minified/output.js @@ -119,7 +119,7 @@ a1([ !1 ] ] -]), (Foo = Foo1 || (Foo1 = { +]), (Foo = Foo || (Foo = { }))[Foo.a = 0] = "a", c0({ z: { x: 1, @@ -164,7 +164,7 @@ a1([ !1, !0 ]); -var Foo, Foo1, C2 = function() { +var Foo, Foo, C2 = function() { "use strict"; function C2() { _classCallCheck(this, C2); diff --git a/crates/swc/tests/tsc-references/es6/destructuring/destructuringParameterDeclaration1ES6/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/es6/destructuring/destructuringParameterDeclaration1ES6/input.ts/es2015.1.normal/output.js index 6d96da698e2..2c6fdc4d2db 100644 --- a/crates/swc/tests/tsc-references/es6/destructuring/destructuringParameterDeclaration1ES6/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/es6/destructuring/destructuringParameterDeclaration1ES6/input.ts/es2015.1.normal/output.js @@ -87,8 +87,8 @@ b2("string", { }); var // If the declaration specifies a binding pattern, the parameter type is the implied type of that binding pattern (section 5.1.3) Foo; -(function(Foo1) { - Foo1[Foo1["a"] = 0] = "a"; +(function(Foo) { + Foo[Foo["a"] = 0] = "a"; })(Foo || (Foo = { })); function c0({ z: { x , y: { j } } }) { diff --git a/crates/swc/tests/tsc-references/es6/destructuring/destructuringParameterDeclaration1ES6/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/es6/destructuring/destructuringParameterDeclaration1ES6/input.ts/es2015.2.minified/output.js index 3eb7d01ec16..b9d5ec8aebb 100644 --- a/crates/swc/tests/tsc-references/es6/destructuring/destructuringParameterDeclaration1ES6/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/es6/destructuring/destructuringParameterDeclaration1ES6/input.ts/es2015.2.minified/output.js @@ -1,4 +1,4 @@ -var Foo, Foo1; +var Foo, Foo; function a1([a, b, [[c]]]) { } function b2(z = null, o = { @@ -39,8 +39,8 @@ a1([ }), b2("string", { x: 200, y: !0 -}), (Foo1 = Foo || (Foo = { -}))[Foo1.a = 0] = "a", c0({ +}), (Foo = Foo || (Foo = { +}))[Foo.a = 0] = "a", c0({ z: { x: 1, y: { diff --git a/crates/swc/tests/tsc-references/es6/destructuring/destructuringParameterDeclaration1ES6/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/es6/destructuring/destructuringParameterDeclaration1ES6/input.ts/es5.1.normal/output.js index 8321781acd3..9246f8c5aeb 100644 --- a/crates/swc/tests/tsc-references/es6/destructuring/destructuringParameterDeclaration1ES6/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/es6/destructuring/destructuringParameterDeclaration1ES6/input.ts/es5.1.normal/output.js @@ -145,8 +145,8 @@ b2("string", { }); var // If the declaration specifies a binding pattern, the parameter type is the implied type of that binding pattern (section 5.1.3) Foo; -(function(Foo1) { - Foo1[Foo1["a"] = 0] = "a"; +(function(Foo) { + Foo[Foo["a"] = 0] = "a"; })(Foo || (Foo = { })); function c0(param) { diff --git a/crates/swc/tests/tsc-references/es6/destructuring/destructuringParameterDeclaration1ES6/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/es6/destructuring/destructuringParameterDeclaration1ES6/input.ts/es5.2.minified/output.js index f99f407b1e6..574dc87d767 100644 --- a/crates/swc/tests/tsc-references/es6/destructuring/destructuringParameterDeclaration1ES6/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/es6/destructuring/destructuringParameterDeclaration1ES6/input.ts/es5.2.minified/output.js @@ -83,7 +83,7 @@ a1([ }), b2("string", { x: 200, y: !0 -}), (Foo = Foo1 || (Foo1 = { +}), (Foo = Foo || (Foo = { }))[Foo.a = 0] = "a", c0({ z: { x: 1, @@ -128,7 +128,7 @@ a1([ !1, !0 ]); -var Foo, Foo1, C2 = function() { +var Foo, Foo, C2 = function() { "use strict"; function C2() { _classCallCheck(this, C2); diff --git a/crates/swc/tests/tsc-references/es6/destructuring/destructuringParameterDeclaration3ES5/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/es6/destructuring/destructuringParameterDeclaration3ES5/input.ts/es2015.1.normal/output.js index 706c93c0522..3c6c584c6b6 100644 --- a/crates/swc/tests/tsc-references/es6/destructuring/destructuringParameterDeclaration3ES5/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/es6/destructuring/destructuringParameterDeclaration3ES5/input.ts/es2015.1.normal/output.js @@ -71,15 +71,15 @@ function foo(...a) { foo("hello", 1, 2); foo("hello", "world"); var E; -(function(E2) { - E2[E2["a"] = 0] = "a"; - E2[E2["b"] = 1] = "b"; +(function(E) { + E[E["a"] = 0] = "a"; + E[E["b"] = 1] = "b"; })(E || (E = { })); var E1; -(function(E11) { - E11[E11["a"] = 0] = "a"; - E11[E11["b"] = 1] = "b"; +(function(E1) { + E1[E1["a"] = 0] = "a"; + E1[E1["b"] = 1] = "b"; })(E1 || (E1 = { })); function foo1(...a) { diff --git a/crates/swc/tests/tsc-references/es6/destructuring/destructuringParameterDeclaration3ES5/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/es6/destructuring/destructuringParameterDeclaration3ES5/input.ts/es2015.2.minified/output.js index cd230600e6b..f9a257b8adb 100644 --- a/crates/swc/tests/tsc-references/es6/destructuring/destructuringParameterDeclaration3ES5/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/es6/destructuring/destructuringParameterDeclaration3ES5/input.ts/es2015.2.minified/output.js @@ -1,4 +1,4 @@ -var E, E1, E2, E11; +var E, E1, E, E1; function a10([a, b, [[c]], ...x]) { } function foo(...a) { @@ -24,6 +24,6 @@ a10([ ]), a10([ 1, 2 -]), foo("hello", 1, 2), foo("hello", "world"), (E = E2 || (E2 = { -}))[E.a = 0] = "a", E[E.b = 1] = "b", (E1 = E11 || (E11 = { -}))[E1.a = 0] = "a", E1[E1.b = 1] = "b", foo1(1, 2, 3, E2.a), foo1(1, 2, 3, E11.a, E2.b); +]), foo("hello", 1, 2), foo("hello", "world"), (E = E || (E = { +}))[E.a = 0] = "a", E[E.b = 1] = "b", (E1 = E1 || (E1 = { +}))[E1.a = 0] = "a", E1[E1.b = 1] = "b", foo1(1, 2, 3, E.a), foo1(1, 2, 3, E1.a, E.b); diff --git a/crates/swc/tests/tsc-references/es6/destructuring/destructuringParameterDeclaration3ES5/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/es6/destructuring/destructuringParameterDeclaration3ES5/input.ts/es5.1.normal/output.js index 12a5515176a..695ce5a473d 100644 --- a/crates/swc/tests/tsc-references/es6/destructuring/destructuringParameterDeclaration3ES5/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/es6/destructuring/destructuringParameterDeclaration3ES5/input.ts/es5.1.normal/output.js @@ -141,15 +141,15 @@ function foo() { foo("hello", 1, 2); foo("hello", "world"); var E; -(function(E2) { - E2[E2["a"] = 0] = "a"; - E2[E2["b"] = 1] = "b"; +(function(E) { + E[E["a"] = 0] = "a"; + E[E["b"] = 1] = "b"; })(E || (E = { })); var E1; -(function(E11) { - E11[E11["a"] = 0] = "a"; - E11[E11["b"] = 1] = "b"; +(function(E1) { + E1[E1["a"] = 0] = "a"; + E1[E1["b"] = 1] = "b"; })(E1 || (E1 = { })); function foo1() { diff --git a/crates/swc/tests/tsc-references/es6/destructuring/destructuringParameterDeclaration3ES5/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/es6/destructuring/destructuringParameterDeclaration3ES5/input.ts/es5.2.minified/output.js index 73a4a629559..6c95cc5b64d 100644 --- a/crates/swc/tests/tsc-references/es6/destructuring/destructuringParameterDeclaration3ES5/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/es6/destructuring/destructuringParameterDeclaration3ES5/input.ts/es5.2.minified/output.js @@ -41,7 +41,7 @@ function a10(param) { var _param = _toArray(param), a = _param[0], b = _param[1], ref = _slicedToArray(_param[2], 1), ref1 = _slicedToArray(ref[0], 1); ref1[0], _param.slice(3); } -var E, E1, E2, E11, array = [ +var E, E1, E, E1, array = [ 1, 2, 3 @@ -94,6 +94,6 @@ function foo1() { })([ 1, 2 -]), foo("hello", 1, 2), foo("hello", "world"), (E = E2 || (E2 = { -}))[E.a = 0] = "a", E[E.b = 1] = "b", (E1 = E11 || (E11 = { -}))[E1.a = 0] = "a", E1[E1.b = 1] = "b", foo1(1, 2, 3, E2.a), foo1(1, 2, 3, E11.a, E2.b); +]), foo("hello", 1, 2), foo("hello", "world"), (E = E || (E = { +}))[E.a = 0] = "a", E[E.b = 1] = "b", (E1 = E1 || (E1 = { +}))[E1.a = 0] = "a", E1[E1.b = 1] = "b", foo1(1, 2, 3, E.a), foo1(1, 2, 3, E1.a, E.b); diff --git a/crates/swc/tests/tsc-references/es6/destructuring/destructuringParameterDeclaration3ES5iterable/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/es6/destructuring/destructuringParameterDeclaration3ES5iterable/input.ts/es2015.1.normal/output.js index 706c93c0522..3c6c584c6b6 100644 --- a/crates/swc/tests/tsc-references/es6/destructuring/destructuringParameterDeclaration3ES5iterable/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/es6/destructuring/destructuringParameterDeclaration3ES5iterable/input.ts/es2015.1.normal/output.js @@ -71,15 +71,15 @@ function foo(...a) { foo("hello", 1, 2); foo("hello", "world"); var E; -(function(E2) { - E2[E2["a"] = 0] = "a"; - E2[E2["b"] = 1] = "b"; +(function(E) { + E[E["a"] = 0] = "a"; + E[E["b"] = 1] = "b"; })(E || (E = { })); var E1; -(function(E11) { - E11[E11["a"] = 0] = "a"; - E11[E11["b"] = 1] = "b"; +(function(E1) { + E1[E1["a"] = 0] = "a"; + E1[E1["b"] = 1] = "b"; })(E1 || (E1 = { })); function foo1(...a) { diff --git a/crates/swc/tests/tsc-references/es6/destructuring/destructuringParameterDeclaration3ES5iterable/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/es6/destructuring/destructuringParameterDeclaration3ES5iterable/input.ts/es2015.2.minified/output.js index cd230600e6b..f9a257b8adb 100644 --- a/crates/swc/tests/tsc-references/es6/destructuring/destructuringParameterDeclaration3ES5iterable/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/es6/destructuring/destructuringParameterDeclaration3ES5iterable/input.ts/es2015.2.minified/output.js @@ -1,4 +1,4 @@ -var E, E1, E2, E11; +var E, E1, E, E1; function a10([a, b, [[c]], ...x]) { } function foo(...a) { @@ -24,6 +24,6 @@ a10([ ]), a10([ 1, 2 -]), foo("hello", 1, 2), foo("hello", "world"), (E = E2 || (E2 = { -}))[E.a = 0] = "a", E[E.b = 1] = "b", (E1 = E11 || (E11 = { -}))[E1.a = 0] = "a", E1[E1.b = 1] = "b", foo1(1, 2, 3, E2.a), foo1(1, 2, 3, E11.a, E2.b); +]), foo("hello", 1, 2), foo("hello", "world"), (E = E || (E = { +}))[E.a = 0] = "a", E[E.b = 1] = "b", (E1 = E1 || (E1 = { +}))[E1.a = 0] = "a", E1[E1.b = 1] = "b", foo1(1, 2, 3, E.a), foo1(1, 2, 3, E1.a, E.b); diff --git a/crates/swc/tests/tsc-references/es6/destructuring/destructuringParameterDeclaration3ES5iterable/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/es6/destructuring/destructuringParameterDeclaration3ES5iterable/input.ts/es5.1.normal/output.js index 12a5515176a..695ce5a473d 100644 --- a/crates/swc/tests/tsc-references/es6/destructuring/destructuringParameterDeclaration3ES5iterable/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/es6/destructuring/destructuringParameterDeclaration3ES5iterable/input.ts/es5.1.normal/output.js @@ -141,15 +141,15 @@ function foo() { foo("hello", 1, 2); foo("hello", "world"); var E; -(function(E2) { - E2[E2["a"] = 0] = "a"; - E2[E2["b"] = 1] = "b"; +(function(E) { + E[E["a"] = 0] = "a"; + E[E["b"] = 1] = "b"; })(E || (E = { })); var E1; -(function(E11) { - E11[E11["a"] = 0] = "a"; - E11[E11["b"] = 1] = "b"; +(function(E1) { + E1[E1["a"] = 0] = "a"; + E1[E1["b"] = 1] = "b"; })(E1 || (E1 = { })); function foo1() { diff --git a/crates/swc/tests/tsc-references/es6/destructuring/destructuringParameterDeclaration3ES5iterable/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/es6/destructuring/destructuringParameterDeclaration3ES5iterable/input.ts/es5.2.minified/output.js index 73a4a629559..6c95cc5b64d 100644 --- a/crates/swc/tests/tsc-references/es6/destructuring/destructuringParameterDeclaration3ES5iterable/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/es6/destructuring/destructuringParameterDeclaration3ES5iterable/input.ts/es5.2.minified/output.js @@ -41,7 +41,7 @@ function a10(param) { var _param = _toArray(param), a = _param[0], b = _param[1], ref = _slicedToArray(_param[2], 1), ref1 = _slicedToArray(ref[0], 1); ref1[0], _param.slice(3); } -var E, E1, E2, E11, array = [ +var E, E1, E, E1, array = [ 1, 2, 3 @@ -94,6 +94,6 @@ function foo1() { })([ 1, 2 -]), foo("hello", 1, 2), foo("hello", "world"), (E = E2 || (E2 = { -}))[E.a = 0] = "a", E[E.b = 1] = "b", (E1 = E11 || (E11 = { -}))[E1.a = 0] = "a", E1[E1.b = 1] = "b", foo1(1, 2, 3, E2.a), foo1(1, 2, 3, E11.a, E2.b); +]), foo("hello", 1, 2), foo("hello", "world"), (E = E || (E = { +}))[E.a = 0] = "a", E[E.b = 1] = "b", (E1 = E1 || (E1 = { +}))[E1.a = 0] = "a", E1[E1.b = 1] = "b", foo1(1, 2, 3, E.a), foo1(1, 2, 3, E1.a, E.b); diff --git a/crates/swc/tests/tsc-references/es6/destructuring/destructuringParameterDeclaration3ES6/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/es6/destructuring/destructuringParameterDeclaration3ES6/input.ts/es2015.1.normal/output.js index 706c93c0522..3c6c584c6b6 100644 --- a/crates/swc/tests/tsc-references/es6/destructuring/destructuringParameterDeclaration3ES6/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/es6/destructuring/destructuringParameterDeclaration3ES6/input.ts/es2015.1.normal/output.js @@ -71,15 +71,15 @@ function foo(...a) { foo("hello", 1, 2); foo("hello", "world"); var E; -(function(E2) { - E2[E2["a"] = 0] = "a"; - E2[E2["b"] = 1] = "b"; +(function(E) { + E[E["a"] = 0] = "a"; + E[E["b"] = 1] = "b"; })(E || (E = { })); var E1; -(function(E11) { - E11[E11["a"] = 0] = "a"; - E11[E11["b"] = 1] = "b"; +(function(E1) { + E1[E1["a"] = 0] = "a"; + E1[E1["b"] = 1] = "b"; })(E1 || (E1 = { })); function foo1(...a) { diff --git a/crates/swc/tests/tsc-references/es6/destructuring/destructuringParameterDeclaration3ES6/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/es6/destructuring/destructuringParameterDeclaration3ES6/input.ts/es2015.2.minified/output.js index cd230600e6b..f9a257b8adb 100644 --- a/crates/swc/tests/tsc-references/es6/destructuring/destructuringParameterDeclaration3ES6/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/es6/destructuring/destructuringParameterDeclaration3ES6/input.ts/es2015.2.minified/output.js @@ -1,4 +1,4 @@ -var E, E1, E2, E11; +var E, E1, E, E1; function a10([a, b, [[c]], ...x]) { } function foo(...a) { @@ -24,6 +24,6 @@ a10([ ]), a10([ 1, 2 -]), foo("hello", 1, 2), foo("hello", "world"), (E = E2 || (E2 = { -}))[E.a = 0] = "a", E[E.b = 1] = "b", (E1 = E11 || (E11 = { -}))[E1.a = 0] = "a", E1[E1.b = 1] = "b", foo1(1, 2, 3, E2.a), foo1(1, 2, 3, E11.a, E2.b); +]), foo("hello", 1, 2), foo("hello", "world"), (E = E || (E = { +}))[E.a = 0] = "a", E[E.b = 1] = "b", (E1 = E1 || (E1 = { +}))[E1.a = 0] = "a", E1[E1.b = 1] = "b", foo1(1, 2, 3, E.a), foo1(1, 2, 3, E1.a, E.b); diff --git a/crates/swc/tests/tsc-references/es6/destructuring/destructuringParameterDeclaration3ES6/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/es6/destructuring/destructuringParameterDeclaration3ES6/input.ts/es5.1.normal/output.js index 12a5515176a..695ce5a473d 100644 --- a/crates/swc/tests/tsc-references/es6/destructuring/destructuringParameterDeclaration3ES6/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/es6/destructuring/destructuringParameterDeclaration3ES6/input.ts/es5.1.normal/output.js @@ -141,15 +141,15 @@ function foo() { foo("hello", 1, 2); foo("hello", "world"); var E; -(function(E2) { - E2[E2["a"] = 0] = "a"; - E2[E2["b"] = 1] = "b"; +(function(E) { + E[E["a"] = 0] = "a"; + E[E["b"] = 1] = "b"; })(E || (E = { })); var E1; -(function(E11) { - E11[E11["a"] = 0] = "a"; - E11[E11["b"] = 1] = "b"; +(function(E1) { + E1[E1["a"] = 0] = "a"; + E1[E1["b"] = 1] = "b"; })(E1 || (E1 = { })); function foo1() { diff --git a/crates/swc/tests/tsc-references/es6/destructuring/destructuringParameterDeclaration3ES6/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/es6/destructuring/destructuringParameterDeclaration3ES6/input.ts/es5.2.minified/output.js index 73a4a629559..6c95cc5b64d 100644 --- a/crates/swc/tests/tsc-references/es6/destructuring/destructuringParameterDeclaration3ES6/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/es6/destructuring/destructuringParameterDeclaration3ES6/input.ts/es5.2.minified/output.js @@ -41,7 +41,7 @@ function a10(param) { var _param = _toArray(param), a = _param[0], b = _param[1], ref = _slicedToArray(_param[2], 1), ref1 = _slicedToArray(ref[0], 1); ref1[0], _param.slice(3); } -var E, E1, E2, E11, array = [ +var E, E1, E, E1, array = [ 1, 2, 3 @@ -94,6 +94,6 @@ function foo1() { })([ 1, 2 -]), foo("hello", 1, 2), foo("hello", "world"), (E = E2 || (E2 = { -}))[E.a = 0] = "a", E[E.b = 1] = "b", (E1 = E11 || (E11 = { -}))[E1.a = 0] = "a", E1[E1.b = 1] = "b", foo1(1, 2, 3, E2.a), foo1(1, 2, 3, E11.a, E2.b); +]), foo("hello", 1, 2), foo("hello", "world"), (E = E || (E = { +}))[E.a = 0] = "a", E[E.b = 1] = "b", (E1 = E1 || (E1 = { +}))[E1.a = 0] = "a", E1[E1.b = 1] = "b", foo1(1, 2, 3, E.a), foo1(1, 2, 3, E1.a, E.b); diff --git a/crates/swc/tests/tsc-references/es6/for-ofStatements/for-of47/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/es6/for-ofStatements/for-of47/input.ts/es2015.1.normal/output.js index aee50c5ff91..edce9a5b237 100644 --- a/crates/swc/tests/tsc-references/es6/for-ofStatements/for-of47/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/es6/for-ofStatements/for-of47/input.ts/es2015.1.normal/output.js @@ -7,8 +7,8 @@ var array = [ } ]; var E; -(function(E1) { - E1[E1["x"] = 0] = "x"; +(function(E) { + E[E["x"] = 0] = "x"; })(E || (E = { })); for ({ x , y: y = E.x } of array){ diff --git a/crates/swc/tests/tsc-references/es6/for-ofStatements/for-of47/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/es6/for-ofStatements/for-of47/input.ts/es2015.2.minified/output.js index 8f3aa5b0748..c53766ded90 100644 --- a/crates/swc/tests/tsc-references/es6/for-ofStatements/for-of47/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/es6/for-ofStatements/for-of47/input.ts/es2015.2.minified/output.js @@ -1,6 +1,6 @@ -var x, y, E, E1; -for ({ x , y: y = E.x } of ((E1 = E || (E = { -}))[E1.x = 0] = "x", [ +var x, y, E, E; +for ({ x , y: y = E.x } of ((E = E || (E = { +}))[E.x = 0] = "x", [ { x: "", y: !0 diff --git a/crates/swc/tests/tsc-references/es6/for-ofStatements/for-of47/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/es6/for-ofStatements/for-of47/input.ts/es5.1.normal/output.js index 7c654af55e7..05405b86b6c 100644 --- a/crates/swc/tests/tsc-references/es6/for-ofStatements/for-of47/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/es6/for-ofStatements/for-of47/input.ts/es5.1.normal/output.js @@ -7,8 +7,8 @@ var array = [ } ]; var E; -(function(E1) { - E1[E1["x"] = 0] = "x"; +(function(E) { + E[E["x"] = 0] = "x"; })(E || (E = { })); var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined; diff --git a/crates/swc/tests/tsc-references/es6/for-ofStatements/for-of47/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/es6/for-ofStatements/for-of47/input.ts/es5.2.minified/output.js index d54ae4acbcc..fe9ec2664e7 100644 --- a/crates/swc/tests/tsc-references/es6/for-ofStatements/for-of47/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/es6/for-ofStatements/for-of47/input.ts/es5.2.minified/output.js @@ -1,14 +1,14 @@ var E; -(E = E1 || (E1 = { +(E = E || (E = { }))[E.x = 0] = "x"; var _iteratorNormalCompletion = !0, _didIteratorError = !1, _iteratorError = void 0; try { - for(var E1, _step, _iterator = [ + for(var E, _step, _iterator = [ { x: "", y: !0 } - ][Symbol.iterator](); !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = !0)_step.value.x; + ][Symbol.iterator](); !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = !0)_step.value.x, E.x; } catch (err) { _didIteratorError = !0, _iteratorError = err; } finally{ diff --git a/crates/swc/tests/tsc-references/es6/for-ofStatements/for-of48/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/es6/for-ofStatements/for-of48/input.ts/es2015.1.normal/output.js index f0e488f376e..809e255c891 100644 --- a/crates/swc/tests/tsc-references/es6/for-ofStatements/for-of48/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/es6/for-ofStatements/for-of48/input.ts/es2015.1.normal/output.js @@ -7,8 +7,8 @@ var array = [ } ]; var E; -(function(E1) { - E1[E1["x"] = 0] = "x"; +(function(E) { + E[E["x"] = 0] = "x"; })(E || (E = { })); for ({ x , y =E.x } of array){ diff --git a/crates/swc/tests/tsc-references/es6/for-ofStatements/for-of48/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/es6/for-ofStatements/for-of48/input.ts/es2015.2.minified/output.js index a45dca43654..3898b1e1101 100644 --- a/crates/swc/tests/tsc-references/es6/for-ofStatements/for-of48/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/es6/for-ofStatements/for-of48/input.ts/es2015.2.minified/output.js @@ -1,6 +1,6 @@ -var x, y, E, E1; -for ({ x , y =E.x } of ((E1 = E || (E = { -}))[E1.x = 0] = "x", [ +var x, y, E, E; +for ({ x , y =E.x } of ((E = E || (E = { +}))[E.x = 0] = "x", [ { x: "", y: !0 diff --git a/crates/swc/tests/tsc-references/es6/for-ofStatements/for-of48/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/es6/for-ofStatements/for-of48/input.ts/es5.1.normal/output.js index df7eea64966..e12230bfcf8 100644 --- a/crates/swc/tests/tsc-references/es6/for-ofStatements/for-of48/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/es6/for-ofStatements/for-of48/input.ts/es5.1.normal/output.js @@ -7,8 +7,8 @@ var array = [ } ]; var E; -(function(E1) { - E1[E1["x"] = 0] = "x"; +(function(E) { + E[E["x"] = 0] = "x"; })(E || (E = { })); var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined; diff --git a/crates/swc/tests/tsc-references/es6/for-ofStatements/for-of48/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/es6/for-ofStatements/for-of48/input.ts/es5.2.minified/output.js index 246b1f67059..a3b179dd914 100644 --- a/crates/swc/tests/tsc-references/es6/for-ofStatements/for-of48/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/es6/for-ofStatements/for-of48/input.ts/es5.2.minified/output.js @@ -1,14 +1,14 @@ var E; -(E = E1 || (E1 = { +(E = E || (E = { }))[E.x = 0] = "x"; var _iteratorNormalCompletion = !0, _didIteratorError = !1, _iteratorError = void 0; try { - for(var E1, ref, ref1, _step, _iterator = [ + for(var E, ref, ref1, _step, _iterator = [ { x: "", y: !0 } - ][Symbol.iterator](); !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = !0)(ref = _step.value).x, ref1 = ref.y, void 0 === ref1; + ][Symbol.iterator](); !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = !0)(ref = _step.value).x, ref1 = ref.y, void 0 === ref1 && E.x; } catch (err) { _didIteratorError = !0, _iteratorError = err; } finally{ diff --git a/crates/swc/tests/tsc-references/es6/modules/exportsAndImports1-amd/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/es6/modules/exportsAndImports1-amd/input.ts/es2015.1.normal/output.js index 11059e5b723..2dd42039840 100644 --- a/crates/swc/tests/tsc-references/es6/modules/exportsAndImports1-amd/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/es6/modules/exportsAndImports1-amd/input.ts/es2015.1.normal/output.js @@ -9,17 +9,17 @@ function f() { class C { } var E; -(function(E1) { - E1[E1["A"] = 0] = "A"; - E1[E1["B"] = 1] = "B"; - E1[E1["C"] = 2] = "C"; +(function(E) { + E[E["A"] = 0] = "A"; + E[E["B"] = 1] = "B"; + E[E["C"] = 2] = "C"; })(E || (E = { })); var D; -(function(D1) { - D1[D1["A"] = 0] = "A"; - D1[D1["B"] = 1] = "B"; - D1[D1["C"] = 2] = "C"; +(function(D) { + D[D["A"] = 0] = "A"; + D[D["B"] = 1] = "B"; + D[D["C"] = 2] = "C"; })(D || (D = { })); var M; diff --git a/crates/swc/tests/tsc-references/es6/modules/exportsAndImports1-amd/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/es6/modules/exportsAndImports1-amd/input.ts/es2015.2.minified/output.js index 035d49c6283..6c22055f414 100644 --- a/crates/swc/tests/tsc-references/es6/modules/exportsAndImports1-amd/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/es6/modules/exportsAndImports1-amd/input.ts/es2015.2.minified/output.js @@ -3,14 +3,14 @@ function f() { } class C { } -(E1 = E || (E = { -}))[E1.A = 0] = "A", E1[E1.B = 1] = "B", E1[E1.C = 2] = "C", (D1 = D || (D = { -}))[D1.A = 0] = "A", D1[D1.B = 1] = "B", D1[D1.C = 2] = "C", (function(M1) { +(E = E || (E = { +}))[E.A = 0] = "A", E[E.B = 1] = "B", E[E.C = 2] = "C", (D = D || (D = { +}))[D.A = 0] = "A", D[D.B = 1] = "B", D[D.C = 2] = "C", (function(M1) { var x; M1.x = x; })(M || (M = { })); -var E, D, M, v, E1, D1, a = M.x; +var E, D, M, v, E, D, a = M.x; export { v, f, C, E, D, a }; export { v, f, C, E, D, a } from "./t1"; export { v, f, C, E, D, a }; diff --git a/crates/swc/tests/tsc-references/es6/modules/exportsAndImports1-amd/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/es6/modules/exportsAndImports1-amd/input.ts/es5.1.normal/output.js index b7895f2b785..32348340f70 100644 --- a/crates/swc/tests/tsc-references/es6/modules/exportsAndImports1-amd/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/es6/modules/exportsAndImports1-amd/input.ts/es5.1.normal/output.js @@ -16,17 +16,17 @@ var C = function C() { _classCallCheck(this, C); }; var E; -(function(E1) { - E1[E1["A"] = 0] = "A"; - E1[E1["B"] = 1] = "B"; - E1[E1["C"] = 2] = "C"; +(function(E) { + E[E["A"] = 0] = "A"; + E[E["B"] = 1] = "B"; + E[E["C"] = 2] = "C"; })(E || (E = { })); var D; -(function(D1) { - D1[D1["A"] = 0] = "A"; - D1[D1["B"] = 1] = "B"; - D1[D1["C"] = 2] = "C"; +(function(D) { + D[D["A"] = 0] = "A"; + D[D["B"] = 1] = "B"; + D[D["C"] = 2] = "C"; })(D || (D = { })); var M; diff --git a/crates/swc/tests/tsc-references/es6/modules/exportsAndImports1-amd/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/es6/modules/exportsAndImports1-amd/input.ts/es5.2.minified/output.js index a6551cfa7d9..0686f078cbb 100644 --- a/crates/swc/tests/tsc-references/es6/modules/exportsAndImports1-amd/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/es6/modules/exportsAndImports1-amd/input.ts/es5.2.minified/output.js @@ -1,20 +1,20 @@ import { I, M, N, T, a } from "./t1"; function f() { } -var D, E, D1, M, v, E1, C = function() { +var D, E, D, M, v, E, C = function() { "use strict"; !function(instance, Constructor) { if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function"); }(this, C); }; -(E1 = E || (E = { -}))[E1.A = 0] = "A", E1[E1.B = 1] = "B", E1[E1.C = 2] = "C", (D = D1 || (D1 = { +(E = E || (E = { +}))[E.A = 0] = "A", E[E.B = 1] = "B", E[E.C = 2] = "C", (D = D || (D = { }))[D.A = 0] = "A", D[D.B = 1] = "B", D[D.C = 2] = "C", (function(M1) { var x; M1.x = x; })(M || (M = { })); var a = M.x; -export { v, f, C, E, D1 as D, a }; -export { v, f, C, E, D1 as D, a } from "./t1"; -export { v, f, C, E, D1 as D, a }; +export { v, f, C, E, D, a }; +export { v, f, C, E, D, a } from "./t1"; +export { v, f, C, E, D, a }; diff --git a/crates/swc/tests/tsc-references/es6/modules/exportsAndImports1-es6/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/es6/modules/exportsAndImports1-es6/input.ts/es2015.1.normal/output.js index a38fe473dea..75179a01c96 100644 --- a/crates/swc/tests/tsc-references/es6/modules/exportsAndImports1-es6/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/es6/modules/exportsAndImports1-es6/input.ts/es2015.1.normal/output.js @@ -9,17 +9,17 @@ function f() { class C { } var E; -(function(E1) { - E1[E1["A"] = 0] = "A"; - E1[E1["B"] = 1] = "B"; - E1[E1["C"] = 2] = "C"; +(function(E) { + E[E["A"] = 0] = "A"; + E[E["B"] = 1] = "B"; + E[E["C"] = 2] = "C"; })(E || (E = { })); var D; -(function(D1) { - D1[D1["A"] = 0] = "A"; - D1[D1["B"] = 1] = "B"; - D1[D1["C"] = 2] = "C"; +(function(D) { + D[D["A"] = 0] = "A"; + D[D["B"] = 1] = "B"; + D[D["C"] = 2] = "C"; })(D || (D = { })); var M; diff --git a/crates/swc/tests/tsc-references/es6/modules/exportsAndImports1-es6/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/es6/modules/exportsAndImports1-es6/input.ts/es2015.2.minified/output.js index 035d49c6283..6c22055f414 100644 --- a/crates/swc/tests/tsc-references/es6/modules/exportsAndImports1-es6/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/es6/modules/exportsAndImports1-es6/input.ts/es2015.2.minified/output.js @@ -3,14 +3,14 @@ function f() { } class C { } -(E1 = E || (E = { -}))[E1.A = 0] = "A", E1[E1.B = 1] = "B", E1[E1.C = 2] = "C", (D1 = D || (D = { -}))[D1.A = 0] = "A", D1[D1.B = 1] = "B", D1[D1.C = 2] = "C", (function(M1) { +(E = E || (E = { +}))[E.A = 0] = "A", E[E.B = 1] = "B", E[E.C = 2] = "C", (D = D || (D = { +}))[D.A = 0] = "A", D[D.B = 1] = "B", D[D.C = 2] = "C", (function(M1) { var x; M1.x = x; })(M || (M = { })); -var E, D, M, v, E1, D1, a = M.x; +var E, D, M, v, E, D, a = M.x; export { v, f, C, E, D, a }; export { v, f, C, E, D, a } from "./t1"; export { v, f, C, E, D, a }; diff --git a/crates/swc/tests/tsc-references/es6/modules/exportsAndImports1-es6/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/es6/modules/exportsAndImports1-es6/input.ts/es5.1.normal/output.js index 92333aa022d..ff505345fa3 100644 --- a/crates/swc/tests/tsc-references/es6/modules/exportsAndImports1-es6/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/es6/modules/exportsAndImports1-es6/input.ts/es5.1.normal/output.js @@ -16,17 +16,17 @@ var C = function C() { _classCallCheck(this, C); }; var E; -(function(E1) { - E1[E1["A"] = 0] = "A"; - E1[E1["B"] = 1] = "B"; - E1[E1["C"] = 2] = "C"; +(function(E) { + E[E["A"] = 0] = "A"; + E[E["B"] = 1] = "B"; + E[E["C"] = 2] = "C"; })(E || (E = { })); var D; -(function(D1) { - D1[D1["A"] = 0] = "A"; - D1[D1["B"] = 1] = "B"; - D1[D1["C"] = 2] = "C"; +(function(D) { + D[D["A"] = 0] = "A"; + D[D["B"] = 1] = "B"; + D[D["C"] = 2] = "C"; })(D || (D = { })); var M; diff --git a/crates/swc/tests/tsc-references/es6/modules/exportsAndImports1-es6/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/es6/modules/exportsAndImports1-es6/input.ts/es5.2.minified/output.js index a6551cfa7d9..0686f078cbb 100644 --- a/crates/swc/tests/tsc-references/es6/modules/exportsAndImports1-es6/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/es6/modules/exportsAndImports1-es6/input.ts/es5.2.minified/output.js @@ -1,20 +1,20 @@ import { I, M, N, T, a } from "./t1"; function f() { } -var D, E, D1, M, v, E1, C = function() { +var D, E, D, M, v, E, C = function() { "use strict"; !function(instance, Constructor) { if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function"); }(this, C); }; -(E1 = E || (E = { -}))[E1.A = 0] = "A", E1[E1.B = 1] = "B", E1[E1.C = 2] = "C", (D = D1 || (D1 = { +(E = E || (E = { +}))[E.A = 0] = "A", E[E.B = 1] = "B", E[E.C = 2] = "C", (D = D || (D = { }))[D.A = 0] = "A", D[D.B = 1] = "B", D[D.C = 2] = "C", (function(M1) { var x; M1.x = x; })(M || (M = { })); var a = M.x; -export { v, f, C, E, D1 as D, a }; -export { v, f, C, E, D1 as D, a } from "./t1"; -export { v, f, C, E, D1 as D, a }; +export { v, f, C, E, D, a }; +export { v, f, C, E, D, a } from "./t1"; +export { v, f, C, E, D, a }; diff --git a/crates/swc/tests/tsc-references/es6/modules/exportsAndImports1/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/es6/modules/exportsAndImports1/input.ts/es2015.1.normal/output.js index fcc448656ef..1c81c16ac9e 100644 --- a/crates/swc/tests/tsc-references/es6/modules/exportsAndImports1/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/es6/modules/exportsAndImports1/input.ts/es2015.1.normal/output.js @@ -8,17 +8,17 @@ function f() { class C { } var E; -(function(E1) { - E1[E1["A"] = 0] = "A"; - E1[E1["B"] = 1] = "B"; - E1[E1["C"] = 2] = "C"; +(function(E) { + E[E["A"] = 0] = "A"; + E[E["B"] = 1] = "B"; + E[E["C"] = 2] = "C"; })(E || (E = { })); var D; -(function(D1) { - D1[D1["A"] = 0] = "A"; - D1[D1["B"] = 1] = "B"; - D1[D1["C"] = 2] = "C"; +(function(D) { + D[D["A"] = 0] = "A"; + D[D["B"] = 1] = "B"; + D[D["C"] = 2] = "C"; })(D || (D = { })); var M; diff --git a/crates/swc/tests/tsc-references/es6/modules/exportsAndImports1/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/es6/modules/exportsAndImports1/input.ts/es2015.2.minified/output.js index 035d49c6283..6c22055f414 100644 --- a/crates/swc/tests/tsc-references/es6/modules/exportsAndImports1/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/es6/modules/exportsAndImports1/input.ts/es2015.2.minified/output.js @@ -3,14 +3,14 @@ function f() { } class C { } -(E1 = E || (E = { -}))[E1.A = 0] = "A", E1[E1.B = 1] = "B", E1[E1.C = 2] = "C", (D1 = D || (D = { -}))[D1.A = 0] = "A", D1[D1.B = 1] = "B", D1[D1.C = 2] = "C", (function(M1) { +(E = E || (E = { +}))[E.A = 0] = "A", E[E.B = 1] = "B", E[E.C = 2] = "C", (D = D || (D = { +}))[D.A = 0] = "A", D[D.B = 1] = "B", D[D.C = 2] = "C", (function(M1) { var x; M1.x = x; })(M || (M = { })); -var E, D, M, v, E1, D1, a = M.x; +var E, D, M, v, E, D, a = M.x; export { v, f, C, E, D, a }; export { v, f, C, E, D, a } from "./t1"; export { v, f, C, E, D, a }; diff --git a/crates/swc/tests/tsc-references/es6/modules/exportsAndImports1/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/es6/modules/exportsAndImports1/input.ts/es5.1.normal/output.js index 96af5b9f7cd..5e9d7b935b5 100644 --- a/crates/swc/tests/tsc-references/es6/modules/exportsAndImports1/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/es6/modules/exportsAndImports1/input.ts/es5.1.normal/output.js @@ -15,17 +15,17 @@ var C = function C() { _classCallCheck(this, C); }; var E; -(function(E1) { - E1[E1["A"] = 0] = "A"; - E1[E1["B"] = 1] = "B"; - E1[E1["C"] = 2] = "C"; +(function(E) { + E[E["A"] = 0] = "A"; + E[E["B"] = 1] = "B"; + E[E["C"] = 2] = "C"; })(E || (E = { })); var D; -(function(D1) { - D1[D1["A"] = 0] = "A"; - D1[D1["B"] = 1] = "B"; - D1[D1["C"] = 2] = "C"; +(function(D) { + D[D["A"] = 0] = "A"; + D[D["B"] = 1] = "B"; + D[D["C"] = 2] = "C"; })(D || (D = { })); var M; diff --git a/crates/swc/tests/tsc-references/es6/modules/exportsAndImports1/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/es6/modules/exportsAndImports1/input.ts/es5.2.minified/output.js index a6551cfa7d9..0686f078cbb 100644 --- a/crates/swc/tests/tsc-references/es6/modules/exportsAndImports1/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/es6/modules/exportsAndImports1/input.ts/es5.2.minified/output.js @@ -1,20 +1,20 @@ import { I, M, N, T, a } from "./t1"; function f() { } -var D, E, D1, M, v, E1, C = function() { +var D, E, D, M, v, E, C = function() { "use strict"; !function(instance, Constructor) { if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function"); }(this, C); }; -(E1 = E || (E = { -}))[E1.A = 0] = "A", E1[E1.B = 1] = "B", E1[E1.C = 2] = "C", (D = D1 || (D1 = { +(E = E || (E = { +}))[E.A = 0] = "A", E[E.B = 1] = "B", E[E.C = 2] = "C", (D = D || (D = { }))[D.A = 0] = "A", D[D.B = 1] = "B", D[D.C = 2] = "C", (function(M1) { var x; M1.x = x; })(M || (M = { })); var a = M.x; -export { v, f, C, E, D1 as D, a }; -export { v, f, C, E, D1 as D, a } from "./t1"; -export { v, f, C, E, D1 as D, a }; +export { v, f, C, E, D, a }; +export { v, f, C, E, D, a } from "./t1"; +export { v, f, C, E, D, a }; diff --git a/crates/swc/tests/tsc-references/es6/modules/exportsAndImports3-amd/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/es6/modules/exportsAndImports3-amd/input.ts/es2015.1.normal/output.js index a67ef27ab3a..2aef7851c02 100644 --- a/crates/swc/tests/tsc-references/es6/modules/exportsAndImports3-amd/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/es6/modules/exportsAndImports3-amd/input.ts/es2015.1.normal/output.js @@ -9,17 +9,17 @@ export function f() { export class C { } export var E; -(function(E1) { - E1[E1["A"] = 0] = "A"; - E1[E1["B"] = 1] = "B"; - E1[E1["C"] = 2] = "C"; +(function(E) { + E[E["A"] = 0] = "A"; + E[E["B"] = 1] = "B"; + E[E["C"] = 2] = "C"; })(E || (E = { })); export var D; -(function(D1) { - D1[D1["A"] = 0] = "A"; - D1[D1["B"] = 1] = "B"; - D1[D1["C"] = 2] = "C"; +(function(D) { + D[D["A"] = 0] = "A"; + D[D["B"] = 1] = "B"; + D[D["C"] = 2] = "C"; })(D || (D = { })); export var M; diff --git a/crates/swc/tests/tsc-references/es6/modules/exportsAndImports3-amd/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/es6/modules/exportsAndImports3-amd/input.ts/es2015.2.minified/output.js index 9aae33719ac..83aee72b823 100644 --- a/crates/swc/tests/tsc-references/es6/modules/exportsAndImports3-amd/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/es6/modules/exportsAndImports3-amd/input.ts/es2015.2.minified/output.js @@ -3,15 +3,14 @@ export function f() { } export class C { } -(E1 = E || (E = { -}))[E1.A = 0] = "A", E1[E1.B = 1] = "B", E1[E1.C = 2] = "C", (D1 = D || (D = { -}))[D1.A = 0] = "A", D1[D1.B = 1] = "B", D1[D1.C = 2] = "C", (function(M1) { +(E = E || (E = { +}))[E.A = 0] = "A", E[E.B = 1] = "B", E[E.C = 2] = "C", (D = D || (D = { +}))[D.A = 0] = "A", D[D.B = 1] = "B", D[D.C = 2] = "C", (function(M1) { var x; M1.x = x; })(M || (M = { })); -var E, D, M, v, E1, D1, a = M.x; -export { E1 as E, D1 as D }; +export var E, D, M, v, E, D, a = M.x; export { v as v1, f as f1, C as C1, E as E1, D as D1, a as a1 }; export { v1 as v, f1 as f, C1 as C, I1 as I, E1 as E, D1 as D, M1 as M, N1 as N, T1 as T, a1 as a } from "./t1"; export { v, f, C, E, D, a }; diff --git a/crates/swc/tests/tsc-references/es6/modules/exportsAndImports3-amd/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/es6/modules/exportsAndImports3-amd/input.ts/es5.1.normal/output.js index b9187c1e615..29bc30d701b 100644 --- a/crates/swc/tests/tsc-references/es6/modules/exportsAndImports3-amd/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/es6/modules/exportsAndImports3-amd/input.ts/es5.1.normal/output.js @@ -16,17 +16,17 @@ export var C = function C() { _classCallCheck(this, C); }; export var E; -(function(E1) { - E1[E1["A"] = 0] = "A"; - E1[E1["B"] = 1] = "B"; - E1[E1["C"] = 2] = "C"; +(function(E) { + E[E["A"] = 0] = "A"; + E[E["B"] = 1] = "B"; + E[E["C"] = 2] = "C"; })(E || (E = { })); export var D; -(function(D1) { - D1[D1["A"] = 0] = "A"; - D1[D1["B"] = 1] = "B"; - D1[D1["C"] = 2] = "C"; +(function(D) { + D[D["A"] = 0] = "A"; + D[D["B"] = 1] = "B"; + D[D["C"] = 2] = "C"; })(D || (D = { })); export var M; diff --git a/crates/swc/tests/tsc-references/es6/modules/exportsAndImports3-amd/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/es6/modules/exportsAndImports3-amd/input.ts/es5.2.minified/output.js index 6ebde9d4590..29feec95649 100644 --- a/crates/swc/tests/tsc-references/es6/modules/exportsAndImports3-amd/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/es6/modules/exportsAndImports3-amd/input.ts/es5.2.minified/output.js @@ -1,16 +1,15 @@ import { I1 as I, M1 as M, N1 as N, T1 as T, a1 as a } from "./t1"; export function f() { } -var E, D, M, v, E1, D1, C = function() { +export var E, D, M, v, E, D, C = function() { "use strict"; !function(instance, Constructor) { if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function"); }(this, C); }; -export { E1 as E, D1 as D }; -(E1 = E || (E = { -}))[E1.A = 0] = "A", E1[E1.B = 1] = "B", E1[E1.C = 2] = "C", (D1 = D || (D = { -}))[D1.A = 0] = "A", D1[D1.B = 1] = "B", D1[D1.C = 2] = "C", (function(M1) { +(E = E || (E = { +}))[E.A = 0] = "A", E[E.B = 1] = "B", E[E.C = 2] = "C", (D = D || (D = { +}))[D.A = 0] = "A", D[D.B = 1] = "B", D[D.C = 2] = "C", (function(M1) { var x; M1.x = x; })(M || (M = { diff --git a/crates/swc/tests/tsc-references/es6/modules/exportsAndImports3-es6/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/es6/modules/exportsAndImports3-es6/input.ts/es2015.1.normal/output.js index a484a6a5bbf..bfea0a049ce 100644 --- a/crates/swc/tests/tsc-references/es6/modules/exportsAndImports3-es6/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/es6/modules/exportsAndImports3-es6/input.ts/es2015.1.normal/output.js @@ -9,17 +9,17 @@ export function f() { export class C { } export var E; -(function(E1) { - E1[E1["A"] = 0] = "A"; - E1[E1["B"] = 1] = "B"; - E1[E1["C"] = 2] = "C"; +(function(E) { + E[E["A"] = 0] = "A"; + E[E["B"] = 1] = "B"; + E[E["C"] = 2] = "C"; })(E || (E = { })); export var D; -(function(D1) { - D1[D1["A"] = 0] = "A"; - D1[D1["B"] = 1] = "B"; - D1[D1["C"] = 2] = "C"; +(function(D) { + D[D["A"] = 0] = "A"; + D[D["B"] = 1] = "B"; + D[D["C"] = 2] = "C"; })(D || (D = { })); export var M; diff --git a/crates/swc/tests/tsc-references/es6/modules/exportsAndImports3-es6/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/es6/modules/exportsAndImports3-es6/input.ts/es2015.2.minified/output.js index 9aae33719ac..83aee72b823 100644 --- a/crates/swc/tests/tsc-references/es6/modules/exportsAndImports3-es6/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/es6/modules/exportsAndImports3-es6/input.ts/es2015.2.minified/output.js @@ -3,15 +3,14 @@ export function f() { } export class C { } -(E1 = E || (E = { -}))[E1.A = 0] = "A", E1[E1.B = 1] = "B", E1[E1.C = 2] = "C", (D1 = D || (D = { -}))[D1.A = 0] = "A", D1[D1.B = 1] = "B", D1[D1.C = 2] = "C", (function(M1) { +(E = E || (E = { +}))[E.A = 0] = "A", E[E.B = 1] = "B", E[E.C = 2] = "C", (D = D || (D = { +}))[D.A = 0] = "A", D[D.B = 1] = "B", D[D.C = 2] = "C", (function(M1) { var x; M1.x = x; })(M || (M = { })); -var E, D, M, v, E1, D1, a = M.x; -export { E1 as E, D1 as D }; +export var E, D, M, v, E, D, a = M.x; export { v as v1, f as f1, C as C1, E as E1, D as D1, a as a1 }; export { v1 as v, f1 as f, C1 as C, I1 as I, E1 as E, D1 as D, M1 as M, N1 as N, T1 as T, a1 as a } from "./t1"; export { v, f, C, E, D, a }; diff --git a/crates/swc/tests/tsc-references/es6/modules/exportsAndImports3-es6/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/es6/modules/exportsAndImports3-es6/input.ts/es5.1.normal/output.js index b8cff9849da..e784b1b60aa 100644 --- a/crates/swc/tests/tsc-references/es6/modules/exportsAndImports3-es6/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/es6/modules/exportsAndImports3-es6/input.ts/es5.1.normal/output.js @@ -16,17 +16,17 @@ export var C = function C() { _classCallCheck(this, C); }; export var E; -(function(E1) { - E1[E1["A"] = 0] = "A"; - E1[E1["B"] = 1] = "B"; - E1[E1["C"] = 2] = "C"; +(function(E) { + E[E["A"] = 0] = "A"; + E[E["B"] = 1] = "B"; + E[E["C"] = 2] = "C"; })(E || (E = { })); export var D; -(function(D1) { - D1[D1["A"] = 0] = "A"; - D1[D1["B"] = 1] = "B"; - D1[D1["C"] = 2] = "C"; +(function(D) { + D[D["A"] = 0] = "A"; + D[D["B"] = 1] = "B"; + D[D["C"] = 2] = "C"; })(D || (D = { })); export var M; diff --git a/crates/swc/tests/tsc-references/es6/modules/exportsAndImports3-es6/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/es6/modules/exportsAndImports3-es6/input.ts/es5.2.minified/output.js index 6ebde9d4590..29feec95649 100644 --- a/crates/swc/tests/tsc-references/es6/modules/exportsAndImports3-es6/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/es6/modules/exportsAndImports3-es6/input.ts/es5.2.minified/output.js @@ -1,16 +1,15 @@ import { I1 as I, M1 as M, N1 as N, T1 as T, a1 as a } from "./t1"; export function f() { } -var E, D, M, v, E1, D1, C = function() { +export var E, D, M, v, E, D, C = function() { "use strict"; !function(instance, Constructor) { if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function"); }(this, C); }; -export { E1 as E, D1 as D }; -(E1 = E || (E = { -}))[E1.A = 0] = "A", E1[E1.B = 1] = "B", E1[E1.C = 2] = "C", (D1 = D || (D = { -}))[D1.A = 0] = "A", D1[D1.B = 1] = "B", D1[D1.C = 2] = "C", (function(M1) { +(E = E || (E = { +}))[E.A = 0] = "A", E[E.B = 1] = "B", E[E.C = 2] = "C", (D = D || (D = { +}))[D.A = 0] = "A", D[D.B = 1] = "B", D[D.C = 2] = "C", (function(M1) { var x; M1.x = x; })(M || (M = { diff --git a/crates/swc/tests/tsc-references/es6/modules/exportsAndImports3/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/es6/modules/exportsAndImports3/input.ts/es2015.1.normal/output.js index cb0e83e609b..e59cfb73513 100644 --- a/crates/swc/tests/tsc-references/es6/modules/exportsAndImports3/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/es6/modules/exportsAndImports3/input.ts/es2015.1.normal/output.js @@ -8,17 +8,17 @@ export function f() { export class C { } export var E; -(function(E1) { - E1[E1["A"] = 0] = "A"; - E1[E1["B"] = 1] = "B"; - E1[E1["C"] = 2] = "C"; +(function(E) { + E[E["A"] = 0] = "A"; + E[E["B"] = 1] = "B"; + E[E["C"] = 2] = "C"; })(E || (E = { })); export var D; -(function(D1) { - D1[D1["A"] = 0] = "A"; - D1[D1["B"] = 1] = "B"; - D1[D1["C"] = 2] = "C"; +(function(D) { + D[D["A"] = 0] = "A"; + D[D["B"] = 1] = "B"; + D[D["C"] = 2] = "C"; })(D || (D = { })); export var M; diff --git a/crates/swc/tests/tsc-references/es6/modules/exportsAndImports3/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/es6/modules/exportsAndImports3/input.ts/es2015.2.minified/output.js index 9aae33719ac..83aee72b823 100644 --- a/crates/swc/tests/tsc-references/es6/modules/exportsAndImports3/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/es6/modules/exportsAndImports3/input.ts/es2015.2.minified/output.js @@ -3,15 +3,14 @@ export function f() { } export class C { } -(E1 = E || (E = { -}))[E1.A = 0] = "A", E1[E1.B = 1] = "B", E1[E1.C = 2] = "C", (D1 = D || (D = { -}))[D1.A = 0] = "A", D1[D1.B = 1] = "B", D1[D1.C = 2] = "C", (function(M1) { +(E = E || (E = { +}))[E.A = 0] = "A", E[E.B = 1] = "B", E[E.C = 2] = "C", (D = D || (D = { +}))[D.A = 0] = "A", D[D.B = 1] = "B", D[D.C = 2] = "C", (function(M1) { var x; M1.x = x; })(M || (M = { })); -var E, D, M, v, E1, D1, a = M.x; -export { E1 as E, D1 as D }; +export var E, D, M, v, E, D, a = M.x; export { v as v1, f as f1, C as C1, E as E1, D as D1, a as a1 }; export { v1 as v, f1 as f, C1 as C, I1 as I, E1 as E, D1 as D, M1 as M, N1 as N, T1 as T, a1 as a } from "./t1"; export { v, f, C, E, D, a }; diff --git a/crates/swc/tests/tsc-references/es6/modules/exportsAndImports3/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/es6/modules/exportsAndImports3/input.ts/es5.1.normal/output.js index d98465643cd..c731848dc9b 100644 --- a/crates/swc/tests/tsc-references/es6/modules/exportsAndImports3/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/es6/modules/exportsAndImports3/input.ts/es5.1.normal/output.js @@ -15,17 +15,17 @@ export var C = function C() { _classCallCheck(this, C); }; export var E; -(function(E1) { - E1[E1["A"] = 0] = "A"; - E1[E1["B"] = 1] = "B"; - E1[E1["C"] = 2] = "C"; +(function(E) { + E[E["A"] = 0] = "A"; + E[E["B"] = 1] = "B"; + E[E["C"] = 2] = "C"; })(E || (E = { })); export var D; -(function(D1) { - D1[D1["A"] = 0] = "A"; - D1[D1["B"] = 1] = "B"; - D1[D1["C"] = 2] = "C"; +(function(D) { + D[D["A"] = 0] = "A"; + D[D["B"] = 1] = "B"; + D[D["C"] = 2] = "C"; })(D || (D = { })); export var M; diff --git a/crates/swc/tests/tsc-references/es6/modules/exportsAndImports3/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/es6/modules/exportsAndImports3/input.ts/es5.2.minified/output.js index 6ebde9d4590..29feec95649 100644 --- a/crates/swc/tests/tsc-references/es6/modules/exportsAndImports3/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/es6/modules/exportsAndImports3/input.ts/es5.2.minified/output.js @@ -1,16 +1,15 @@ import { I1 as I, M1 as M, N1 as N, T1 as T, a1 as a } from "./t1"; export function f() { } -var E, D, M, v, E1, D1, C = function() { +export var E, D, M, v, E, D, C = function() { "use strict"; !function(instance, Constructor) { if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function"); }(this, C); }; -export { E1 as E, D1 as D }; -(E1 = E || (E = { -}))[E1.A = 0] = "A", E1[E1.B = 1] = "B", E1[E1.C = 2] = "C", (D1 = D || (D = { -}))[D1.A = 0] = "A", D1[D1.B = 1] = "B", D1[D1.C = 2] = "C", (function(M1) { +(E = E || (E = { +}))[E.A = 0] = "A", E[E.B = 1] = "B", E[E.C = 2] = "C", (D = D || (D = { +}))[D.A = 0] = "A", D[D.B = 1] = "B", D[D.C = 2] = "C", (function(M1) { var x; M1.x = x; })(M || (M = { diff --git a/crates/swc/tests/tsc-references/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCanBeAssigned1/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCanBeAssigned1/input.ts/es2015.1.normal/output.js index c01959528b2..06f91b6d133 100644 --- a/crates/swc/tests/tsc-references/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCanBeAssigned1/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCanBeAssigned1/input.ts/es2015.1.normal/output.js @@ -1,8 +1,8 @@ var E; -(function(E1) { - E1[E1["a"] = 0] = "a"; - E1[E1["b"] = 1] = "b"; - E1[E1["c"] = 2] = "c"; +(function(E) { + E[E["a"] = 0] = "a"; + E[E["b"] = 1] = "b"; + E[E["c"] = 2] = "c"; })(E || (E = { })); var a; diff --git a/crates/swc/tests/tsc-references/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCanBeAssigned1/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCanBeAssigned1/input.ts/es2015.2.minified/output.js index dd3a78eeac5..0d89e56da56 100644 --- a/crates/swc/tests/tsc-references/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCanBeAssigned1/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCanBeAssigned1/input.ts/es2015.2.minified/output.js @@ -1,3 +1,3 @@ -var E, a, b, c, x1, x2, x3, E1; -(E1 = E || (E = { -}))[E1.a = 0] = "a", E1[E1.b = 1] = "b", E1[E1.c = 2] = "c", x1 = Math.pow(x1, a) = Math.pow(x1, b), x1 = Math.pow(x1, c) = Math.pow(x1, null), x1 = Math.pow(x1, void 0), x2 = Math.pow(x2, a), x2 = Math.pow(x2, b), x2 = Math.pow(x2, c), x2 = Math.pow(x2, null), x2 = Math.pow(x2, void 0), x3 = Math.pow(x3, a), x3 = Math.pow(x3, b), x3 = Math.pow(x3, c), x3 = Math.pow(x3, null), x3 = Math.pow(x3, void 0); +var E, a, b, c, x1, x2, x3, E; +(E = E || (E = { +}))[E.a = 0] = "a", E[E.b = 1] = "b", E[E.c = 2] = "c", x1 = Math.pow(x1, a) = Math.pow(x1, b), x1 = Math.pow(x1, c) = Math.pow(x1, null), x1 = Math.pow(x1, void 0), x2 = Math.pow(x2, a), x2 = Math.pow(x2, b), x2 = Math.pow(x2, c), x2 = Math.pow(x2, null), x2 = Math.pow(x2, void 0), x3 = Math.pow(x3, a), x3 = Math.pow(x3, b), x3 = Math.pow(x3, c), x3 = Math.pow(x3, null), x3 = Math.pow(x3, void 0); diff --git a/crates/swc/tests/tsc-references/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCanBeAssigned1/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCanBeAssigned1/input.ts/es5.1.normal/output.js index c01959528b2..06f91b6d133 100644 --- a/crates/swc/tests/tsc-references/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCanBeAssigned1/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCanBeAssigned1/input.ts/es5.1.normal/output.js @@ -1,8 +1,8 @@ var E; -(function(E1) { - E1[E1["a"] = 0] = "a"; - E1[E1["b"] = 1] = "b"; - E1[E1["c"] = 2] = "c"; +(function(E) { + E[E["a"] = 0] = "a"; + E[E["b"] = 1] = "b"; + E[E["c"] = 2] = "c"; })(E || (E = { })); var a; diff --git a/crates/swc/tests/tsc-references/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCanBeAssigned1/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCanBeAssigned1/input.ts/es5.2.minified/output.js index dd3a78eeac5..0d89e56da56 100644 --- a/crates/swc/tests/tsc-references/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCanBeAssigned1/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCanBeAssigned1/input.ts/es5.2.minified/output.js @@ -1,3 +1,3 @@ -var E, a, b, c, x1, x2, x3, E1; -(E1 = E || (E = { -}))[E1.a = 0] = "a", E1[E1.b = 1] = "b", E1[E1.c = 2] = "c", x1 = Math.pow(x1, a) = Math.pow(x1, b), x1 = Math.pow(x1, c) = Math.pow(x1, null), x1 = Math.pow(x1, void 0), x2 = Math.pow(x2, a), x2 = Math.pow(x2, b), x2 = Math.pow(x2, c), x2 = Math.pow(x2, null), x2 = Math.pow(x2, void 0), x3 = Math.pow(x3, a), x3 = Math.pow(x3, b), x3 = Math.pow(x3, c), x3 = Math.pow(x3, null), x3 = Math.pow(x3, void 0); +var E, a, b, c, x1, x2, x3, E; +(E = E || (E = { +}))[E.a = 0] = "a", E[E.b = 1] = "b", E[E.c = 2] = "c", x1 = Math.pow(x1, a) = Math.pow(x1, b), x1 = Math.pow(x1, c) = Math.pow(x1, null), x1 = Math.pow(x1, void 0), x2 = Math.pow(x2, a), x2 = Math.pow(x2, b), x2 = Math.pow(x2, c), x2 = Math.pow(x2, null), x2 = Math.pow(x2, void 0), x3 = Math.pow(x3, a), x3 = Math.pow(x3, b), x3 = Math.pow(x3, c), x3 = Math.pow(x3, null), x3 = Math.pow(x3, void 0); diff --git a/crates/swc/tests/tsc-references/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned/input.ts/es2015.1.normal/output.js index 9eb1d5c11ff..a17ad068022 100644 --- a/crates/swc/tests/tsc-references/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned/input.ts/es2015.1.normal/output.js @@ -1,7 +1,7 @@ var E; -(function(E1) { - E1[E1["a"] = 0] = "a"; - E1[E1["b"] = 1] = "b"; +(function(E) { + E[E["a"] = 0] = "a"; + E[E["b"] = 1] = "b"; })(E || (E = { })); var a; diff --git a/crates/swc/tests/tsc-references/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned/input.ts/es2015.2.minified/output.js index 188f191b3cb..f696fcf0d87 100644 --- a/crates/swc/tests/tsc-references/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned/input.ts/es2015.2.minified/output.js @@ -1,6 +1,6 @@ -var E, a, b, x1, x2, x3, x4, x5, x6, E1; -(E1 = E || (E = { -}))[E1.a = 0] = "a", E1[E1.b = 1] = "b", x1 = Math.pow(x1, a) = Math.pow(x1, b), x1 = Math.pow(x1, !0) = Math.pow(x1, 0), x1 = Math.pow(x1, "") = Math.pow(x1, E.a), x1 = Math.pow(x1, { +var E, a, b, x1, x2, x3, x4, x5, x6, E; +(E = E || (E = { +}))[E.a = 0] = "a", E[E.b = 1] = "b", x1 = Math.pow(x1, a) = Math.pow(x1, b), x1 = Math.pow(x1, !0) = Math.pow(x1, 0), x1 = Math.pow(x1, "") = Math.pow(x1, E.a), x1 = Math.pow(x1, { }) = Math.pow(x1, null), x1 = Math.pow(x1, void 0), x2 = Math.pow(x2, a), x2 = Math.pow(x2, b), x2 = Math.pow(x2, !0), x2 = Math.pow(x2, 0), x2 = Math.pow(x2, ""), x2 = Math.pow(x2, E.a), x2 = Math.pow(x2, { }), x2 = Math.pow(x2, null), x2 = Math.pow(x2, void 0), x3 = Math.pow(x3, a), x3 = Math.pow(x3, b), x3 = Math.pow(x3, !0), x3 = Math.pow(x3, 0), x3 = Math.pow(x3, ""), x3 = Math.pow(x3, E.a), x3 = Math.pow(x3, { }), x3 = Math.pow(x3, null), x3 = Math.pow(x3, void 0), x4 = Math.pow(x4, a), x4 = Math.pow(x4, b), x4 = Math.pow(x4, !0), x4 = Math.pow(x4, 0), x4 = Math.pow(x4, ""), x4 = Math.pow(x4, E.a), x4 = Math.pow(x4, { diff --git a/crates/swc/tests/tsc-references/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned/input.ts/es5.1.normal/output.js index 9eb1d5c11ff..a17ad068022 100644 --- a/crates/swc/tests/tsc-references/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned/input.ts/es5.1.normal/output.js @@ -1,7 +1,7 @@ var E; -(function(E1) { - E1[E1["a"] = 0] = "a"; - E1[E1["b"] = 1] = "b"; +(function(E) { + E[E["a"] = 0] = "a"; + E[E["b"] = 1] = "b"; })(E || (E = { })); var a; diff --git a/crates/swc/tests/tsc-references/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned/input.ts/es5.2.minified/output.js index 188f191b3cb..f696fcf0d87 100644 --- a/crates/swc/tests/tsc-references/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned/input.ts/es5.2.minified/output.js @@ -1,6 +1,6 @@ -var E, a, b, x1, x2, x3, x4, x5, x6, E1; -(E1 = E || (E = { -}))[E1.a = 0] = "a", E1[E1.b = 1] = "b", x1 = Math.pow(x1, a) = Math.pow(x1, b), x1 = Math.pow(x1, !0) = Math.pow(x1, 0), x1 = Math.pow(x1, "") = Math.pow(x1, E.a), x1 = Math.pow(x1, { +var E, a, b, x1, x2, x3, x4, x5, x6, E; +(E = E || (E = { +}))[E.a = 0] = "a", E[E.b = 1] = "b", x1 = Math.pow(x1, a) = Math.pow(x1, b), x1 = Math.pow(x1, !0) = Math.pow(x1, 0), x1 = Math.pow(x1, "") = Math.pow(x1, E.a), x1 = Math.pow(x1, { }) = Math.pow(x1, null), x1 = Math.pow(x1, void 0), x2 = Math.pow(x2, a), x2 = Math.pow(x2, b), x2 = Math.pow(x2, !0), x2 = Math.pow(x2, 0), x2 = Math.pow(x2, ""), x2 = Math.pow(x2, E.a), x2 = Math.pow(x2, { }), x2 = Math.pow(x2, null), x2 = Math.pow(x2, void 0), x3 = Math.pow(x3, a), x3 = Math.pow(x3, b), x3 = Math.pow(x3, !0), x3 = Math.pow(x3, 0), x3 = Math.pow(x3, ""), x3 = Math.pow(x3, E.a), x3 = Math.pow(x3, { }), x3 = Math.pow(x3, null), x3 = Math.pow(x3, void 0), x4 = Math.pow(x4, a), x4 = Math.pow(x4, b), x4 = Math.pow(x4, !0), x4 = Math.pow(x4, 0), x4 = Math.pow(x4, ""), x4 = Math.pow(x4, E.a), x4 = Math.pow(x4, { diff --git a/crates/swc/tests/tsc-references/es7/exponentiationOperator/exponentiationOperatorWithEnum/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/es7/exponentiationOperator/exponentiationOperatorWithEnum/input.ts/es2015.1.normal/output.js index 7d6aedd2c02..ca1ce3acf2b 100644 --- a/crates/swc/tests/tsc-references/es7/exponentiationOperator/exponentiationOperatorWithEnum/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/es7/exponentiationOperator/exponentiationOperatorWithEnum/input.ts/es2015.1.normal/output.js @@ -1,8 +1,8 @@ var // operands of an enum type are treated as having the primitive type Number. E; -(function(E1) { - E1[E1["a"] = 0] = "a"; - E1[E1["b"] = 1] = "b"; +(function(E) { + E[E["a"] = 0] = "a"; + E[E["b"] = 1] = "b"; })(E || (E = { })); var a; diff --git a/crates/swc/tests/tsc-references/es7/exponentiationOperator/exponentiationOperatorWithEnum/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/es7/exponentiationOperator/exponentiationOperatorWithEnum/input.ts/es2015.2.minified/output.js index 89382f72fdf..2df93e78279 100644 --- a/crates/swc/tests/tsc-references/es7/exponentiationOperator/exponentiationOperatorWithEnum/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/es7/exponentiationOperator/exponentiationOperatorWithEnum/input.ts/es2015.2.minified/output.js @@ -1,3 +1,3 @@ -var E, E1, a, b, c; -(E = E1 || (E1 = { -}))[E.a = 0] = "a", E[E.b = 1] = "b", Math.pow(c, a), Math.pow(c, b), Math.pow(E1.a, a), Math.pow(E1.a, b), Math.pow(E1.a, E1.b), Math.pow(E1.a, 1), Math.pow(a, E1.b), Math.pow(b, E1.b), Math.pow(1, E1.b); +var E, E, a, b, c; +(E = E || (E = { +}))[E.a = 0] = "a", E[E.b = 1] = "b", Math.pow(c, a), Math.pow(c, b), Math.pow(E.a, a), Math.pow(E.a, b), Math.pow(E.a, E.b), Math.pow(E.a, 1), Math.pow(a, E.b), Math.pow(b, E.b), Math.pow(1, E.b); diff --git a/crates/swc/tests/tsc-references/es7/exponentiationOperator/exponentiationOperatorWithEnum/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/es7/exponentiationOperator/exponentiationOperatorWithEnum/input.ts/es5.1.normal/output.js index 7d6aedd2c02..ca1ce3acf2b 100644 --- a/crates/swc/tests/tsc-references/es7/exponentiationOperator/exponentiationOperatorWithEnum/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/es7/exponentiationOperator/exponentiationOperatorWithEnum/input.ts/es5.1.normal/output.js @@ -1,8 +1,8 @@ var // operands of an enum type are treated as having the primitive type Number. E; -(function(E1) { - E1[E1["a"] = 0] = "a"; - E1[E1["b"] = 1] = "b"; +(function(E) { + E[E["a"] = 0] = "a"; + E[E["b"] = 1] = "b"; })(E || (E = { })); var a; diff --git a/crates/swc/tests/tsc-references/es7/exponentiationOperator/exponentiationOperatorWithEnum/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/es7/exponentiationOperator/exponentiationOperatorWithEnum/input.ts/es5.2.minified/output.js index 89382f72fdf..2df93e78279 100644 --- a/crates/swc/tests/tsc-references/es7/exponentiationOperator/exponentiationOperatorWithEnum/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/es7/exponentiationOperator/exponentiationOperatorWithEnum/input.ts/es5.2.minified/output.js @@ -1,3 +1,3 @@ -var E, E1, a, b, c; -(E = E1 || (E1 = { -}))[E.a = 0] = "a", E[E.b = 1] = "b", Math.pow(c, a), Math.pow(c, b), Math.pow(E1.a, a), Math.pow(E1.a, b), Math.pow(E1.a, E1.b), Math.pow(E1.a, 1), Math.pow(a, E1.b), Math.pow(b, E1.b), Math.pow(1, E1.b); +var E, E, a, b, c; +(E = E || (E = { +}))[E.a = 0] = "a", E[E.b = 1] = "b", Math.pow(c, a), Math.pow(c, b), Math.pow(E.a, a), Math.pow(E.a, b), Math.pow(E.a, E.b), Math.pow(E.a, 1), Math.pow(a, E.b), Math.pow(b, E.b), Math.pow(1, E.b); diff --git a/crates/swc/tests/tsc-references/es7/exponentiationOperator/exponentiationOperatorWithEnumUnion/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/es7/exponentiationOperator/exponentiationOperatorWithEnumUnion/input.ts/es2015.1.normal/output.js index 32abe8adf2b..4fd24a61af3 100644 --- a/crates/swc/tests/tsc-references/es7/exponentiationOperator/exponentiationOperatorWithEnumUnion/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/es7/exponentiationOperator/exponentiationOperatorWithEnumUnion/input.ts/es2015.1.normal/output.js @@ -1,14 +1,14 @@ var // operands of an enum type are treated as having the primitive type Number. E; -(function(E1) { - E1[E1["a"] = 0] = "a"; - E1[E1["b"] = 1] = "b"; +(function(E) { + E[E["a"] = 0] = "a"; + E[E["b"] = 1] = "b"; })(E || (E = { })); var F; -(function(F1) { - F1[F1["c"] = 0] = "c"; - F1[F1["d"] = 1] = "d"; +(function(F) { + F[F["c"] = 0] = "c"; + F[F["d"] = 1] = "d"; })(F || (F = { })); var a; diff --git a/crates/swc/tests/tsc-references/es7/exponentiationOperator/exponentiationOperatorWithEnumUnion/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/es7/exponentiationOperator/exponentiationOperatorWithEnumUnion/input.ts/es2015.2.minified/output.js index 1a26b433dfe..673f35ceec5 100644 --- a/crates/swc/tests/tsc-references/es7/exponentiationOperator/exponentiationOperatorWithEnumUnion/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/es7/exponentiationOperator/exponentiationOperatorWithEnumUnion/input.ts/es2015.2.minified/output.js @@ -1,4 +1,4 @@ -var E, F, E1, F1, a, b, c; -(E = E1 || (E1 = { -}))[E.a = 0] = "a", E[E.b = 1] = "b", (F = F1 || (F1 = { -}))[F.c = 0] = "c", F[F.d = 1] = "d", Math.pow(c, a), Math.pow(c, b), Math.pow(E1.a, a), Math.pow(E1.a, b), Math.pow(E1.a, E1.b), Math.pow(E1.a, 1), Math.pow(a, E1.b), Math.pow(b, E1.b), Math.pow(1, E1.b); +var E, F, E, F, a, b, c; +(E = E || (E = { +}))[E.a = 0] = "a", E[E.b = 1] = "b", (F = F || (F = { +}))[F.c = 0] = "c", F[F.d = 1] = "d", Math.pow(c, a), Math.pow(c, b), Math.pow(E.a, a), Math.pow(E.a, b), Math.pow(E.a, E.b), Math.pow(E.a, 1), Math.pow(a, E.b), Math.pow(b, E.b), Math.pow(1, E.b); diff --git a/crates/swc/tests/tsc-references/es7/exponentiationOperator/exponentiationOperatorWithEnumUnion/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/es7/exponentiationOperator/exponentiationOperatorWithEnumUnion/input.ts/es5.1.normal/output.js index 32abe8adf2b..4fd24a61af3 100644 --- a/crates/swc/tests/tsc-references/es7/exponentiationOperator/exponentiationOperatorWithEnumUnion/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/es7/exponentiationOperator/exponentiationOperatorWithEnumUnion/input.ts/es5.1.normal/output.js @@ -1,14 +1,14 @@ var // operands of an enum type are treated as having the primitive type Number. E; -(function(E1) { - E1[E1["a"] = 0] = "a"; - E1[E1["b"] = 1] = "b"; +(function(E) { + E[E["a"] = 0] = "a"; + E[E["b"] = 1] = "b"; })(E || (E = { })); var F; -(function(F1) { - F1[F1["c"] = 0] = "c"; - F1[F1["d"] = 1] = "d"; +(function(F) { + F[F["c"] = 0] = "c"; + F[F["d"] = 1] = "d"; })(F || (F = { })); var a; diff --git a/crates/swc/tests/tsc-references/es7/exponentiationOperator/exponentiationOperatorWithEnumUnion/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/es7/exponentiationOperator/exponentiationOperatorWithEnumUnion/input.ts/es5.2.minified/output.js index 1a26b433dfe..673f35ceec5 100644 --- a/crates/swc/tests/tsc-references/es7/exponentiationOperator/exponentiationOperatorWithEnumUnion/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/es7/exponentiationOperator/exponentiationOperatorWithEnumUnion/input.ts/es5.2.minified/output.js @@ -1,4 +1,4 @@ -var E, F, E1, F1, a, b, c; -(E = E1 || (E1 = { -}))[E.a = 0] = "a", E[E.b = 1] = "b", (F = F1 || (F1 = { -}))[F.c = 0] = "c", F[F.d = 1] = "d", Math.pow(c, a), Math.pow(c, b), Math.pow(E1.a, a), Math.pow(E1.a, b), Math.pow(E1.a, E1.b), Math.pow(E1.a, 1), Math.pow(a, E1.b), Math.pow(b, E1.b), Math.pow(1, E1.b); +var E, F, E, F, a, b, c; +(E = E || (E = { +}))[E.a = 0] = "a", E[E.b = 1] = "b", (F = F || (F = { +}))[F.c = 0] = "c", F[F.d = 1] = "d", Math.pow(c, a), Math.pow(c, b), Math.pow(E.a, a), Math.pow(E.a, b), Math.pow(E.a, E.b), Math.pow(E.a, 1), Math.pow(a, E.b), Math.pow(b, E.b), Math.pow(1, E.b); diff --git a/crates/swc/tests/tsc-references/es7/exponentiationOperator/exponentiationOperatorWithInvalidOperands/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/es7/exponentiationOperator/exponentiationOperatorWithInvalidOperands/input.ts/es2015.1.normal/output.js index 1c5b10c6fa0..da21a7b1afd 100644 --- a/crates/swc/tests/tsc-references/es7/exponentiationOperator/exponentiationOperatorWithInvalidOperands/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/es7/exponentiationOperator/exponentiationOperatorWithInvalidOperands/input.ts/es2015.1.normal/output.js @@ -1,10 +1,10 @@ var // these operators require their operands to be of type Any, the Number primitive type, or // an enum type E; -(function(E1) { - E1[E1["a"] = 0] = "a"; - E1[E1["b"] = 1] = "b"; - E1[E1["c"] = 2] = "c"; +(function(E) { + E[E["a"] = 0] = "a"; + E[E["b"] = 1] = "b"; + E[E["c"] = 2] = "c"; })(E || (E = { })); var a; diff --git a/crates/swc/tests/tsc-references/es7/exponentiationOperator/exponentiationOperatorWithInvalidOperands/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/es7/exponentiationOperator/exponentiationOperatorWithInvalidOperands/input.ts/es2015.2.minified/output.js index ba3d8fe48a3..fbde11f508c 100644 --- a/crates/swc/tests/tsc-references/es7/exponentiationOperator/exponentiationOperatorWithInvalidOperands/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/es7/exponentiationOperator/exponentiationOperatorWithInvalidOperands/input.ts/es2015.2.minified/output.js @@ -1,3 +1,3 @@ -var E, E1, a, b, c, d, e, f; -(E = E1 || (E1 = { -}))[E.a = 0] = "a", E[E.b = 1] = "b", E[E.c = 2] = "c", Math.pow(a, a), Math.pow(a, b), Math.pow(E1.a, a), Math.pow(E1.a, b), Math.pow(E1.a, c), Math.pow(E1.a, d), Math.pow(E1.a, e), Math.pow(E1.a, f), Math.pow(a, E1.b), Math.pow(b, E1.b), Math.pow(c, E1.b), Math.pow(d, E1.b), Math.pow(e, E1.b), Math.pow(f, E1.b); +var E, E, a, b, c, d, e, f; +(E = E || (E = { +}))[E.a = 0] = "a", E[E.b = 1] = "b", E[E.c = 2] = "c", Math.pow(a, a), Math.pow(a, b), Math.pow(E.a, a), Math.pow(E.a, b), Math.pow(E.a, c), Math.pow(E.a, d), Math.pow(E.a, e), Math.pow(E.a, f), Math.pow(a, E.b), Math.pow(b, E.b), Math.pow(c, E.b), Math.pow(d, E.b), Math.pow(e, E.b), Math.pow(f, E.b); diff --git a/crates/swc/tests/tsc-references/es7/exponentiationOperator/exponentiationOperatorWithInvalidOperands/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/es7/exponentiationOperator/exponentiationOperatorWithInvalidOperands/input.ts/es5.1.normal/output.js index 1c5b10c6fa0..da21a7b1afd 100644 --- a/crates/swc/tests/tsc-references/es7/exponentiationOperator/exponentiationOperatorWithInvalidOperands/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/es7/exponentiationOperator/exponentiationOperatorWithInvalidOperands/input.ts/es5.1.normal/output.js @@ -1,10 +1,10 @@ var // these operators require their operands to be of type Any, the Number primitive type, or // an enum type E; -(function(E1) { - E1[E1["a"] = 0] = "a"; - E1[E1["b"] = 1] = "b"; - E1[E1["c"] = 2] = "c"; +(function(E) { + E[E["a"] = 0] = "a"; + E[E["b"] = 1] = "b"; + E[E["c"] = 2] = "c"; })(E || (E = { })); var a; diff --git a/crates/swc/tests/tsc-references/es7/exponentiationOperator/exponentiationOperatorWithInvalidOperands/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/es7/exponentiationOperator/exponentiationOperatorWithInvalidOperands/input.ts/es5.2.minified/output.js index ba3d8fe48a3..fbde11f508c 100644 --- a/crates/swc/tests/tsc-references/es7/exponentiationOperator/exponentiationOperatorWithInvalidOperands/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/es7/exponentiationOperator/exponentiationOperatorWithInvalidOperands/input.ts/es5.2.minified/output.js @@ -1,3 +1,3 @@ -var E, E1, a, b, c, d, e, f; -(E = E1 || (E1 = { -}))[E.a = 0] = "a", E[E.b = 1] = "b", E[E.c = 2] = "c", Math.pow(a, a), Math.pow(a, b), Math.pow(E1.a, a), Math.pow(E1.a, b), Math.pow(E1.a, c), Math.pow(E1.a, d), Math.pow(E1.a, e), Math.pow(E1.a, f), Math.pow(a, E1.b), Math.pow(b, E1.b), Math.pow(c, E1.b), Math.pow(d, E1.b), Math.pow(e, E1.b), Math.pow(f, E1.b); +var E, E, a, b, c, d, e, f; +(E = E || (E = { +}))[E.a = 0] = "a", E[E.b = 1] = "b", E[E.c = 2] = "c", Math.pow(a, a), Math.pow(a, b), Math.pow(E.a, a), Math.pow(E.a, b), Math.pow(E.a, c), Math.pow(E.a, d), Math.pow(E.a, e), Math.pow(E.a, f), Math.pow(a, E.b), Math.pow(b, E.b), Math.pow(c, E.b), Math.pow(d, E.b), Math.pow(e, E.b), Math.pow(f, E.b); diff --git a/crates/swc/tests/tsc-references/es7/exponentiationOperator/exponentiationOperatorWithNullValueAndValidOperands/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/es7/exponentiationOperator/exponentiationOperatorWithNullValueAndValidOperands/input.ts/es2015.1.normal/output.js index ac8d8e8d22d..f9da523358f 100644 --- a/crates/swc/tests/tsc-references/es7/exponentiationOperator/exponentiationOperatorWithNullValueAndValidOperands/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/es7/exponentiationOperator/exponentiationOperatorWithNullValueAndValidOperands/input.ts/es2015.1.normal/output.js @@ -1,9 +1,9 @@ var // If one operand is the null or undefined value, it is treated as having the type of the // other operand. E; -(function(E1) { - E1[E1["a"] = 0] = "a"; - E1[E1["b"] = 1] = "b"; +(function(E) { + E[E["a"] = 0] = "a"; + E[E["b"] = 1] = "b"; })(E || (E = { })); var a; diff --git a/crates/swc/tests/tsc-references/es7/exponentiationOperator/exponentiationOperatorWithNullValueAndValidOperands/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/es7/exponentiationOperator/exponentiationOperatorWithNullValueAndValidOperands/input.ts/es2015.2.minified/output.js index 13a9d69ef6d..400154f735a 100644 --- a/crates/swc/tests/tsc-references/es7/exponentiationOperator/exponentiationOperatorWithNullValueAndValidOperands/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/es7/exponentiationOperator/exponentiationOperatorWithNullValueAndValidOperands/input.ts/es2015.2.minified/output.js @@ -1,3 +1,3 @@ -var E, E1, a, b; -(E = E1 || (E1 = { -}))[E.a = 0] = "a", E[E.b = 1] = "b", Math.pow(null, a), Math.pow(null, b), Math.pow(null, E1.a), Math.pow(E1.b, null); +var E, E, a, b; +(E = E || (E = { +}))[E.a = 0] = "a", E[E.b = 1] = "b", Math.pow(null, a), Math.pow(null, b), Math.pow(null, E.a), Math.pow(E.b, null); diff --git a/crates/swc/tests/tsc-references/es7/exponentiationOperator/exponentiationOperatorWithNullValueAndValidOperands/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/es7/exponentiationOperator/exponentiationOperatorWithNullValueAndValidOperands/input.ts/es5.1.normal/output.js index ac8d8e8d22d..f9da523358f 100644 --- a/crates/swc/tests/tsc-references/es7/exponentiationOperator/exponentiationOperatorWithNullValueAndValidOperands/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/es7/exponentiationOperator/exponentiationOperatorWithNullValueAndValidOperands/input.ts/es5.1.normal/output.js @@ -1,9 +1,9 @@ var // If one operand is the null or undefined value, it is treated as having the type of the // other operand. E; -(function(E1) { - E1[E1["a"] = 0] = "a"; - E1[E1["b"] = 1] = "b"; +(function(E) { + E[E["a"] = 0] = "a"; + E[E["b"] = 1] = "b"; })(E || (E = { })); var a; diff --git a/crates/swc/tests/tsc-references/es7/exponentiationOperator/exponentiationOperatorWithNullValueAndValidOperands/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/es7/exponentiationOperator/exponentiationOperatorWithNullValueAndValidOperands/input.ts/es5.2.minified/output.js index 13a9d69ef6d..400154f735a 100644 --- a/crates/swc/tests/tsc-references/es7/exponentiationOperator/exponentiationOperatorWithNullValueAndValidOperands/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/es7/exponentiationOperator/exponentiationOperatorWithNullValueAndValidOperands/input.ts/es5.2.minified/output.js @@ -1,3 +1,3 @@ -var E, E1, a, b; -(E = E1 || (E1 = { -}))[E.a = 0] = "a", E[E.b = 1] = "b", Math.pow(null, a), Math.pow(null, b), Math.pow(null, E1.a), Math.pow(E1.b, null); +var E, E, a, b; +(E = E || (E = { +}))[E.a = 0] = "a", E[E.b = 1] = "b", Math.pow(null, a), Math.pow(null, b), Math.pow(null, E.a), Math.pow(E.b, null); diff --git a/crates/swc/tests/tsc-references/es7/exponentiationOperator/exponentiationOperatorWithUndefinedValueAndValidOperands/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/es7/exponentiationOperator/exponentiationOperatorWithUndefinedValueAndValidOperands/input.ts/es2015.1.normal/output.js index b765972338b..240e0d837ad 100644 --- a/crates/swc/tests/tsc-references/es7/exponentiationOperator/exponentiationOperatorWithUndefinedValueAndValidOperands/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/es7/exponentiationOperator/exponentiationOperatorWithUndefinedValueAndValidOperands/input.ts/es2015.1.normal/output.js @@ -1,9 +1,9 @@ var // If one operand is the undefined or undefined value, it is treated as having the type of the // other operand. E; -(function(E1) { - E1[E1["a"] = 0] = "a"; - E1[E1["b"] = 1] = "b"; +(function(E) { + E[E["a"] = 0] = "a"; + E[E["b"] = 1] = "b"; })(E || (E = { })); var a; diff --git a/crates/swc/tests/tsc-references/es7/exponentiationOperator/exponentiationOperatorWithUndefinedValueAndValidOperands/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/es7/exponentiationOperator/exponentiationOperatorWithUndefinedValueAndValidOperands/input.ts/es2015.2.minified/output.js index f95a3d0b556..d5fbb944fec 100644 --- a/crates/swc/tests/tsc-references/es7/exponentiationOperator/exponentiationOperatorWithUndefinedValueAndValidOperands/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/es7/exponentiationOperator/exponentiationOperatorWithUndefinedValueAndValidOperands/input.ts/es2015.2.minified/output.js @@ -1,3 +1,3 @@ -var E, E1, a, b; -(E = E1 || (E1 = { -}))[E.a = 0] = "a", E[E.b = 1] = "b", Math.pow(void 0, a), Math.pow(void 0, b), Math.pow(void 0, E1.a), Math.pow(E1.b, void 0); +var E, E, a, b; +(E = E || (E = { +}))[E.a = 0] = "a", E[E.b = 1] = "b", Math.pow(void 0, a), Math.pow(void 0, b), Math.pow(void 0, E.a), Math.pow(E.b, void 0); diff --git a/crates/swc/tests/tsc-references/es7/exponentiationOperator/exponentiationOperatorWithUndefinedValueAndValidOperands/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/es7/exponentiationOperator/exponentiationOperatorWithUndefinedValueAndValidOperands/input.ts/es5.1.normal/output.js index b765972338b..240e0d837ad 100644 --- a/crates/swc/tests/tsc-references/es7/exponentiationOperator/exponentiationOperatorWithUndefinedValueAndValidOperands/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/es7/exponentiationOperator/exponentiationOperatorWithUndefinedValueAndValidOperands/input.ts/es5.1.normal/output.js @@ -1,9 +1,9 @@ var // If one operand is the undefined or undefined value, it is treated as having the type of the // other operand. E; -(function(E1) { - E1[E1["a"] = 0] = "a"; - E1[E1["b"] = 1] = "b"; +(function(E) { + E[E["a"] = 0] = "a"; + E[E["b"] = 1] = "b"; })(E || (E = { })); var a; diff --git a/crates/swc/tests/tsc-references/es7/exponentiationOperator/exponentiationOperatorWithUndefinedValueAndValidOperands/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/es7/exponentiationOperator/exponentiationOperatorWithUndefinedValueAndValidOperands/input.ts/es5.2.minified/output.js index f95a3d0b556..d5fbb944fec 100644 --- a/crates/swc/tests/tsc-references/es7/exponentiationOperator/exponentiationOperatorWithUndefinedValueAndValidOperands/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/es7/exponentiationOperator/exponentiationOperatorWithUndefinedValueAndValidOperands/input.ts/es5.2.minified/output.js @@ -1,3 +1,3 @@ -var E, E1, a, b; -(E = E1 || (E1 = { -}))[E.a = 0] = "a", E[E.b = 1] = "b", Math.pow(void 0, a), Math.pow(void 0, b), Math.pow(void 0, E1.a), Math.pow(E1.b, void 0); +var E, E, a, b; +(E = E || (E = { +}))[E.a = 0] = "a", E[E.b = 1] = "b", Math.pow(void 0, a), Math.pow(void 0, b), Math.pow(void 0, E.a), Math.pow(E.b, void 0); diff --git a/crates/swc/tests/tsc-references/expressions/arrayLiterals/arrayLiteralInference/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/expressions/arrayLiterals/arrayLiteralInference/input.ts/es2015.1.normal/output.js index 2360b0ac600..8767b72dc11 100644 --- a/crates/swc/tests/tsc-references/expressions/arrayLiterals/arrayLiteralInference/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/expressions/arrayLiterals/arrayLiteralInference/input.ts/es2015.1.normal/output.js @@ -1,23 +1,23 @@ export var AppType; -(function(AppType1) { - AppType1["HeaderDetail"] = "HeaderDetail"; - AppType1["HeaderMultiDetail"] = "HeaderMultiDetail"; - AppType1["AdvancedList"] = "AdvancedList"; - AppType1["Standard"] = "Standard"; - AppType1["Relationship"] = "Relationship"; - AppType1["Report"] = "Report"; - AppType1["Composite"] = "Composite"; - AppType1["ListOnly"] = "ListOnly"; - AppType1["ModuleSettings"] = "ModuleSettings"; +(function(AppType) { + AppType["HeaderDetail"] = "HeaderDetail"; + AppType["HeaderMultiDetail"] = "HeaderMultiDetail"; + AppType["AdvancedList"] = "AdvancedList"; + AppType["Standard"] = "Standard"; + AppType["Relationship"] = "Relationship"; + AppType["Report"] = "Report"; + AppType["Composite"] = "Composite"; + AppType["ListOnly"] = "ListOnly"; + AppType["ModuleSettings"] = "ModuleSettings"; })(AppType || (AppType = { })); export var AppStyle; -(function(AppStyle1) { - AppStyle1[AppStyle1["Tree"] = 0] = "Tree"; - AppStyle1[AppStyle1["TreeEntity"] = 1] = "TreeEntity"; - AppStyle1[AppStyle1["Standard"] = 2] = "Standard"; - AppStyle1[AppStyle1["MiniApp"] = 3] = "MiniApp"; - AppStyle1[AppStyle1["PivotTable"] = 4] = "PivotTable"; +(function(AppStyle) { + AppStyle[AppStyle["Tree"] = 0] = "Tree"; + AppStyle[AppStyle["TreeEntity"] = 1] = "TreeEntity"; + AppStyle[AppStyle["Standard"] = 2] = "Standard"; + AppStyle[AppStyle["MiniApp"] = 3] = "MiniApp"; + AppStyle[AppStyle["PivotTable"] = 4] = "PivotTable"; })(AppStyle || (AppStyle = { })); const appTypeStylesWithError = new Map([ diff --git a/crates/swc/tests/tsc-references/expressions/arrayLiterals/arrayLiteralInference/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/expressions/arrayLiterals/arrayLiteralInference/input.ts/es2015.2.minified/output.js index a436fd794a6..2a2426c935a 100644 --- a/crates/swc/tests/tsc-references/expressions/arrayLiterals/arrayLiteralInference/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/expressions/arrayLiterals/arrayLiteralInference/input.ts/es2015.2.minified/output.js @@ -1,7 +1,7 @@ -var AppType, AppStyle, AppType1, AppStyle1; -(AppType1 = AppType || (AppType = { -})).HeaderDetail = "HeaderDetail", AppType1.HeaderMultiDetail = "HeaderMultiDetail", AppType1.AdvancedList = "AdvancedList", AppType1.Standard = "Standard", AppType1.Relationship = "Relationship", AppType1.Report = "Report", AppType1.Composite = "Composite", AppType1.ListOnly = "ListOnly", AppType1.ModuleSettings = "ModuleSettings", (AppStyle1 = AppStyle || (AppStyle = { -}))[AppStyle1.Tree = 0] = "Tree", AppStyle1[AppStyle1.TreeEntity = 1] = "TreeEntity", AppStyle1[AppStyle1.Standard = 2] = "Standard", AppStyle1[AppStyle1.MiniApp = 3] = "MiniApp", AppStyle1[AppStyle1.PivotTable = 4] = "PivotTable", new Map([ +var AppType, AppStyle, AppType, AppStyle; +(AppType = AppType || (AppType = { +})).HeaderDetail = "HeaderDetail", AppType.HeaderMultiDetail = "HeaderMultiDetail", AppType.AdvancedList = "AdvancedList", AppType.Standard = "Standard", AppType.Relationship = "Relationship", AppType.Report = "Report", AppType.Composite = "Composite", AppType.ListOnly = "ListOnly", AppType.ModuleSettings = "ModuleSettings", (AppStyle = AppStyle || (AppStyle = { +}))[AppStyle.Tree = 0] = "Tree", AppStyle[AppStyle.TreeEntity = 1] = "TreeEntity", AppStyle[AppStyle.Standard = 2] = "Standard", AppStyle[AppStyle.MiniApp = 3] = "MiniApp", AppStyle[AppStyle.PivotTable = 4] = "PivotTable", new Map([ [ AppType.Standard, [ diff --git a/crates/swc/tests/tsc-references/expressions/arrayLiterals/arrayLiteralInference/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/expressions/arrayLiterals/arrayLiteralInference/input.ts/es5.1.normal/output.js index 2797085ff69..b286fe4c24a 100644 --- a/crates/swc/tests/tsc-references/expressions/arrayLiterals/arrayLiteralInference/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/expressions/arrayLiterals/arrayLiteralInference/input.ts/es5.1.normal/output.js @@ -1,23 +1,23 @@ export var AppType; -(function(AppType1) { - AppType1["HeaderDetail"] = "HeaderDetail"; - AppType1["HeaderMultiDetail"] = "HeaderMultiDetail"; - AppType1["AdvancedList"] = "AdvancedList"; - AppType1["Standard"] = "Standard"; - AppType1["Relationship"] = "Relationship"; - AppType1["Report"] = "Report"; - AppType1["Composite"] = "Composite"; - AppType1["ListOnly"] = "ListOnly"; - AppType1["ModuleSettings"] = "ModuleSettings"; +(function(AppType) { + AppType["HeaderDetail"] = "HeaderDetail"; + AppType["HeaderMultiDetail"] = "HeaderMultiDetail"; + AppType["AdvancedList"] = "AdvancedList"; + AppType["Standard"] = "Standard"; + AppType["Relationship"] = "Relationship"; + AppType["Report"] = "Report"; + AppType["Composite"] = "Composite"; + AppType["ListOnly"] = "ListOnly"; + AppType["ModuleSettings"] = "ModuleSettings"; })(AppType || (AppType = { })); export var AppStyle; -(function(AppStyle1) { - AppStyle1[AppStyle1["Tree"] = 0] = "Tree"; - AppStyle1[AppStyle1["TreeEntity"] = 1] = "TreeEntity"; - AppStyle1[AppStyle1["Standard"] = 2] = "Standard"; - AppStyle1[AppStyle1["MiniApp"] = 3] = "MiniApp"; - AppStyle1[AppStyle1["PivotTable"] = 4] = "PivotTable"; +(function(AppStyle) { + AppStyle[AppStyle["Tree"] = 0] = "Tree"; + AppStyle[AppStyle["TreeEntity"] = 1] = "TreeEntity"; + AppStyle[AppStyle["Standard"] = 2] = "Standard"; + AppStyle[AppStyle["MiniApp"] = 3] = "MiniApp"; + AppStyle[AppStyle["PivotTable"] = 4] = "PivotTable"; })(AppStyle || (AppStyle = { })); var appTypeStylesWithError = new Map([ diff --git a/crates/swc/tests/tsc-references/expressions/arrayLiterals/arrayLiteralInference/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/expressions/arrayLiterals/arrayLiteralInference/input.ts/es5.2.minified/output.js index eb988881f41..2a2426c935a 100644 --- a/crates/swc/tests/tsc-references/expressions/arrayLiterals/arrayLiteralInference/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/expressions/arrayLiterals/arrayLiteralInference/input.ts/es5.2.minified/output.js @@ -1,27 +1,27 @@ -var AppType, AppStyle, AppType1, AppStyle1; -(AppType = AppType1 || (AppType1 = { -})).HeaderDetail = "HeaderDetail", AppType.HeaderMultiDetail = "HeaderMultiDetail", AppType.AdvancedList = "AdvancedList", AppType.Standard = "Standard", AppType.Relationship = "Relationship", AppType.Report = "Report", AppType.Composite = "Composite", AppType.ListOnly = "ListOnly", AppType.ModuleSettings = "ModuleSettings", (AppStyle = AppStyle1 || (AppStyle1 = { +var AppType, AppStyle, AppType, AppStyle; +(AppType = AppType || (AppType = { +})).HeaderDetail = "HeaderDetail", AppType.HeaderMultiDetail = "HeaderMultiDetail", AppType.AdvancedList = "AdvancedList", AppType.Standard = "Standard", AppType.Relationship = "Relationship", AppType.Report = "Report", AppType.Composite = "Composite", AppType.ListOnly = "ListOnly", AppType.ModuleSettings = "ModuleSettings", (AppStyle = AppStyle || (AppStyle = { }))[AppStyle.Tree = 0] = "Tree", AppStyle[AppStyle.TreeEntity = 1] = "TreeEntity", AppStyle[AppStyle.Standard = 2] = "Standard", AppStyle[AppStyle.MiniApp = 3] = "MiniApp", AppStyle[AppStyle.PivotTable = 4] = "PivotTable", new Map([ [ - AppType1.Standard, + AppType.Standard, [ - AppStyle1.Standard, - AppStyle1.MiniApp + AppStyle.Standard, + AppStyle.MiniApp ] ], [ - AppType1.Relationship, + AppType.Relationship, [ - AppStyle1.Standard, - AppStyle1.Tree, - AppStyle1.TreeEntity + AppStyle.Standard, + AppStyle.Tree, + AppStyle.TreeEntity ] ], [ - AppType1.AdvancedList, + AppType.AdvancedList, [ - AppStyle1.Standard, - AppStyle1.MiniApp + AppStyle.Standard, + AppStyle.MiniApp ] ] ]), foo({ diff --git a/crates/swc/tests/tsc-references/expressions/assignmentOperator/compoundAdditionAssignmentLHSCanBeAssigned/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/expressions/assignmentOperator/compoundAdditionAssignmentLHSCanBeAssigned/input.ts/es2015.1.normal/output.js index 2abc00883be..34af0ef3097 100644 --- a/crates/swc/tests/tsc-references/expressions/assignmentOperator/compoundAdditionAssignmentLHSCanBeAssigned/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/expressions/assignmentOperator/compoundAdditionAssignmentLHSCanBeAssigned/input.ts/es2015.1.normal/output.js @@ -1,7 +1,7 @@ var E; -(function(E1) { - E1[E1["a"] = 0] = "a"; - E1[E1["b"] = 1] = "b"; +(function(E) { + E[E["a"] = 0] = "a"; + E[E["b"] = 1] = "b"; })(E || (E = { })); var a; diff --git a/crates/swc/tests/tsc-references/expressions/assignmentOperator/compoundAdditionAssignmentLHSCanBeAssigned/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/expressions/assignmentOperator/compoundAdditionAssignmentLHSCanBeAssigned/input.ts/es2015.2.minified/output.js index c6ea6ecdb47..f3e2e5de102 100644 --- a/crates/swc/tests/tsc-references/expressions/assignmentOperator/compoundAdditionAssignmentLHSCanBeAssigned/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/expressions/assignmentOperator/compoundAdditionAssignmentLHSCanBeAssigned/input.ts/es2015.2.minified/output.js @@ -1,5 +1,5 @@ -var E, a, b, x1, x2, x3, x4, x5, x6, x7, E1; -(E1 = E || (E = { -}))[E1.a = 0] = "a", E1[E1.b = 1] = "b", x1 += a, x1 += b, x1 += !0, x1 += 0, x1 += "", x1 += E.a, x1 += { +var E, a, b, x1, x2, x3, x4, x5, x6, x7, E; +(E = E || (E = { +}))[E.a = 0] = "a", E[E.b = 1] = "b", x1 += a, x1 += b, x1 += !0, x1 += 0, x1 += "", x1 += E.a, x1 += { }, x1 += null, x1 += void 0, x2 += a, x2 += b, x2 += !0, x2 += 0, x2 += "", x2 += E.a, x2 += { }, x2 += null, x2 += void 0, x3 += a, x3 += 0, x3 += E.a, x3 += null, x3 += void 0, x4 += a, x4 += 0, x4 += E.a, x4 += null, x4 += void 0, x5 += a, x6 += a, x6 += "", x7 += a; diff --git a/crates/swc/tests/tsc-references/expressions/assignmentOperator/compoundAdditionAssignmentLHSCanBeAssigned/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/expressions/assignmentOperator/compoundAdditionAssignmentLHSCanBeAssigned/input.ts/es5.1.normal/output.js index 2abc00883be..34af0ef3097 100644 --- a/crates/swc/tests/tsc-references/expressions/assignmentOperator/compoundAdditionAssignmentLHSCanBeAssigned/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/expressions/assignmentOperator/compoundAdditionAssignmentLHSCanBeAssigned/input.ts/es5.1.normal/output.js @@ -1,7 +1,7 @@ var E; -(function(E1) { - E1[E1["a"] = 0] = "a"; - E1[E1["b"] = 1] = "b"; +(function(E) { + E[E["a"] = 0] = "a"; + E[E["b"] = 1] = "b"; })(E || (E = { })); var a; diff --git a/crates/swc/tests/tsc-references/expressions/assignmentOperator/compoundAdditionAssignmentLHSCanBeAssigned/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/expressions/assignmentOperator/compoundAdditionAssignmentLHSCanBeAssigned/input.ts/es5.2.minified/output.js index c6ea6ecdb47..f3e2e5de102 100644 --- a/crates/swc/tests/tsc-references/expressions/assignmentOperator/compoundAdditionAssignmentLHSCanBeAssigned/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/expressions/assignmentOperator/compoundAdditionAssignmentLHSCanBeAssigned/input.ts/es5.2.minified/output.js @@ -1,5 +1,5 @@ -var E, a, b, x1, x2, x3, x4, x5, x6, x7, E1; -(E1 = E || (E = { -}))[E1.a = 0] = "a", E1[E1.b = 1] = "b", x1 += a, x1 += b, x1 += !0, x1 += 0, x1 += "", x1 += E.a, x1 += { +var E, a, b, x1, x2, x3, x4, x5, x6, x7, E; +(E = E || (E = { +}))[E.a = 0] = "a", E[E.b = 1] = "b", x1 += a, x1 += b, x1 += !0, x1 += 0, x1 += "", x1 += E.a, x1 += { }, x1 += null, x1 += void 0, x2 += a, x2 += b, x2 += !0, x2 += 0, x2 += "", x2 += E.a, x2 += { }, x2 += null, x2 += void 0, x3 += a, x3 += 0, x3 += E.a, x3 += null, x3 += void 0, x4 += a, x4 += 0, x4 += E.a, x4 += null, x4 += void 0, x5 += a, x6 += a, x6 += "", x7 += a; diff --git a/crates/swc/tests/tsc-references/expressions/assignmentOperator/compoundAdditionAssignmentLHSCannotBeAssigned/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/expressions/assignmentOperator/compoundAdditionAssignmentLHSCannotBeAssigned/input.ts/es2015.1.normal/output.js index 066e9e0d2f2..843a3c473a1 100644 --- a/crates/swc/tests/tsc-references/expressions/assignmentOperator/compoundAdditionAssignmentLHSCannotBeAssigned/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/expressions/assignmentOperator/compoundAdditionAssignmentLHSCannotBeAssigned/input.ts/es2015.1.normal/output.js @@ -1,9 +1,9 @@ var // string can add every type, and result string cannot be assigned to below types E; -(function(E1) { - E1[E1["a"] = 0] = "a"; - E1[E1["b"] = 1] = "b"; - E1[E1["c"] = 2] = "c"; +(function(E) { + E[E["a"] = 0] = "a"; + E[E["b"] = 1] = "b"; + E[E["c"] = 2] = "c"; })(E || (E = { })); var x1; diff --git a/crates/swc/tests/tsc-references/expressions/assignmentOperator/compoundAdditionAssignmentLHSCannotBeAssigned/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/expressions/assignmentOperator/compoundAdditionAssignmentLHSCannotBeAssigned/input.ts/es2015.2.minified/output.js index 84246a37c48..c7ef61e1146 100644 --- a/crates/swc/tests/tsc-references/expressions/assignmentOperator/compoundAdditionAssignmentLHSCannotBeAssigned/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/expressions/assignmentOperator/compoundAdditionAssignmentLHSCannotBeAssigned/input.ts/es2015.2.minified/output.js @@ -1,3 +1,3 @@ -var E, x1, x2, x3, x4, x5, E1; -(E1 = E || (E = { -}))[E1.a = 0] = "a", E1[E1.b = 1] = "b", E1[E1.c = 2] = "c", x1 += "", x2 += "", x3 += "", x4 += "", x5 += ""; +var E, x1, x2, x3, x4, x5, E; +(E = E || (E = { +}))[E.a = 0] = "a", E[E.b = 1] = "b", E[E.c = 2] = "c", x1 += "", x2 += "", x3 += "", x4 += "", x5 += ""; diff --git a/crates/swc/tests/tsc-references/expressions/assignmentOperator/compoundAdditionAssignmentLHSCannotBeAssigned/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/expressions/assignmentOperator/compoundAdditionAssignmentLHSCannotBeAssigned/input.ts/es5.1.normal/output.js index 066e9e0d2f2..843a3c473a1 100644 --- a/crates/swc/tests/tsc-references/expressions/assignmentOperator/compoundAdditionAssignmentLHSCannotBeAssigned/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/expressions/assignmentOperator/compoundAdditionAssignmentLHSCannotBeAssigned/input.ts/es5.1.normal/output.js @@ -1,9 +1,9 @@ var // string can add every type, and result string cannot be assigned to below types E; -(function(E1) { - E1[E1["a"] = 0] = "a"; - E1[E1["b"] = 1] = "b"; - E1[E1["c"] = 2] = "c"; +(function(E) { + E[E["a"] = 0] = "a"; + E[E["b"] = 1] = "b"; + E[E["c"] = 2] = "c"; })(E || (E = { })); var x1; diff --git a/crates/swc/tests/tsc-references/expressions/assignmentOperator/compoundAdditionAssignmentLHSCannotBeAssigned/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/expressions/assignmentOperator/compoundAdditionAssignmentLHSCannotBeAssigned/input.ts/es5.2.minified/output.js index 84246a37c48..c7ef61e1146 100644 --- a/crates/swc/tests/tsc-references/expressions/assignmentOperator/compoundAdditionAssignmentLHSCannotBeAssigned/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/expressions/assignmentOperator/compoundAdditionAssignmentLHSCannotBeAssigned/input.ts/es5.2.minified/output.js @@ -1,3 +1,3 @@ -var E, x1, x2, x3, x4, x5, E1; -(E1 = E || (E = { -}))[E1.a = 0] = "a", E1[E1.b = 1] = "b", E1[E1.c = 2] = "c", x1 += "", x2 += "", x3 += "", x4 += "", x5 += ""; +var E, x1, x2, x3, x4, x5, E; +(E = E || (E = { +}))[E.a = 0] = "a", E[E.b = 1] = "b", E[E.c = 2] = "c", x1 += "", x2 += "", x3 += "", x4 += "", x5 += ""; diff --git a/crates/swc/tests/tsc-references/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands/input.ts/es2015.1.normal/output.js index 333923a6d37..c61571075aa 100644 --- a/crates/swc/tests/tsc-references/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands/input.ts/es2015.1.normal/output.js @@ -1,7 +1,7 @@ var E; -(function(E1) { - E1[E1["a"] = 0] = "a"; - E1[E1["b"] = 1] = "b"; +(function(E) { + E[E["a"] = 0] = "a"; + E[E["b"] = 1] = "b"; })(E || (E = { })); var a; diff --git a/crates/swc/tests/tsc-references/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands/input.ts/es2015.2.minified/output.js index e0745a5a5bc..5e0ffdae831 100644 --- a/crates/swc/tests/tsc-references/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands/input.ts/es2015.2.minified/output.js @@ -1,6 +1,6 @@ -var E, a, x1, x2, x3, x4, x5, E1; -(E1 = E || (E = { -}))[E1.a = 0] = "a", E1[E1.b = 1] = "b", x1 += a, x1 += !0, x1 += 0, x1 += E.a, x1 += { +var E, a, x1, x2, x3, x4, x5, E; +(E = E || (E = { +}))[E.a = 0] = "a", E[E.b = 1] = "b", x1 += a, x1 += !0, x1 += 0, x1 += E.a, x1 += { }, x1 += null, x1 += void 0, x2 += a, x2 += !0, x2 += 0, x2 += E.a, x2 += { }, x2 += null, x2 += void 0, x3 += a, x3 += !0, x3 += 0, x3 += E.a, x3 += { }, x3 += null, x3 += void 0, x4 += a, x4 += !0, x4 += { diff --git a/crates/swc/tests/tsc-references/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands/input.ts/es5.1.normal/output.js index 333923a6d37..c61571075aa 100644 --- a/crates/swc/tests/tsc-references/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands/input.ts/es5.1.normal/output.js @@ -1,7 +1,7 @@ var E; -(function(E1) { - E1[E1["a"] = 0] = "a"; - E1[E1["b"] = 1] = "b"; +(function(E) { + E[E["a"] = 0] = "a"; + E[E["b"] = 1] = "b"; })(E || (E = { })); var a; diff --git a/crates/swc/tests/tsc-references/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands/input.ts/es5.2.minified/output.js index e0745a5a5bc..5e0ffdae831 100644 --- a/crates/swc/tests/tsc-references/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands/input.ts/es5.2.minified/output.js @@ -1,6 +1,6 @@ -var E, a, x1, x2, x3, x4, x5, E1; -(E1 = E || (E = { -}))[E1.a = 0] = "a", E1[E1.b = 1] = "b", x1 += a, x1 += !0, x1 += 0, x1 += E.a, x1 += { +var E, a, x1, x2, x3, x4, x5, E; +(E = E || (E = { +}))[E.a = 0] = "a", E[E.b = 1] = "b", x1 += a, x1 += !0, x1 += 0, x1 += E.a, x1 += { }, x1 += null, x1 += void 0, x2 += a, x2 += !0, x2 += 0, x2 += E.a, x2 += { }, x2 += null, x2 += void 0, x3 += a, x3 += !0, x3 += 0, x3 += E.a, x3 += { }, x3 += null, x3 += void 0, x4 += a, x4 += !0, x4 += { diff --git a/crates/swc/tests/tsc-references/expressions/assignmentOperator/compoundArithmeticAssignmentLHSCanBeAssigned/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/expressions/assignmentOperator/compoundArithmeticAssignmentLHSCanBeAssigned/input.ts/es2015.1.normal/output.js index ceb0a352d2f..f41b8357ca4 100644 --- a/crates/swc/tests/tsc-references/expressions/assignmentOperator/compoundArithmeticAssignmentLHSCanBeAssigned/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/expressions/assignmentOperator/compoundArithmeticAssignmentLHSCanBeAssigned/input.ts/es2015.1.normal/output.js @@ -1,8 +1,8 @@ var E; -(function(E1) { - E1[E1["a"] = 0] = "a"; - E1[E1["b"] = 1] = "b"; - E1[E1["c"] = 2] = "c"; +(function(E) { + E[E["a"] = 0] = "a"; + E[E["b"] = 1] = "b"; + E[E["c"] = 2] = "c"; })(E || (E = { })); var a; diff --git a/crates/swc/tests/tsc-references/expressions/assignmentOperator/compoundArithmeticAssignmentLHSCanBeAssigned/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/expressions/assignmentOperator/compoundArithmeticAssignmentLHSCanBeAssigned/input.ts/es2015.2.minified/output.js index ac040737e62..fa0cdb45a5a 100644 --- a/crates/swc/tests/tsc-references/expressions/assignmentOperator/compoundArithmeticAssignmentLHSCanBeAssigned/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/expressions/assignmentOperator/compoundArithmeticAssignmentLHSCanBeAssigned/input.ts/es2015.2.minified/output.js @@ -1,3 +1,3 @@ -var E, a, b, c, x1, x2, x3, E1; -(E1 = E || (E = { -}))[E1.a = 0] = "a", E1[E1.b = 1] = "b", E1[E1.c = 2] = "c", x1 *= a, x1 *= b, x1 *= c, x1 *= null, x1 *= void 0, x2 *= a, x2 *= b, x2 *= c, x2 *= null, x2 *= void 0, x3 *= a, x3 *= b, x3 *= c, x3 *= null, x3 *= void 0; +var E, a, b, c, x1, x2, x3, E; +(E = E || (E = { +}))[E.a = 0] = "a", E[E.b = 1] = "b", E[E.c = 2] = "c", x1 *= a, x1 *= b, x1 *= c, x1 *= null, x1 *= void 0, x2 *= a, x2 *= b, x2 *= c, x2 *= null, x2 *= void 0, x3 *= a, x3 *= b, x3 *= c, x3 *= null, x3 *= void 0; diff --git a/crates/swc/tests/tsc-references/expressions/assignmentOperator/compoundArithmeticAssignmentLHSCanBeAssigned/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/expressions/assignmentOperator/compoundArithmeticAssignmentLHSCanBeAssigned/input.ts/es5.1.normal/output.js index ceb0a352d2f..f41b8357ca4 100644 --- a/crates/swc/tests/tsc-references/expressions/assignmentOperator/compoundArithmeticAssignmentLHSCanBeAssigned/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/expressions/assignmentOperator/compoundArithmeticAssignmentLHSCanBeAssigned/input.ts/es5.1.normal/output.js @@ -1,8 +1,8 @@ var E; -(function(E1) { - E1[E1["a"] = 0] = "a"; - E1[E1["b"] = 1] = "b"; - E1[E1["c"] = 2] = "c"; +(function(E) { + E[E["a"] = 0] = "a"; + E[E["b"] = 1] = "b"; + E[E["c"] = 2] = "c"; })(E || (E = { })); var a; diff --git a/crates/swc/tests/tsc-references/expressions/assignmentOperator/compoundArithmeticAssignmentLHSCanBeAssigned/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/expressions/assignmentOperator/compoundArithmeticAssignmentLHSCanBeAssigned/input.ts/es5.2.minified/output.js index ac040737e62..fa0cdb45a5a 100644 --- a/crates/swc/tests/tsc-references/expressions/assignmentOperator/compoundArithmeticAssignmentLHSCanBeAssigned/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/expressions/assignmentOperator/compoundArithmeticAssignmentLHSCanBeAssigned/input.ts/es5.2.minified/output.js @@ -1,3 +1,3 @@ -var E, a, b, c, x1, x2, x3, E1; -(E1 = E || (E = { -}))[E1.a = 0] = "a", E1[E1.b = 1] = "b", E1[E1.c = 2] = "c", x1 *= a, x1 *= b, x1 *= c, x1 *= null, x1 *= void 0, x2 *= a, x2 *= b, x2 *= c, x2 *= null, x2 *= void 0, x3 *= a, x3 *= b, x3 *= c, x3 *= null, x3 *= void 0; +var E, a, b, c, x1, x2, x3, E; +(E = E || (E = { +}))[E.a = 0] = "a", E[E.b = 1] = "b", E[E.c = 2] = "c", x1 *= a, x1 *= b, x1 *= c, x1 *= null, x1 *= void 0, x2 *= a, x2 *= b, x2 *= c, x2 *= null, x2 *= void 0, x3 *= a, x3 *= b, x3 *= c, x3 *= null, x3 *= void 0; diff --git a/crates/swc/tests/tsc-references/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands/input.ts/es2015.1.normal/output.js index 908ee58a3ca..58f91e84c0b 100644 --- a/crates/swc/tests/tsc-references/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands/input.ts/es2015.1.normal/output.js @@ -1,7 +1,7 @@ var E; -(function(E1) { - E1[E1["a"] = 0] = "a"; - E1[E1["b"] = 1] = "b"; +(function(E) { + E[E["a"] = 0] = "a"; + E[E["b"] = 1] = "b"; })(E || (E = { })); var a; diff --git a/crates/swc/tests/tsc-references/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands/input.ts/es2015.2.minified/output.js index 2366c2a95b0..556c415d8e7 100644 --- a/crates/swc/tests/tsc-references/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands/input.ts/es2015.2.minified/output.js @@ -1,6 +1,6 @@ -var E, a, b, x1, x2, x3, x4, x5, x6, E1; -(E1 = E || (E = { -}))[E1.a = 0] = "a", E1[E1.b = 1] = "b", x1 *= a, x1 *= b, x1 *= !0, x1 *= 0, x1 *= "", x1 *= E.a, x1 *= { +var E, a, b, x1, x2, x3, x4, x5, x6, E; +(E = E || (E = { +}))[E.a = 0] = "a", E[E.b = 1] = "b", x1 *= a, x1 *= b, x1 *= !0, x1 *= 0, x1 *= "", x1 *= E.a, x1 *= { }, x1 *= null, x1 *= void 0, x2 *= a, x2 *= b, x2 *= !0, x2 *= 0, x2 *= "", x2 *= E.a, x2 *= { }, x2 *= null, x2 *= void 0, x3 *= a, x3 *= b, x3 *= !0, x3 *= 0, x3 *= "", x3 *= E.a, x3 *= { }, x3 *= null, x3 *= void 0, x4 *= a, x4 *= b, x4 *= !0, x4 *= 0, x4 *= "", x4 *= E.a, x4 *= { diff --git a/crates/swc/tests/tsc-references/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands/input.ts/es5.1.normal/output.js index 908ee58a3ca..58f91e84c0b 100644 --- a/crates/swc/tests/tsc-references/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands/input.ts/es5.1.normal/output.js @@ -1,7 +1,7 @@ var E; -(function(E1) { - E1[E1["a"] = 0] = "a"; - E1[E1["b"] = 1] = "b"; +(function(E) { + E[E["a"] = 0] = "a"; + E[E["b"] = 1] = "b"; })(E || (E = { })); var a; diff --git a/crates/swc/tests/tsc-references/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands/input.ts/es5.2.minified/output.js index 2366c2a95b0..556c415d8e7 100644 --- a/crates/swc/tests/tsc-references/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands/input.ts/es5.2.minified/output.js @@ -1,6 +1,6 @@ -var E, a, b, x1, x2, x3, x4, x5, x6, E1; -(E1 = E || (E = { -}))[E1.a = 0] = "a", E1[E1.b = 1] = "b", x1 *= a, x1 *= b, x1 *= !0, x1 *= 0, x1 *= "", x1 *= E.a, x1 *= { +var E, a, b, x1, x2, x3, x4, x5, x6, E; +(E = E || (E = { +}))[E.a = 0] = "a", E[E.b = 1] = "b", x1 *= a, x1 *= b, x1 *= !0, x1 *= 0, x1 *= "", x1 *= E.a, x1 *= { }, x1 *= null, x1 *= void 0, x2 *= a, x2 *= b, x2 *= !0, x2 *= 0, x2 *= "", x2 *= E.a, x2 *= { }, x2 *= null, x2 *= void 0, x3 *= a, x3 *= b, x3 *= !0, x3 *= 0, x3 *= "", x3 *= E.a, x3 *= { }, x3 *= null, x3 *= void 0, x4 *= a, x4 *= b, x4 *= !0, x4 *= 0, x4 *= "", x4 *= E.a, x4 *= { diff --git a/crates/swc/tests/tsc-references/expressions/binaryOperators/additionOperator/additionOperatorWithAnyAndEveryType/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/expressions/binaryOperators/additionOperator/additionOperatorWithAnyAndEveryType/input.ts/es2015.1.normal/output.js index ca2fd3c2148..2679b229b6d 100644 --- a/crates/swc/tests/tsc-references/expressions/binaryOperators/additionOperator/additionOperatorWithAnyAndEveryType/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/expressions/binaryOperators/additionOperator/additionOperatorWithAnyAndEveryType/input.ts/es2015.1.normal/output.js @@ -5,10 +5,10 @@ class C { } } var E; -(function(E1) { - E1[E1["a"] = 0] = "a"; - E1[E1["b"] = 1] = "b"; - E1[E1["c"] = 2] = "c"; +(function(E) { + E[E["a"] = 0] = "a"; + E[E["b"] = 1] = "b"; + E[E["c"] = 2] = "c"; })(E || (E = { })); var M; diff --git a/crates/swc/tests/tsc-references/expressions/binaryOperators/additionOperator/additionOperatorWithAnyAndEveryType/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/expressions/binaryOperators/additionOperator/additionOperatorWithAnyAndEveryType/input.ts/es2015.2.minified/output.js index da37b119ae8..b31e88871f7 100644 --- a/crates/swc/tests/tsc-references/expressions/binaryOperators/additionOperator/additionOperatorWithAnyAndEveryType/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/expressions/binaryOperators/additionOperator/additionOperatorWithAnyAndEveryType/input.ts/es2015.2.minified/output.js @@ -1,5 +1,5 @@ -var E, E1, M, a, b; -(E = E1 || (E1 = { +var E, E, M, a, b; +(E = E || (E = { }))[E.a = 0] = "a", E[E.b = 1] = "b", E[E.c = 2] = "c", (function(M1) { var a1; M1.a = a1; @@ -7,4 +7,4 @@ var E, E1, M, a, b; })), a + a, a + b, a + new class { static foo() { } -}(), a + E1.a; +}(), a + E.a; diff --git a/crates/swc/tests/tsc-references/expressions/binaryOperators/additionOperator/additionOperatorWithAnyAndEveryType/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/expressions/binaryOperators/additionOperator/additionOperatorWithAnyAndEveryType/input.ts/es5.1.normal/output.js index a5814e4f2ef..3d3ad960adf 100644 --- a/crates/swc/tests/tsc-references/expressions/binaryOperators/additionOperator/additionOperatorWithAnyAndEveryType/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/expressions/binaryOperators/additionOperator/additionOperatorWithAnyAndEveryType/input.ts/es5.1.normal/output.js @@ -34,10 +34,10 @@ var C = /*#__PURE__*/ function() { return C; }(); var E; -(function(E1) { - E1[E1["a"] = 0] = "a"; - E1[E1["b"] = 1] = "b"; - E1[E1["c"] = 2] = "c"; +(function(E) { + E[E["a"] = 0] = "a"; + E[E["b"] = 1] = "b"; + E[E["c"] = 2] = "c"; })(E || (E = { })); var M; diff --git a/crates/swc/tests/tsc-references/expressions/binaryOperators/additionOperator/additionOperatorWithAnyAndEveryType/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/expressions/binaryOperators/additionOperator/additionOperatorWithAnyAndEveryType/input.ts/es5.2.minified/output.js index c30bc9020a8..930b66c23c3 100644 --- a/crates/swc/tests/tsc-references/expressions/binaryOperators/additionOperator/additionOperatorWithAnyAndEveryType/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/expressions/binaryOperators/additionOperator/additionOperatorWithAnyAndEveryType/input.ts/es5.2.minified/output.js @@ -1,4 +1,4 @@ -var E, M, a, E1, C = function() { +var E, M, a, E, C = function() { "use strict"; var Constructor; function C() { @@ -19,8 +19,8 @@ var E, M, a, E1, C = function() { } ]), C; }(); -(E1 = E || (E = { -}))[E1.a = 0] = "a", E1[E1.b = 1] = "b", E1[E1.c = 2] = "c", (function(M1) { +(E = E || (E = { +}))[E.a = 0] = "a", E[E.b = 1] = "b", E[E.c = 2] = "c", (function(M1) { var a1; M1.a = a1; })(M || (M = { diff --git a/crates/swc/tests/tsc-references/expressions/binaryOperators/additionOperator/additionOperatorWithInvalidOperands/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/expressions/binaryOperators/additionOperator/additionOperatorWithInvalidOperands/input.ts/es2015.1.normal/output.js index 39f9329ec54..fe529a0c218 100644 --- a/crates/swc/tests/tsc-references/expressions/binaryOperators/additionOperator/additionOperatorWithInvalidOperands/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/expressions/binaryOperators/additionOperator/additionOperatorWithInvalidOperands/input.ts/es2015.1.normal/output.js @@ -5,10 +5,10 @@ class C { } } var E; -(function(E1) { - E1[E1["a"] = 0] = "a"; - E1[E1["b"] = 1] = "b"; - E1[E1["c"] = 2] = "c"; +(function(E) { + E[E["a"] = 0] = "a"; + E[E["b"] = 1] = "b"; + E[E["c"] = 2] = "c"; })(E || (E = { })); var M; diff --git a/crates/swc/tests/tsc-references/expressions/binaryOperators/additionOperator/additionOperatorWithInvalidOperands/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/expressions/binaryOperators/additionOperator/additionOperatorWithInvalidOperands/input.ts/es2015.2.minified/output.js index 82c84cc7608..d1367ef2cdc 100644 --- a/crates/swc/tests/tsc-references/expressions/binaryOperators/additionOperator/additionOperatorWithInvalidOperands/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/expressions/binaryOperators/additionOperator/additionOperatorWithInvalidOperands/input.ts/es2015.2.minified/output.js @@ -1,11 +1,11 @@ -var E, E1, M, a, b; +var E, E, M, a, b; class C { static foo() { } } -(E = E1 || (E1 = { +(E = E || (E = { }))[E.a = 0] = "a", E[E.b = 1] = "b", E[E.c = 2] = "c", (function(M1) { var a1; M1.a = a1; })(M || (M = { -})), a + a, a + b, E1.a + new C(), E1.a + C.foo(), E1.a + M; +})), a + a, a + b, E.a + new C(), E.a + C.foo(), E.a + M; diff --git a/crates/swc/tests/tsc-references/expressions/binaryOperators/additionOperator/additionOperatorWithInvalidOperands/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/expressions/binaryOperators/additionOperator/additionOperatorWithInvalidOperands/input.ts/es5.1.normal/output.js index 6d513ea8aa2..d0cbcdcffce 100644 --- a/crates/swc/tests/tsc-references/expressions/binaryOperators/additionOperator/additionOperatorWithInvalidOperands/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/expressions/binaryOperators/additionOperator/additionOperatorWithInvalidOperands/input.ts/es5.1.normal/output.js @@ -34,10 +34,10 @@ var C = /*#__PURE__*/ function() { return C; }(); var E; -(function(E1) { - E1[E1["a"] = 0] = "a"; - E1[E1["b"] = 1] = "b"; - E1[E1["c"] = 2] = "c"; +(function(E) { + E[E["a"] = 0] = "a"; + E[E["b"] = 1] = "b"; + E[E["c"] = 2] = "c"; })(E || (E = { })); var M; diff --git a/crates/swc/tests/tsc-references/expressions/binaryOperators/additionOperator/additionOperatorWithInvalidOperands/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/expressions/binaryOperators/additionOperator/additionOperatorWithInvalidOperands/input.ts/es5.2.minified/output.js index 72694ec82c1..16eec187c31 100644 --- a/crates/swc/tests/tsc-references/expressions/binaryOperators/additionOperator/additionOperatorWithInvalidOperands/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/expressions/binaryOperators/additionOperator/additionOperatorWithInvalidOperands/input.ts/es5.2.minified/output.js @@ -1,4 +1,4 @@ -var E, M, a, E1, C = function() { +var E, M, a, E, C = function() { "use strict"; var Constructor; function C() { @@ -19,8 +19,8 @@ var E, M, a, E1, C = function() { } ]), C; }(); -(E1 = E || (E = { -}))[E1.a = 0] = "a", E1[E1.b = 1] = "b", E1[E1.c = 2] = "c", (function(M1) { +(E = E || (E = { +}))[E.a = 0] = "a", E[E.b = 1] = "b", E[E.c = 2] = "c", (function(M1) { var a1; M1.a = a1; })(M || (M = { diff --git a/crates/swc/tests/tsc-references/expressions/binaryOperators/additionOperator/additionOperatorWithNullValueAndValidOperator/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/expressions/binaryOperators/additionOperator/additionOperatorWithNullValueAndValidOperator/input.ts/es2015.1.normal/output.js index a8b11e23df1..18b80f7bfa4 100644 --- a/crates/swc/tests/tsc-references/expressions/binaryOperators/additionOperator/additionOperatorWithNullValueAndValidOperator/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/expressions/binaryOperators/additionOperator/additionOperatorWithNullValueAndValidOperator/input.ts/es2015.1.normal/output.js @@ -1,9 +1,9 @@ var // If one operand is the null or undefined value, it is treated as having the type of the other operand. E; -(function(E1) { - E1[E1["a"] = 0] = "a"; - E1[E1["b"] = 1] = "b"; - E1[E1["c"] = 2] = "c"; +(function(E) { + E[E["a"] = 0] = "a"; + E[E["b"] = 1] = "b"; + E[E["c"] = 2] = "c"; })(E || (E = { })); var a; diff --git a/crates/swc/tests/tsc-references/expressions/binaryOperators/additionOperator/additionOperatorWithNullValueAndValidOperator/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/expressions/binaryOperators/additionOperator/additionOperatorWithNullValueAndValidOperator/input.ts/es2015.2.minified/output.js index 3ae89d4fc86..0ae5f977bf3 100644 --- a/crates/swc/tests/tsc-references/expressions/binaryOperators/additionOperator/additionOperatorWithNullValueAndValidOperator/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/expressions/binaryOperators/additionOperator/additionOperatorWithNullValueAndValidOperator/input.ts/es2015.2.minified/output.js @@ -1,3 +1,3 @@ -var E, E1, a; -(E = E1 || (E1 = { -}))[E.a = 0] = "a", E[E.b = 1] = "b", E[E.c = 2] = "c", null + a, a + null, null + E1.a, null + E1.a, E1.a + null, E1.a + null; +var E, E, a; +(E = E || (E = { +}))[E.a = 0] = "a", E[E.b = 1] = "b", E[E.c = 2] = "c", null + a, a + null, null + E.a, null + E.a, E.a + null, E.a + null; diff --git a/crates/swc/tests/tsc-references/expressions/binaryOperators/additionOperator/additionOperatorWithNullValueAndValidOperator/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/expressions/binaryOperators/additionOperator/additionOperatorWithNullValueAndValidOperator/input.ts/es5.1.normal/output.js index a8b11e23df1..18b80f7bfa4 100644 --- a/crates/swc/tests/tsc-references/expressions/binaryOperators/additionOperator/additionOperatorWithNullValueAndValidOperator/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/expressions/binaryOperators/additionOperator/additionOperatorWithNullValueAndValidOperator/input.ts/es5.1.normal/output.js @@ -1,9 +1,9 @@ var // If one operand is the null or undefined value, it is treated as having the type of the other operand. E; -(function(E1) { - E1[E1["a"] = 0] = "a"; - E1[E1["b"] = 1] = "b"; - E1[E1["c"] = 2] = "c"; +(function(E) { + E[E["a"] = 0] = "a"; + E[E["b"] = 1] = "b"; + E[E["c"] = 2] = "c"; })(E || (E = { })); var a; diff --git a/crates/swc/tests/tsc-references/expressions/binaryOperators/additionOperator/additionOperatorWithNullValueAndValidOperator/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/expressions/binaryOperators/additionOperator/additionOperatorWithNullValueAndValidOperator/input.ts/es5.2.minified/output.js index 3ae89d4fc86..0ae5f977bf3 100644 --- a/crates/swc/tests/tsc-references/expressions/binaryOperators/additionOperator/additionOperatorWithNullValueAndValidOperator/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/expressions/binaryOperators/additionOperator/additionOperatorWithNullValueAndValidOperator/input.ts/es5.2.minified/output.js @@ -1,3 +1,3 @@ -var E, E1, a; -(E = E1 || (E1 = { -}))[E.a = 0] = "a", E[E.b = 1] = "b", E[E.c = 2] = "c", null + a, a + null, null + E1.a, null + E1.a, E1.a + null, E1.a + null; +var E, E, a; +(E = E || (E = { +}))[E.a = 0] = "a", E[E.b = 1] = "b", E[E.c = 2] = "c", null + a, a + null, null + E.a, null + E.a, E.a + null, E.a + null; diff --git a/crates/swc/tests/tsc-references/expressions/binaryOperators/additionOperator/additionOperatorWithNumberAndEnum/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/expressions/binaryOperators/additionOperator/additionOperatorWithNumberAndEnum/input.ts/es2015.1.normal/output.js index 13d196f55c6..b087335c53b 100644 --- a/crates/swc/tests/tsc-references/expressions/binaryOperators/additionOperator/additionOperatorWithNumberAndEnum/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/expressions/binaryOperators/additionOperator/additionOperatorWithNumberAndEnum/input.ts/es2015.1.normal/output.js @@ -1,13 +1,13 @@ var E; -(function(E1) { - E1[E1["a"] = 0] = "a"; - E1[E1["b"] = 1] = "b"; +(function(E) { + E[E["a"] = 0] = "a"; + E[E["b"] = 1] = "b"; })(E || (E = { })); var F; -(function(F1) { - F1[F1["c"] = 0] = "c"; - F1[F1["d"] = 1] = "d"; +(function(F) { + F[F["c"] = 0] = "c"; + F[F["d"] = 1] = "d"; })(F || (F = { })); var a; diff --git a/crates/swc/tests/tsc-references/expressions/binaryOperators/additionOperator/additionOperatorWithNumberAndEnum/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/expressions/binaryOperators/additionOperator/additionOperatorWithNumberAndEnum/input.ts/es2015.2.minified/output.js index 9aa4b0c44e1..cbdc8eb8e44 100644 --- a/crates/swc/tests/tsc-references/expressions/binaryOperators/additionOperator/additionOperatorWithNumberAndEnum/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/expressions/binaryOperators/additionOperator/additionOperatorWithNumberAndEnum/input.ts/es2015.2.minified/output.js @@ -1,4 +1,4 @@ -var E, F, E1, F1, a, b; -(E = E1 || (E1 = { -}))[E.a = 0] = "a", E[E.b = 1] = "b", (F = F1 || (F1 = { -}))[F.c = 0] = "c", F[F.d = 1] = "d", a + a, a + b, E1.a + 0, E1.a + E1.b, E1.a + E1.b, E1.a + F1.c; +var E, F, E, F, a, b; +(E = E || (E = { +}))[E.a = 0] = "a", E[E.b = 1] = "b", (F = F || (F = { +}))[F.c = 0] = "c", F[F.d = 1] = "d", a + a, a + b, E.a + 0, E.a + E.b, E.a + E.b, E.a + F.c; diff --git a/crates/swc/tests/tsc-references/expressions/binaryOperators/additionOperator/additionOperatorWithNumberAndEnum/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/expressions/binaryOperators/additionOperator/additionOperatorWithNumberAndEnum/input.ts/es5.1.normal/output.js index 13d196f55c6..b087335c53b 100644 --- a/crates/swc/tests/tsc-references/expressions/binaryOperators/additionOperator/additionOperatorWithNumberAndEnum/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/expressions/binaryOperators/additionOperator/additionOperatorWithNumberAndEnum/input.ts/es5.1.normal/output.js @@ -1,13 +1,13 @@ var E; -(function(E1) { - E1[E1["a"] = 0] = "a"; - E1[E1["b"] = 1] = "b"; +(function(E) { + E[E["a"] = 0] = "a"; + E[E["b"] = 1] = "b"; })(E || (E = { })); var F; -(function(F1) { - F1[F1["c"] = 0] = "c"; - F1[F1["d"] = 1] = "d"; +(function(F) { + F[F["c"] = 0] = "c"; + F[F["d"] = 1] = "d"; })(F || (F = { })); var a; diff --git a/crates/swc/tests/tsc-references/expressions/binaryOperators/additionOperator/additionOperatorWithNumberAndEnum/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/expressions/binaryOperators/additionOperator/additionOperatorWithNumberAndEnum/input.ts/es5.2.minified/output.js index 9aa4b0c44e1..cbdc8eb8e44 100644 --- a/crates/swc/tests/tsc-references/expressions/binaryOperators/additionOperator/additionOperatorWithNumberAndEnum/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/expressions/binaryOperators/additionOperator/additionOperatorWithNumberAndEnum/input.ts/es5.2.minified/output.js @@ -1,4 +1,4 @@ -var E, F, E1, F1, a, b; -(E = E1 || (E1 = { -}))[E.a = 0] = "a", E[E.b = 1] = "b", (F = F1 || (F1 = { -}))[F.c = 0] = "c", F[F.d = 1] = "d", a + a, a + b, E1.a + 0, E1.a + E1.b, E1.a + E1.b, E1.a + F1.c; +var E, F, E, F, a, b; +(E = E || (E = { +}))[E.a = 0] = "a", E[E.b = 1] = "b", (F = F || (F = { +}))[F.c = 0] = "c", F[F.d = 1] = "d", a + a, a + b, E.a + 0, E.a + E.b, E.a + E.b, E.a + F.c; diff --git a/crates/swc/tests/tsc-references/expressions/binaryOperators/additionOperator/additionOperatorWithStringAndEveryType/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/expressions/binaryOperators/additionOperator/additionOperatorWithStringAndEveryType/input.ts/es2015.1.normal/output.js index 816b7d6cedc..4af23efb6b2 100644 --- a/crates/swc/tests/tsc-references/expressions/binaryOperators/additionOperator/additionOperatorWithStringAndEveryType/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/expressions/binaryOperators/additionOperator/additionOperatorWithStringAndEveryType/input.ts/es2015.1.normal/output.js @@ -1,8 +1,8 @@ var E; -(function(E1) { - E1[E1["a"] = 0] = "a"; - E1[E1["b"] = 1] = "b"; - E1[E1["c"] = 2] = "c"; +(function(E) { + E[E["a"] = 0] = "a"; + E[E["b"] = 1] = "b"; + E[E["c"] = 2] = "c"; })(E || (E = { })); var a; diff --git a/crates/swc/tests/tsc-references/expressions/binaryOperators/additionOperator/additionOperatorWithStringAndEveryType/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/expressions/binaryOperators/additionOperator/additionOperatorWithStringAndEveryType/input.ts/es2015.2.minified/output.js index bb842d6e920..bd2a65826fa 100644 --- a/crates/swc/tests/tsc-references/expressions/binaryOperators/additionOperator/additionOperatorWithStringAndEveryType/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/expressions/binaryOperators/additionOperator/additionOperatorWithStringAndEveryType/input.ts/es2015.2.minified/output.js @@ -1,3 +1,3 @@ -var E, E1, a, b, x; -(E = E1 || (E1 = { -}))[E.a = 0] = "a", E[E.b = 1] = "b", E[E.c = 2] = "c", x + a, x + b, x + E1.a; +var E, E, a, b, x; +(E = E || (E = { +}))[E.a = 0] = "a", E[E.b = 1] = "b", E[E.c = 2] = "c", x + a, x + b, x + E.a; diff --git a/crates/swc/tests/tsc-references/expressions/binaryOperators/additionOperator/additionOperatorWithStringAndEveryType/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/expressions/binaryOperators/additionOperator/additionOperatorWithStringAndEveryType/input.ts/es5.1.normal/output.js index 816b7d6cedc..4af23efb6b2 100644 --- a/crates/swc/tests/tsc-references/expressions/binaryOperators/additionOperator/additionOperatorWithStringAndEveryType/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/expressions/binaryOperators/additionOperator/additionOperatorWithStringAndEveryType/input.ts/es5.1.normal/output.js @@ -1,8 +1,8 @@ var E; -(function(E1) { - E1[E1["a"] = 0] = "a"; - E1[E1["b"] = 1] = "b"; - E1[E1["c"] = 2] = "c"; +(function(E) { + E[E["a"] = 0] = "a"; + E[E["b"] = 1] = "b"; + E[E["c"] = 2] = "c"; })(E || (E = { })); var a; diff --git a/crates/swc/tests/tsc-references/expressions/binaryOperators/additionOperator/additionOperatorWithStringAndEveryType/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/expressions/binaryOperators/additionOperator/additionOperatorWithStringAndEveryType/input.ts/es5.2.minified/output.js index bb842d6e920..bd2a65826fa 100644 --- a/crates/swc/tests/tsc-references/expressions/binaryOperators/additionOperator/additionOperatorWithStringAndEveryType/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/expressions/binaryOperators/additionOperator/additionOperatorWithStringAndEveryType/input.ts/es5.2.minified/output.js @@ -1,3 +1,3 @@ -var E, E1, a, b, x; -(E = E1 || (E1 = { -}))[E.a = 0] = "a", E[E.b = 1] = "b", E[E.c = 2] = "c", x + a, x + b, x + E1.a; +var E, E, a, b, x; +(E = E || (E = { +}))[E.a = 0] = "a", E[E.b = 1] = "b", E[E.c = 2] = "c", x + a, x + b, x + E.a; diff --git a/crates/swc/tests/tsc-references/expressions/binaryOperators/additionOperator/additionOperatorWithTypeParameter/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/expressions/binaryOperators/additionOperator/additionOperatorWithTypeParameter/input.ts/es2015.1.normal/output.js index 6d679ccf21a..0a6e2892814 100644 --- a/crates/swc/tests/tsc-references/expressions/binaryOperators/additionOperator/additionOperatorWithTypeParameter/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/expressions/binaryOperators/additionOperator/additionOperatorWithTypeParameter/input.ts/es2015.1.normal/output.js @@ -1,8 +1,8 @@ var // type parameter type is not a valid operand of addition operator E; -(function(E1) { - E1[E1["a"] = 0] = "a"; - E1[E1["b"] = 1] = "b"; +(function(E) { + E[E["a"] = 0] = "a"; + E[E["b"] = 1] = "b"; })(E || (E = { })); function foo(t, u) { diff --git a/crates/swc/tests/tsc-references/expressions/binaryOperators/additionOperator/additionOperatorWithTypeParameter/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/expressions/binaryOperators/additionOperator/additionOperatorWithTypeParameter/input.ts/es2015.2.minified/output.js index fcb70e7e46a..3a9ea1a3e4e 100644 --- a/crates/swc/tests/tsc-references/expressions/binaryOperators/additionOperator/additionOperatorWithTypeParameter/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/expressions/binaryOperators/additionOperator/additionOperatorWithTypeParameter/input.ts/es2015.2.minified/output.js @@ -1,3 +1,3 @@ -var E, E1; -(E1 = E || (E = { -}))[E1.a = 0] = "a", E1[E1.b = 1] = "b"; +var E, E; +(E = E || (E = { +}))[E.a = 0] = "a", E[E.b = 1] = "b"; diff --git a/crates/swc/tests/tsc-references/expressions/binaryOperators/additionOperator/additionOperatorWithTypeParameter/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/expressions/binaryOperators/additionOperator/additionOperatorWithTypeParameter/input.ts/es5.1.normal/output.js index 93f64739023..84606822d4c 100644 --- a/crates/swc/tests/tsc-references/expressions/binaryOperators/additionOperator/additionOperatorWithTypeParameter/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/expressions/binaryOperators/additionOperator/additionOperatorWithTypeParameter/input.ts/es5.1.normal/output.js @@ -1,8 +1,8 @@ var // type parameter type is not a valid operand of addition operator E; -(function(E1) { - E1[E1["a"] = 0] = "a"; - E1[E1["b"] = 1] = "b"; +(function(E) { + E[E["a"] = 0] = "a"; + E[E["b"] = 1] = "b"; })(E || (E = { })); function foo(t, u) { diff --git a/crates/swc/tests/tsc-references/expressions/binaryOperators/additionOperator/additionOperatorWithTypeParameter/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/expressions/binaryOperators/additionOperator/additionOperatorWithTypeParameter/input.ts/es5.2.minified/output.js index fcb70e7e46a..3a9ea1a3e4e 100644 --- a/crates/swc/tests/tsc-references/expressions/binaryOperators/additionOperator/additionOperatorWithTypeParameter/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/expressions/binaryOperators/additionOperator/additionOperatorWithTypeParameter/input.ts/es5.2.minified/output.js @@ -1,3 +1,3 @@ -var E, E1; -(E1 = E || (E = { -}))[E1.a = 0] = "a", E1[E1.b = 1] = "b"; +var E, E; +(E = E || (E = { +}))[E.a = 0] = "a", E[E.b = 1] = "b"; diff --git a/crates/swc/tests/tsc-references/expressions/binaryOperators/additionOperator/additionOperatorWithUndefinedValueAndValidOperator/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/expressions/binaryOperators/additionOperator/additionOperatorWithUndefinedValueAndValidOperator/input.ts/es2015.1.normal/output.js index 5ce50c5e150..4ea1bf86bdf 100644 --- a/crates/swc/tests/tsc-references/expressions/binaryOperators/additionOperator/additionOperatorWithUndefinedValueAndValidOperator/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/expressions/binaryOperators/additionOperator/additionOperatorWithUndefinedValueAndValidOperator/input.ts/es2015.1.normal/output.js @@ -1,9 +1,9 @@ var // If one operand is the null or undefined value, it is treated as having the type of the other operand. E; -(function(E1) { - E1[E1["a"] = 0] = "a"; - E1[E1["b"] = 1] = "b"; - E1[E1["c"] = 2] = "c"; +(function(E) { + E[E["a"] = 0] = "a"; + E[E["b"] = 1] = "b"; + E[E["c"] = 2] = "c"; })(E || (E = { })); var a; diff --git a/crates/swc/tests/tsc-references/expressions/binaryOperators/additionOperator/additionOperatorWithUndefinedValueAndValidOperator/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/expressions/binaryOperators/additionOperator/additionOperatorWithUndefinedValueAndValidOperator/input.ts/es2015.2.minified/output.js index 3cd9d61122d..39113f88817 100644 --- a/crates/swc/tests/tsc-references/expressions/binaryOperators/additionOperator/additionOperatorWithUndefinedValueAndValidOperator/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/expressions/binaryOperators/additionOperator/additionOperatorWithUndefinedValueAndValidOperator/input.ts/es2015.2.minified/output.js @@ -1,3 +1,3 @@ -var E, E1, a; -(E = E1 || (E1 = { -}))[E.a = 0] = "a", E[E.b = 1] = "b", E[E.c = 2] = "c", (void 0) + a, a + void 0, (void 0) + E1.a, (void 0) + E1.a, E1.a + void 0, E1.a + void 0; +var E, E, a; +(E = E || (E = { +}))[E.a = 0] = "a", E[E.b = 1] = "b", E[E.c = 2] = "c", (void 0) + a, a + void 0, (void 0) + E.a, (void 0) + E.a, E.a + void 0, E.a + void 0; diff --git a/crates/swc/tests/tsc-references/expressions/binaryOperators/additionOperator/additionOperatorWithUndefinedValueAndValidOperator/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/expressions/binaryOperators/additionOperator/additionOperatorWithUndefinedValueAndValidOperator/input.ts/es5.1.normal/output.js index 5ce50c5e150..4ea1bf86bdf 100644 --- a/crates/swc/tests/tsc-references/expressions/binaryOperators/additionOperator/additionOperatorWithUndefinedValueAndValidOperator/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/expressions/binaryOperators/additionOperator/additionOperatorWithUndefinedValueAndValidOperator/input.ts/es5.1.normal/output.js @@ -1,9 +1,9 @@ var // If one operand is the null or undefined value, it is treated as having the type of the other operand. E; -(function(E1) { - E1[E1["a"] = 0] = "a"; - E1[E1["b"] = 1] = "b"; - E1[E1["c"] = 2] = "c"; +(function(E) { + E[E["a"] = 0] = "a"; + E[E["b"] = 1] = "b"; + E[E["c"] = 2] = "c"; })(E || (E = { })); var a; diff --git a/crates/swc/tests/tsc-references/expressions/binaryOperators/additionOperator/additionOperatorWithUndefinedValueAndValidOperator/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/expressions/binaryOperators/additionOperator/additionOperatorWithUndefinedValueAndValidOperator/input.ts/es5.2.minified/output.js index 3cd9d61122d..39113f88817 100644 --- a/crates/swc/tests/tsc-references/expressions/binaryOperators/additionOperator/additionOperatorWithUndefinedValueAndValidOperator/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/expressions/binaryOperators/additionOperator/additionOperatorWithUndefinedValueAndValidOperator/input.ts/es5.2.minified/output.js @@ -1,3 +1,3 @@ -var E, E1, a; -(E = E1 || (E1 = { -}))[E.a = 0] = "a", E[E.b = 1] = "b", E[E.c = 2] = "c", (void 0) + a, a + void 0, (void 0) + E1.a, (void 0) + E1.a, E1.a + void 0, E1.a + void 0; +var E, E, a; +(E = E || (E = { +}))[E.a = 0] = "a", E[E.b = 1] = "b", E[E.c = 2] = "c", (void 0) + a, a + void 0, (void 0) + E.a, (void 0) + E.a, E.a + void 0, E.a + void 0; diff --git a/crates/swc/tests/tsc-references/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithEnum/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithEnum/input.ts/es2015.1.normal/output.js index 5bbf7bdebe1..6e1ccf976be 100644 --- a/crates/swc/tests/tsc-references/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithEnum/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithEnum/input.ts/es2015.1.normal/output.js @@ -1,8 +1,8 @@ var // operands of an enum type are treated as having the primitive type Number. E; -(function(E1) { - E1[E1["a"] = 0] = "a"; - E1[E1["b"] = 1] = "b"; +(function(E) { + E[E["a"] = 0] = "a"; + E[E["b"] = 1] = "b"; })(E || (E = { })); var a; diff --git a/crates/swc/tests/tsc-references/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithEnum/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithEnum/input.ts/es2015.2.minified/output.js index f599c6968e0..7d724ecdd0f 100644 --- a/crates/swc/tests/tsc-references/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithEnum/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithEnum/input.ts/es2015.2.minified/output.js @@ -1,3 +1,3 @@ -var E, E1, a, b, c; -(E = E1 || (E1 = { -}))[E.a = 0] = "a", E[E.b = 1] = "b", c * a, c * b, E1.a * a, E1.a * b, E1.a * E1.b, 1 * E1.a, a * E1.b, b * E1.b, 1 * E1.b, E1.a / a, E1.a / b, E1.a / E1.b, E1.a / 1, a / E1.b, b / E1.b, 1 / E1.b, E1.a % a, E1.a % b, E1.a % E1.b, E1.a % 1, a % E1.b, b % E1.b, 1 % E1.b, E1.a - a, E1.a - b, E1.a - E1.b, E1.a - 1, a - E1.b, b - E1.b, 1 - E1.b, E1.a << a, E1.a << b, E1.a << E1.b, E1.a << 1, a << E1.b, b << E1.b, 1 << E1.b, E1.a >> a, E1.a >> b, E1.a >> E1.b, E1.a >> 1, a >> E1.b, b >> E1.b, 1 >> E1.b, E1.a >>> a, E1.a >>> b, E1.a >>> E1.b, E1.a >>> 1, a >>> E1.b, b >>> E1.b, 1 >>> E1.b, E1.a & a, E1.a & b, E1.a & E1.b, 1 & E1.a, a & E1.b, b & E1.b, 1 & E1.b, E1.a ^ a, E1.a ^ b, E1.a ^ E1.b, 1 ^ E1.a, a ^ E1.b, b ^ E1.b, 1 ^ E1.b, E1.a | a, E1.a | b, E1.a | E1.b, 1 | E1.a, a | E1.b, b | E1.b, 1 | E1.b; +var E, E, a, b, c; +(E = E || (E = { +}))[E.a = 0] = "a", E[E.b = 1] = "b", c * a, c * b, E.a * a, E.a * b, E.a * E.b, 1 * E.a, a * E.b, b * E.b, 1 * E.b, E.a / a, E.a / b, E.a / E.b, E.a / 1, a / E.b, b / E.b, 1 / E.b, E.a % a, E.a % b, E.a % E.b, E.a % 1, a % E.b, b % E.b, 1 % E.b, E.a - a, E.a - b, E.a - E.b, E.a - 1, a - E.b, b - E.b, 1 - E.b, E.a << a, E.a << b, E.a << E.b, E.a << 1, a << E.b, b << E.b, 1 << E.b, E.a >> a, E.a >> b, E.a >> E.b, E.a >> 1, a >> E.b, b >> E.b, 1 >> E.b, E.a >>> a, E.a >>> b, E.a >>> E.b, E.a >>> 1, a >>> E.b, b >>> E.b, 1 >>> E.b, E.a & a, E.a & b, E.a & E.b, 1 & E.a, a & E.b, b & E.b, 1 & E.b, E.a ^ a, E.a ^ b, E.a ^ E.b, 1 ^ E.a, a ^ E.b, b ^ E.b, 1 ^ E.b, E.a | a, E.a | b, E.a | E.b, 1 | E.a, a | E.b, b | E.b, 1 | E.b; diff --git a/crates/swc/tests/tsc-references/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithEnum/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithEnum/input.ts/es5.1.normal/output.js index 5bbf7bdebe1..6e1ccf976be 100644 --- a/crates/swc/tests/tsc-references/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithEnum/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithEnum/input.ts/es5.1.normal/output.js @@ -1,8 +1,8 @@ var // operands of an enum type are treated as having the primitive type Number. E; -(function(E1) { - E1[E1["a"] = 0] = "a"; - E1[E1["b"] = 1] = "b"; +(function(E) { + E[E["a"] = 0] = "a"; + E[E["b"] = 1] = "b"; })(E || (E = { })); var a; diff --git a/crates/swc/tests/tsc-references/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithEnum/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithEnum/input.ts/es5.2.minified/output.js index f599c6968e0..7d724ecdd0f 100644 --- a/crates/swc/tests/tsc-references/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithEnum/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithEnum/input.ts/es5.2.minified/output.js @@ -1,3 +1,3 @@ -var E, E1, a, b, c; -(E = E1 || (E1 = { -}))[E.a = 0] = "a", E[E.b = 1] = "b", c * a, c * b, E1.a * a, E1.a * b, E1.a * E1.b, 1 * E1.a, a * E1.b, b * E1.b, 1 * E1.b, E1.a / a, E1.a / b, E1.a / E1.b, E1.a / 1, a / E1.b, b / E1.b, 1 / E1.b, E1.a % a, E1.a % b, E1.a % E1.b, E1.a % 1, a % E1.b, b % E1.b, 1 % E1.b, E1.a - a, E1.a - b, E1.a - E1.b, E1.a - 1, a - E1.b, b - E1.b, 1 - E1.b, E1.a << a, E1.a << b, E1.a << E1.b, E1.a << 1, a << E1.b, b << E1.b, 1 << E1.b, E1.a >> a, E1.a >> b, E1.a >> E1.b, E1.a >> 1, a >> E1.b, b >> E1.b, 1 >> E1.b, E1.a >>> a, E1.a >>> b, E1.a >>> E1.b, E1.a >>> 1, a >>> E1.b, b >>> E1.b, 1 >>> E1.b, E1.a & a, E1.a & b, E1.a & E1.b, 1 & E1.a, a & E1.b, b & E1.b, 1 & E1.b, E1.a ^ a, E1.a ^ b, E1.a ^ E1.b, 1 ^ E1.a, a ^ E1.b, b ^ E1.b, 1 ^ E1.b, E1.a | a, E1.a | b, E1.a | E1.b, 1 | E1.a, a | E1.b, b | E1.b, 1 | E1.b; +var E, E, a, b, c; +(E = E || (E = { +}))[E.a = 0] = "a", E[E.b = 1] = "b", c * a, c * b, E.a * a, E.a * b, E.a * E.b, 1 * E.a, a * E.b, b * E.b, 1 * E.b, E.a / a, E.a / b, E.a / E.b, E.a / 1, a / E.b, b / E.b, 1 / E.b, E.a % a, E.a % b, E.a % E.b, E.a % 1, a % E.b, b % E.b, 1 % E.b, E.a - a, E.a - b, E.a - E.b, E.a - 1, a - E.b, b - E.b, 1 - E.b, E.a << a, E.a << b, E.a << E.b, E.a << 1, a << E.b, b << E.b, 1 << E.b, E.a >> a, E.a >> b, E.a >> E.b, E.a >> 1, a >> E.b, b >> E.b, 1 >> E.b, E.a >>> a, E.a >>> b, E.a >>> E.b, E.a >>> 1, a >>> E.b, b >>> E.b, 1 >>> E.b, E.a & a, E.a & b, E.a & E.b, 1 & E.a, a & E.b, b & E.b, 1 & E.b, E.a ^ a, E.a ^ b, E.a ^ E.b, 1 ^ E.a, a ^ E.b, b ^ E.b, 1 ^ E.b, E.a | a, E.a | b, E.a | E.b, 1 | E.a, a | E.b, b | E.b, 1 | E.b; diff --git a/crates/swc/tests/tsc-references/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithEnumUnion/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithEnumUnion/input.ts/es2015.1.normal/output.js index 04237a76076..346b3c8cc14 100644 --- a/crates/swc/tests/tsc-references/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithEnumUnion/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithEnumUnion/input.ts/es2015.1.normal/output.js @@ -1,14 +1,14 @@ var // operands of an enum type are treated as having the primitive type Number. E; -(function(E1) { - E1[E1["a"] = 0] = "a"; - E1[E1["b"] = 1] = "b"; +(function(E) { + E[E["a"] = 0] = "a"; + E[E["b"] = 1] = "b"; })(E || (E = { })); var F; -(function(F1) { - F1[F1["c"] = 0] = "c"; - F1[F1["d"] = 1] = "d"; +(function(F) { + F[F["c"] = 0] = "c"; + F[F["d"] = 1] = "d"; })(F || (F = { })); var a; diff --git a/crates/swc/tests/tsc-references/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithEnumUnion/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithEnumUnion/input.ts/es2015.2.minified/output.js index 1c94607d912..0ae17bc1a9a 100644 --- a/crates/swc/tests/tsc-references/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithEnumUnion/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithEnumUnion/input.ts/es2015.2.minified/output.js @@ -1,4 +1,4 @@ -var E, F, E1, F1, a, b, c; -(E = E1 || (E1 = { -}))[E.a = 0] = "a", E[E.b = 1] = "b", (F = F1 || (F1 = { -}))[F.c = 0] = "c", F[F.d = 1] = "d", c * a, c * b, E1.a * a, E1.a * b, E1.a * E1.b, 1 * E1.a, a * E1.b, b * E1.b, 1 * E1.b, E1.a / a, E1.a / b, E1.a / E1.b, E1.a / 1, a / E1.b, b / E1.b, 1 / E1.b, E1.a % a, E1.a % b, E1.a % E1.b, E1.a % 1, a % E1.b, b % E1.b, 1 % E1.b, E1.a - a, E1.a - b, E1.a - E1.b, E1.a - 1, a - E1.b, b - E1.b, 1 - E1.b, E1.a << a, E1.a << b, E1.a << E1.b, E1.a << 1, a << E1.b, b << E1.b, 1 << E1.b, E1.a >> a, E1.a >> b, E1.a >> E1.b, E1.a >> 1, a >> E1.b, b >> E1.b, 1 >> E1.b, E1.a >>> a, E1.a >>> b, E1.a >>> E1.b, E1.a >>> 1, a >>> E1.b, b >>> E1.b, 1 >>> E1.b, E1.a & a, E1.a & b, E1.a & E1.b, 1 & E1.a, a & E1.b, b & E1.b, 1 & E1.b, E1.a ^ a, E1.a ^ b, E1.a ^ E1.b, 1 ^ E1.a, a ^ E1.b, b ^ E1.b, 1 ^ E1.b, E1.a | a, E1.a | b, E1.a | E1.b, 1 | E1.a, a | E1.b, b | E1.b, 1 | E1.b; +var E, F, E, F, a, b, c; +(E = E || (E = { +}))[E.a = 0] = "a", E[E.b = 1] = "b", (F = F || (F = { +}))[F.c = 0] = "c", F[F.d = 1] = "d", c * a, c * b, E.a * a, E.a * b, E.a * E.b, 1 * E.a, a * E.b, b * E.b, 1 * E.b, E.a / a, E.a / b, E.a / E.b, E.a / 1, a / E.b, b / E.b, 1 / E.b, E.a % a, E.a % b, E.a % E.b, E.a % 1, a % E.b, b % E.b, 1 % E.b, E.a - a, E.a - b, E.a - E.b, E.a - 1, a - E.b, b - E.b, 1 - E.b, E.a << a, E.a << b, E.a << E.b, E.a << 1, a << E.b, b << E.b, 1 << E.b, E.a >> a, E.a >> b, E.a >> E.b, E.a >> 1, a >> E.b, b >> E.b, 1 >> E.b, E.a >>> a, E.a >>> b, E.a >>> E.b, E.a >>> 1, a >>> E.b, b >>> E.b, 1 >>> E.b, E.a & a, E.a & b, E.a & E.b, 1 & E.a, a & E.b, b & E.b, 1 & E.b, E.a ^ a, E.a ^ b, E.a ^ E.b, 1 ^ E.a, a ^ E.b, b ^ E.b, 1 ^ E.b, E.a | a, E.a | b, E.a | E.b, 1 | E.a, a | E.b, b | E.b, 1 | E.b; diff --git a/crates/swc/tests/tsc-references/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithEnumUnion/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithEnumUnion/input.ts/es5.1.normal/output.js index 04237a76076..346b3c8cc14 100644 --- a/crates/swc/tests/tsc-references/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithEnumUnion/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithEnumUnion/input.ts/es5.1.normal/output.js @@ -1,14 +1,14 @@ var // operands of an enum type are treated as having the primitive type Number. E; -(function(E1) { - E1[E1["a"] = 0] = "a"; - E1[E1["b"] = 1] = "b"; +(function(E) { + E[E["a"] = 0] = "a"; + E[E["b"] = 1] = "b"; })(E || (E = { })); var F; -(function(F1) { - F1[F1["c"] = 0] = "c"; - F1[F1["d"] = 1] = "d"; +(function(F) { + F[F["c"] = 0] = "c"; + F[F["d"] = 1] = "d"; })(F || (F = { })); var a; diff --git a/crates/swc/tests/tsc-references/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithEnumUnion/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithEnumUnion/input.ts/es5.2.minified/output.js index 1c94607d912..0ae17bc1a9a 100644 --- a/crates/swc/tests/tsc-references/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithEnumUnion/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithEnumUnion/input.ts/es5.2.minified/output.js @@ -1,4 +1,4 @@ -var E, F, E1, F1, a, b, c; -(E = E1 || (E1 = { -}))[E.a = 0] = "a", E[E.b = 1] = "b", (F = F1 || (F1 = { -}))[F.c = 0] = "c", F[F.d = 1] = "d", c * a, c * b, E1.a * a, E1.a * b, E1.a * E1.b, 1 * E1.a, a * E1.b, b * E1.b, 1 * E1.b, E1.a / a, E1.a / b, E1.a / E1.b, E1.a / 1, a / E1.b, b / E1.b, 1 / E1.b, E1.a % a, E1.a % b, E1.a % E1.b, E1.a % 1, a % E1.b, b % E1.b, 1 % E1.b, E1.a - a, E1.a - b, E1.a - E1.b, E1.a - 1, a - E1.b, b - E1.b, 1 - E1.b, E1.a << a, E1.a << b, E1.a << E1.b, E1.a << 1, a << E1.b, b << E1.b, 1 << E1.b, E1.a >> a, E1.a >> b, E1.a >> E1.b, E1.a >> 1, a >> E1.b, b >> E1.b, 1 >> E1.b, E1.a >>> a, E1.a >>> b, E1.a >>> E1.b, E1.a >>> 1, a >>> E1.b, b >>> E1.b, 1 >>> E1.b, E1.a & a, E1.a & b, E1.a & E1.b, 1 & E1.a, a & E1.b, b & E1.b, 1 & E1.b, E1.a ^ a, E1.a ^ b, E1.a ^ E1.b, 1 ^ E1.a, a ^ E1.b, b ^ E1.b, 1 ^ E1.b, E1.a | a, E1.a | b, E1.a | E1.b, 1 | E1.a, a | E1.b, b | E1.b, 1 | E1.b; +var E, F, E, F, a, b, c; +(E = E || (E = { +}))[E.a = 0] = "a", E[E.b = 1] = "b", (F = F || (F = { +}))[F.c = 0] = "c", F[F.d = 1] = "d", c * a, c * b, E.a * a, E.a * b, E.a * E.b, 1 * E.a, a * E.b, b * E.b, 1 * E.b, E.a / a, E.a / b, E.a / E.b, E.a / 1, a / E.b, b / E.b, 1 / E.b, E.a % a, E.a % b, E.a % E.b, E.a % 1, a % E.b, b % E.b, 1 % E.b, E.a - a, E.a - b, E.a - E.b, E.a - 1, a - E.b, b - E.b, 1 - E.b, E.a << a, E.a << b, E.a << E.b, E.a << 1, a << E.b, b << E.b, 1 << E.b, E.a >> a, E.a >> b, E.a >> E.b, E.a >> 1, a >> E.b, b >> E.b, 1 >> E.b, E.a >>> a, E.a >>> b, E.a >>> E.b, E.a >>> 1, a >>> E.b, b >>> E.b, 1 >>> E.b, E.a & a, E.a & b, E.a & E.b, 1 & E.a, a & E.b, b & E.b, 1 & E.b, E.a ^ a, E.a ^ b, E.a ^ E.b, 1 ^ E.a, a ^ E.b, b ^ E.b, 1 ^ E.b, E.a | a, E.a | b, E.a | E.b, 1 | E.a, a | E.b, b | E.b, 1 | E.b; diff --git a/crates/swc/tests/tsc-references/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands/input.ts/es2015.1.normal/output.js index 73c676f8d0c..64455a26f66 100644 --- a/crates/swc/tests/tsc-references/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands/input.ts/es2015.1.normal/output.js @@ -1,10 +1,10 @@ var // these operators require their operands to be of type Any, the Number primitive type, or // an enum type E; -(function(E1) { - E1[E1["a"] = 0] = "a"; - E1[E1["b"] = 1] = "b"; - E1[E1["c"] = 2] = "c"; +(function(E) { + E[E["a"] = 0] = "a"; + E[E["b"] = 1] = "b"; + E[E["c"] = 2] = "c"; })(E || (E = { })); var a; diff --git a/crates/swc/tests/tsc-references/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands/input.ts/es2015.2.minified/output.js index d0a9c9548c0..ca43cf366cf 100644 --- a/crates/swc/tests/tsc-references/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands/input.ts/es2015.2.minified/output.js @@ -1,3 +1,3 @@ -var E, E1, a, b, c, d, e, f; -(E = E1 || (E1 = { -}))[E.a = 0] = "a", E[E.b = 1] = "b", E[E.c = 2] = "c", a * a, a * b, E1.a * a, E1.a * b, E1.a * c, E1.a * d, E1.a * e, E1.a * f, a * E1.b, b * E1.b, c * E1.b, d * E1.b, e * E1.b, f * E1.b, E1.a / a, E1.a / b, E1.a / c, E1.a / d, E1.a / e, E1.a / f, a / E1.b, b / E1.b, c / E1.b, d / E1.b, e / E1.b, f / E1.b, E1.a % a, E1.a % b, E1.a % c, E1.a % d, E1.a % e, E1.a % f, a % E1.b, b % E1.b, c % E1.b, d % E1.b, e % E1.b, f % E1.b, E1.a - a, E1.a - b, E1.a - c, E1.a - d, E1.a - e, E1.a - f, a - E1.b, b - E1.b, c - E1.b, d - E1.b, e - E1.b, f - E1.b, E1.a << a, E1.a << b, E1.a << c, E1.a << d, E1.a << e, E1.a << f, a << E1.b, b << E1.b, c << E1.b, d << E1.b, e << E1.b, f << E1.b, E1.a >> a, E1.a >> b, E1.a >> c, E1.a >> d, E1.a >> e, E1.a >> f, a >> E1.b, b >> E1.b, c >> E1.b, d >> E1.b, e >> E1.b, f >> E1.b, E1.a >>> a, E1.a >>> b, E1.a >>> c, E1.a >>> d, E1.a >>> e, E1.a >>> f, a >>> E1.b, b >>> E1.b, c >>> E1.b, d >>> E1.b, e >>> E1.b, f >>> E1.b, E1.a & a, E1.a & b, E1.a & c, E1.a & d, E1.a & e, E1.a & f, a & E1.b, b & E1.b, c & E1.b, d & E1.b, e & E1.b, f & E1.b, E1.a ^ a, E1.a ^ b, E1.a ^ c, E1.a ^ d, E1.a ^ e, E1.a ^ f, a ^ E1.b, b ^ E1.b, c ^ E1.b, d ^ E1.b, e ^ E1.b, f ^ E1.b, E1.a | a, E1.a | b, E1.a | c, E1.a | d, E1.a | e, E1.a | f, a | E1.b, b | E1.b, c | E1.b, d | E1.b, e | E1.b, f | E1.b; +var E, E, a, b, c, d, e, f; +(E = E || (E = { +}))[E.a = 0] = "a", E[E.b = 1] = "b", E[E.c = 2] = "c", a * a, a * b, E.a * a, E.a * b, E.a * c, E.a * d, E.a * e, E.a * f, a * E.b, b * E.b, c * E.b, d * E.b, e * E.b, f * E.b, E.a / a, E.a / b, E.a / c, E.a / d, E.a / e, E.a / f, a / E.b, b / E.b, c / E.b, d / E.b, e / E.b, f / E.b, E.a % a, E.a % b, E.a % c, E.a % d, E.a % e, E.a % f, a % E.b, b % E.b, c % E.b, d % E.b, e % E.b, f % E.b, E.a - a, E.a - b, E.a - c, E.a - d, E.a - e, E.a - f, a - E.b, b - E.b, c - E.b, d - E.b, e - E.b, f - E.b, E.a << a, E.a << b, E.a << c, E.a << d, E.a << e, E.a << f, a << E.b, b << E.b, c << E.b, d << E.b, e << E.b, f << E.b, E.a >> a, E.a >> b, E.a >> c, E.a >> d, E.a >> e, E.a >> f, a >> E.b, b >> E.b, c >> E.b, d >> E.b, e >> E.b, f >> E.b, E.a >>> a, E.a >>> b, E.a >>> c, E.a >>> d, E.a >>> e, E.a >>> f, a >>> E.b, b >>> E.b, c >>> E.b, d >>> E.b, e >>> E.b, f >>> E.b, E.a & a, E.a & b, E.a & c, E.a & d, E.a & e, E.a & f, a & E.b, b & E.b, c & E.b, d & E.b, e & E.b, f & E.b, E.a ^ a, E.a ^ b, E.a ^ c, E.a ^ d, E.a ^ e, E.a ^ f, a ^ E.b, b ^ E.b, c ^ E.b, d ^ E.b, e ^ E.b, f ^ E.b, E.a | a, E.a | b, E.a | c, E.a | d, E.a | e, E.a | f, a | E.b, b | E.b, c | E.b, d | E.b, e | E.b, f | E.b; diff --git a/crates/swc/tests/tsc-references/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands/input.ts/es5.1.normal/output.js index 73c676f8d0c..64455a26f66 100644 --- a/crates/swc/tests/tsc-references/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands/input.ts/es5.1.normal/output.js @@ -1,10 +1,10 @@ var // these operators require their operands to be of type Any, the Number primitive type, or // an enum type E; -(function(E1) { - E1[E1["a"] = 0] = "a"; - E1[E1["b"] = 1] = "b"; - E1[E1["c"] = 2] = "c"; +(function(E) { + E[E["a"] = 0] = "a"; + E[E["b"] = 1] = "b"; + E[E["c"] = 2] = "c"; })(E || (E = { })); var a; diff --git a/crates/swc/tests/tsc-references/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands/input.ts/es5.2.minified/output.js index d0a9c9548c0..ca43cf366cf 100644 --- a/crates/swc/tests/tsc-references/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands/input.ts/es5.2.minified/output.js @@ -1,3 +1,3 @@ -var E, E1, a, b, c, d, e, f; -(E = E1 || (E1 = { -}))[E.a = 0] = "a", E[E.b = 1] = "b", E[E.c = 2] = "c", a * a, a * b, E1.a * a, E1.a * b, E1.a * c, E1.a * d, E1.a * e, E1.a * f, a * E1.b, b * E1.b, c * E1.b, d * E1.b, e * E1.b, f * E1.b, E1.a / a, E1.a / b, E1.a / c, E1.a / d, E1.a / e, E1.a / f, a / E1.b, b / E1.b, c / E1.b, d / E1.b, e / E1.b, f / E1.b, E1.a % a, E1.a % b, E1.a % c, E1.a % d, E1.a % e, E1.a % f, a % E1.b, b % E1.b, c % E1.b, d % E1.b, e % E1.b, f % E1.b, E1.a - a, E1.a - b, E1.a - c, E1.a - d, E1.a - e, E1.a - f, a - E1.b, b - E1.b, c - E1.b, d - E1.b, e - E1.b, f - E1.b, E1.a << a, E1.a << b, E1.a << c, E1.a << d, E1.a << e, E1.a << f, a << E1.b, b << E1.b, c << E1.b, d << E1.b, e << E1.b, f << E1.b, E1.a >> a, E1.a >> b, E1.a >> c, E1.a >> d, E1.a >> e, E1.a >> f, a >> E1.b, b >> E1.b, c >> E1.b, d >> E1.b, e >> E1.b, f >> E1.b, E1.a >>> a, E1.a >>> b, E1.a >>> c, E1.a >>> d, E1.a >>> e, E1.a >>> f, a >>> E1.b, b >>> E1.b, c >>> E1.b, d >>> E1.b, e >>> E1.b, f >>> E1.b, E1.a & a, E1.a & b, E1.a & c, E1.a & d, E1.a & e, E1.a & f, a & E1.b, b & E1.b, c & E1.b, d & E1.b, e & E1.b, f & E1.b, E1.a ^ a, E1.a ^ b, E1.a ^ c, E1.a ^ d, E1.a ^ e, E1.a ^ f, a ^ E1.b, b ^ E1.b, c ^ E1.b, d ^ E1.b, e ^ E1.b, f ^ E1.b, E1.a | a, E1.a | b, E1.a | c, E1.a | d, E1.a | e, E1.a | f, a | E1.b, b | E1.b, c | E1.b, d | E1.b, e | E1.b, f | E1.b; +var E, E, a, b, c, d, e, f; +(E = E || (E = { +}))[E.a = 0] = "a", E[E.b = 1] = "b", E[E.c = 2] = "c", a * a, a * b, E.a * a, E.a * b, E.a * c, E.a * d, E.a * e, E.a * f, a * E.b, b * E.b, c * E.b, d * E.b, e * E.b, f * E.b, E.a / a, E.a / b, E.a / c, E.a / d, E.a / e, E.a / f, a / E.b, b / E.b, c / E.b, d / E.b, e / E.b, f / E.b, E.a % a, E.a % b, E.a % c, E.a % d, E.a % e, E.a % f, a % E.b, b % E.b, c % E.b, d % E.b, e % E.b, f % E.b, E.a - a, E.a - b, E.a - c, E.a - d, E.a - e, E.a - f, a - E.b, b - E.b, c - E.b, d - E.b, e - E.b, f - E.b, E.a << a, E.a << b, E.a << c, E.a << d, E.a << e, E.a << f, a << E.b, b << E.b, c << E.b, d << E.b, e << E.b, f << E.b, E.a >> a, E.a >> b, E.a >> c, E.a >> d, E.a >> e, E.a >> f, a >> E.b, b >> E.b, c >> E.b, d >> E.b, e >> E.b, f >> E.b, E.a >>> a, E.a >>> b, E.a >>> c, E.a >>> d, E.a >>> e, E.a >>> f, a >>> E.b, b >>> E.b, c >>> E.b, d >>> E.b, e >>> E.b, f >>> E.b, E.a & a, E.a & b, E.a & c, E.a & d, E.a & e, E.a & f, a & E.b, b & E.b, c & E.b, d & E.b, e & E.b, f & E.b, E.a ^ a, E.a ^ b, E.a ^ c, E.a ^ d, E.a ^ e, E.a ^ f, a ^ E.b, b ^ E.b, c ^ E.b, d ^ E.b, e ^ E.b, f ^ E.b, E.a | a, E.a | b, E.a | c, E.a | d, E.a | e, E.a | f, a | E.b, b | E.b, c | E.b, d | E.b, e | E.b, f | E.b; diff --git a/crates/swc/tests/tsc-references/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndValidOperands/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndValidOperands/input.ts/es2015.1.normal/output.js index b6d28e9c687..eb0f4b184f7 100644 --- a/crates/swc/tests/tsc-references/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndValidOperands/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndValidOperands/input.ts/es2015.1.normal/output.js @@ -1,9 +1,9 @@ var // If one operand is the null or undefined value, it is treated as having the type of the // other operand. E; -(function(E1) { - E1[E1["a"] = 0] = "a"; - E1[E1["b"] = 1] = "b"; +(function(E) { + E[E["a"] = 0] = "a"; + E[E["b"] = 1] = "b"; })(E || (E = { })); var a; diff --git a/crates/swc/tests/tsc-references/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndValidOperands/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndValidOperands/input.ts/es2015.2.minified/output.js index 94a5a7ad004..f5b9313f3eb 100644 --- a/crates/swc/tests/tsc-references/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndValidOperands/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndValidOperands/input.ts/es2015.2.minified/output.js @@ -1,3 +1,3 @@ -var E, E1, a, b; -(E = E1 || (E1 = { -}))[E.a = 0] = "a", E[E.b = 1] = "b", null * a, null * b, null * E1.a, null * E1.b, null / E1.a, E1.b / null, null % E1.a, E1.b % null, null - E1.a, E1.b - null, null << E1.a, E1.b << null, null >> E1.a, E1.b >> null, null >>> E1.a, E1.b >>> null, null & E1.a, null & E1.b, null ^ E1.a, null ^ E1.b, null | E1.a, null | E1.b; +var E, E, a, b; +(E = E || (E = { +}))[E.a = 0] = "a", E[E.b = 1] = "b", null * a, null * b, null * E.a, null * E.b, null / E.a, E.b / null, null % E.a, E.b % null, null - E.a, E.b - null, null << E.a, E.b << null, null >> E.a, E.b >> null, null >>> E.a, E.b >>> null, null & E.a, null & E.b, null ^ E.a, null ^ E.b, null | E.a, null | E.b; diff --git a/crates/swc/tests/tsc-references/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndValidOperands/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndValidOperands/input.ts/es5.1.normal/output.js index b6d28e9c687..eb0f4b184f7 100644 --- a/crates/swc/tests/tsc-references/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndValidOperands/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndValidOperands/input.ts/es5.1.normal/output.js @@ -1,9 +1,9 @@ var // If one operand is the null or undefined value, it is treated as having the type of the // other operand. E; -(function(E1) { - E1[E1["a"] = 0] = "a"; - E1[E1["b"] = 1] = "b"; +(function(E) { + E[E["a"] = 0] = "a"; + E[E["b"] = 1] = "b"; })(E || (E = { })); var a; diff --git a/crates/swc/tests/tsc-references/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndValidOperands/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndValidOperands/input.ts/es5.2.minified/output.js index 94a5a7ad004..f5b9313f3eb 100644 --- a/crates/swc/tests/tsc-references/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndValidOperands/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndValidOperands/input.ts/es5.2.minified/output.js @@ -1,3 +1,3 @@ -var E, E1, a, b; -(E = E1 || (E1 = { -}))[E.a = 0] = "a", E[E.b = 1] = "b", null * a, null * b, null * E1.a, null * E1.b, null / E1.a, E1.b / null, null % E1.a, E1.b % null, null - E1.a, E1.b - null, null << E1.a, E1.b << null, null >> E1.a, E1.b >> null, null >>> E1.a, E1.b >>> null, null & E1.a, null & E1.b, null ^ E1.a, null ^ E1.b, null | E1.a, null | E1.b; +var E, E, a, b; +(E = E || (E = { +}))[E.a = 0] = "a", E[E.b = 1] = "b", null * a, null * b, null * E.a, null * E.b, null / E.a, E.b / null, null % E.a, E.b % null, null - E.a, E.b - null, null << E.a, E.b << null, null >> E.a, E.b >> null, null >>> E.a, E.b >>> null, null & E.a, null & E.b, null ^ E.a, null ^ E.b, null | E.a, null | E.b; diff --git a/crates/swc/tests/tsc-references/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndValidOperands/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndValidOperands/input.ts/es2015.1.normal/output.js index db352b74bb9..b5f3ff14ba2 100644 --- a/crates/swc/tests/tsc-references/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndValidOperands/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndValidOperands/input.ts/es2015.1.normal/output.js @@ -1,9 +1,9 @@ var // If one operand is the undefined or undefined value, it is treated as having the type of the // other operand. E; -(function(E1) { - E1[E1["a"] = 0] = "a"; - E1[E1["b"] = 1] = "b"; +(function(E) { + E[E["a"] = 0] = "a"; + E[E["b"] = 1] = "b"; })(E || (E = { })); var a; diff --git a/crates/swc/tests/tsc-references/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndValidOperands/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndValidOperands/input.ts/es2015.2.minified/output.js index 296e858334f..2c00d6e1177 100644 --- a/crates/swc/tests/tsc-references/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndValidOperands/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndValidOperands/input.ts/es2015.2.minified/output.js @@ -1,3 +1,3 @@ -var E, E1, a, b; -(E = E1 || (E1 = { -}))[E.a = 0] = "a", E[E.b = 1] = "b", (void 0) * a, (void 0) * b, (void 0) * E1.a, (void 0) * E1.b, (void 0) / E1.a, E1.b / void 0, (void 0) % E1.a, E1.b % void 0, (void 0) - E1.a, E1.b - void 0, (void 0) << E1.a, E1.b << void 0, (void 0) >> E1.a, E1.b >> void 0, (void 0) >>> E1.a, E1.b >>> void 0, (void 0) & E1.a, (void 0) & E1.b, (void 0) ^ E1.a, (void 0) ^ E1.b, (void 0) | E1.a, (void 0) | E1.b; +var E, E, a, b; +(E = E || (E = { +}))[E.a = 0] = "a", E[E.b = 1] = "b", (void 0) * a, (void 0) * b, (void 0) * E.a, (void 0) * E.b, (void 0) / E.a, E.b / void 0, (void 0) % E.a, E.b % void 0, (void 0) - E.a, E.b - void 0, (void 0) << E.a, E.b << void 0, (void 0) >> E.a, E.b >> void 0, (void 0) >>> E.a, E.b >>> void 0, (void 0) & E.a, (void 0) & E.b, (void 0) ^ E.a, (void 0) ^ E.b, (void 0) | E.a, (void 0) | E.b; diff --git a/crates/swc/tests/tsc-references/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndValidOperands/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndValidOperands/input.ts/es5.1.normal/output.js index db352b74bb9..b5f3ff14ba2 100644 --- a/crates/swc/tests/tsc-references/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndValidOperands/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndValidOperands/input.ts/es5.1.normal/output.js @@ -1,9 +1,9 @@ var // If one operand is the undefined or undefined value, it is treated as having the type of the // other operand. E; -(function(E1) { - E1[E1["a"] = 0] = "a"; - E1[E1["b"] = 1] = "b"; +(function(E) { + E[E["a"] = 0] = "a"; + E[E["b"] = 1] = "b"; })(E || (E = { })); var a; diff --git a/crates/swc/tests/tsc-references/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndValidOperands/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndValidOperands/input.ts/es5.2.minified/output.js index 296e858334f..2c00d6e1177 100644 --- a/crates/swc/tests/tsc-references/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndValidOperands/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndValidOperands/input.ts/es5.2.minified/output.js @@ -1,3 +1,3 @@ -var E, E1, a, b; -(E = E1 || (E1 = { -}))[E.a = 0] = "a", E[E.b = 1] = "b", (void 0) * a, (void 0) * b, (void 0) * E1.a, (void 0) * E1.b, (void 0) / E1.a, E1.b / void 0, (void 0) % E1.a, E1.b % void 0, (void 0) - E1.a, E1.b - void 0, (void 0) << E1.a, E1.b << void 0, (void 0) >> E1.a, E1.b >> void 0, (void 0) >>> E1.a, E1.b >>> void 0, (void 0) & E1.a, (void 0) & E1.b, (void 0) ^ E1.a, (void 0) ^ E1.b, (void 0) | E1.a, (void 0) | E1.b; +var E, E, a, b; +(E = E || (E = { +}))[E.a = 0] = "a", E[E.b = 1] = "b", (void 0) * a, (void 0) * b, (void 0) * E.a, (void 0) * E.b, (void 0) / E.a, E.b / void 0, (void 0) % E.a, E.b % void 0, (void 0) - E.a, E.b - void 0, (void 0) << E.a, E.b << void 0, (void 0) >> E.a, E.b >> void 0, (void 0) >>> E.a, E.b >>> void 0, (void 0) & E.a, (void 0) & E.b, (void 0) ^ E.a, (void 0) ^ E.b, (void 0) | E.a, (void 0) | E.b; diff --git a/crates/swc/tests/tsc-references/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithIdenticalPrimitiveType/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithIdenticalPrimitiveType/input.ts/es2015.1.normal/output.js index 46bea3d066b..86c90c4ecc2 100644 --- a/crates/swc/tests/tsc-references/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithIdenticalPrimitiveType/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithIdenticalPrimitiveType/input.ts/es2015.1.normal/output.js @@ -1,8 +1,8 @@ var E; -(function(E1) { - E1[E1["a"] = 0] = "a"; - E1[E1["b"] = 1] = "b"; - E1[E1["c"] = 2] = "c"; +(function(E) { + E[E["a"] = 0] = "a"; + E[E["b"] = 1] = "b"; + E[E["c"] = 2] = "c"; })(E || (E = { })); var a; diff --git a/crates/swc/tests/tsc-references/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithIdenticalPrimitiveType/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithIdenticalPrimitiveType/input.ts/es2015.2.minified/output.js index 70238e87f03..97698574f44 100644 --- a/crates/swc/tests/tsc-references/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithIdenticalPrimitiveType/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithIdenticalPrimitiveType/input.ts/es2015.2.minified/output.js @@ -1,3 +1,3 @@ -var E, E1; -(E = E1 || (E1 = { +var E, E; +(E = E || (E = { }))[E.a = 0] = "a", E[E.b = 1] = "b", E[E.c = 2] = "c"; diff --git a/crates/swc/tests/tsc-references/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithIdenticalPrimitiveType/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithIdenticalPrimitiveType/input.ts/es5.1.normal/output.js index 46bea3d066b..86c90c4ecc2 100644 --- a/crates/swc/tests/tsc-references/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithIdenticalPrimitiveType/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithIdenticalPrimitiveType/input.ts/es5.1.normal/output.js @@ -1,8 +1,8 @@ var E; -(function(E1) { - E1[E1["a"] = 0] = "a"; - E1[E1["b"] = 1] = "b"; - E1[E1["c"] = 2] = "c"; +(function(E) { + E[E["a"] = 0] = "a"; + E[E["b"] = 1] = "b"; + E[E["c"] = 2] = "c"; })(E || (E = { })); var a; diff --git a/crates/swc/tests/tsc-references/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithIdenticalPrimitiveType/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithIdenticalPrimitiveType/input.ts/es5.2.minified/output.js index 70238e87f03..97698574f44 100644 --- a/crates/swc/tests/tsc-references/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithIdenticalPrimitiveType/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithIdenticalPrimitiveType/input.ts/es5.2.minified/output.js @@ -1,3 +1,3 @@ -var E, E1; -(E = E1 || (E1 = { +var E, E; +(E = E || (E = { }))[E.a = 0] = "a", E[E.b = 1] = "b", E[E.c = 2] = "c"; diff --git a/crates/swc/tests/tsc-references/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType/input.ts/es2015.1.normal/output.js index 88d0c26d64a..8de1703d3c8 100644 --- a/crates/swc/tests/tsc-references/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType/input.ts/es2015.1.normal/output.js @@ -1,8 +1,8 @@ var E; -(function(E1) { - E1[E1["a"] = 0] = "a"; - E1[E1["b"] = 1] = "b"; - E1[E1["c"] = 2] = "c"; +(function(E) { + E[E["a"] = 0] = "a"; + E[E["b"] = 1] = "b"; + E[E["c"] = 2] = "c"; })(E || (E = { })); var a; diff --git a/crates/swc/tests/tsc-references/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType/input.ts/es2015.2.minified/output.js index ed823855823..18bda281033 100644 --- a/crates/swc/tests/tsc-references/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType/input.ts/es2015.2.minified/output.js @@ -1,3 +1,3 @@ -var E, E1, a, b, c; -(E = E1 || (E1 = { +var E, E, a, b, c; +(E = E || (E = { }))[E.a = 0] = "a", E[E.b = 1] = "b", E[E.c = 2] = "c", a < b, a < c; diff --git a/crates/swc/tests/tsc-references/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType/input.ts/es5.1.normal/output.js index 88d0c26d64a..8de1703d3c8 100644 --- a/crates/swc/tests/tsc-references/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType/input.ts/es5.1.normal/output.js @@ -1,8 +1,8 @@ var E; -(function(E1) { - E1[E1["a"] = 0] = "a"; - E1[E1["b"] = 1] = "b"; - E1[E1["c"] = 2] = "c"; +(function(E) { + E[E["a"] = 0] = "a"; + E[E["b"] = 1] = "b"; + E[E["c"] = 2] = "c"; })(E || (E = { })); var a; diff --git a/crates/swc/tests/tsc-references/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType/input.ts/es5.2.minified/output.js index ed823855823..18bda281033 100644 --- a/crates/swc/tests/tsc-references/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType/input.ts/es5.2.minified/output.js @@ -1,3 +1,3 @@ -var E, E1, a, b, c; -(E = E1 || (E1 = { +var E, E, a, b, c; +(E = E || (E = { }))[E.a = 0] = "a", E[E.b = 1] = "b", E[E.c = 2] = "c", a < b, a < c; diff --git a/crates/swc/tests/tsc-references/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter/input.ts/es2015.1.normal/output.js index ad494e3d16f..3ad0703830e 100644 --- a/crates/swc/tests/tsc-references/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter/input.ts/es2015.1.normal/output.js @@ -1,8 +1,8 @@ var E; -(function(E1) { - E1[E1["a"] = 0] = "a"; - E1[E1["b"] = 1] = "b"; - E1[E1["c"] = 2] = "c"; +(function(E) { + E[E["a"] = 0] = "a"; + E[E["b"] = 1] = "b"; + E[E["c"] = 2] = "c"; })(E || (E = { })); var a; diff --git a/crates/swc/tests/tsc-references/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter/input.ts/es2015.2.minified/output.js index e9b35917858..97698574f44 100644 --- a/crates/swc/tests/tsc-references/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter/input.ts/es2015.2.minified/output.js @@ -1,3 +1,3 @@ -var E, E1; -(E1 = E || (E = { -}))[E1.a = 0] = "a", E1[E1.b = 1] = "b", E1[E1.c = 2] = "c"; +var E, E; +(E = E || (E = { +}))[E.a = 0] = "a", E[E.b = 1] = "b", E[E.c = 2] = "c"; diff --git a/crates/swc/tests/tsc-references/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter/input.ts/es5.1.normal/output.js index ad494e3d16f..3ad0703830e 100644 --- a/crates/swc/tests/tsc-references/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter/input.ts/es5.1.normal/output.js @@ -1,8 +1,8 @@ var E; -(function(E1) { - E1[E1["a"] = 0] = "a"; - E1[E1["b"] = 1] = "b"; - E1[E1["c"] = 2] = "c"; +(function(E) { + E[E["a"] = 0] = "a"; + E[E["b"] = 1] = "b"; + E[E["c"] = 2] = "c"; })(E || (E = { })); var a; diff --git a/crates/swc/tests/tsc-references/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter/input.ts/es5.2.minified/output.js index e9b35917858..97698574f44 100644 --- a/crates/swc/tests/tsc-references/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipTypeParameter/input.ts/es5.2.minified/output.js @@ -1,3 +1,3 @@ -var E, E1; -(E1 = E || (E = { -}))[E1.a = 0] = "a", E1[E1.b = 1] = "b", E1[E1.c = 2] = "c"; +var E, E; +(E = E || (E = { +}))[E.a = 0] = "a", E[E.b = 1] = "b", E[E.c = 2] = "c"; diff --git a/crates/swc/tests/tsc-references/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithOneOperandIsAny/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithOneOperandIsAny/input.ts/es2015.1.normal/output.js index 4afd7694bee..5807403f8ac 100644 --- a/crates/swc/tests/tsc-references/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithOneOperandIsAny/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithOneOperandIsAny/input.ts/es2015.1.normal/output.js @@ -1,9 +1,9 @@ var x; var E; -(function(E1) { - E1[E1["a"] = 0] = "a"; - E1[E1["b"] = 1] = "b"; - E1[E1["c"] = 2] = "c"; +(function(E) { + E[E["a"] = 0] = "a"; + E[E["b"] = 1] = "b"; + E[E["c"] = 2] = "c"; })(E || (E = { })); function foo(t) { diff --git a/crates/swc/tests/tsc-references/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithOneOperandIsAny/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithOneOperandIsAny/input.ts/es2015.2.minified/output.js index 70238e87f03..97698574f44 100644 --- a/crates/swc/tests/tsc-references/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithOneOperandIsAny/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithOneOperandIsAny/input.ts/es2015.2.minified/output.js @@ -1,3 +1,3 @@ -var E, E1; -(E = E1 || (E1 = { +var E, E; +(E = E || (E = { }))[E.a = 0] = "a", E[E.b = 1] = "b", E[E.c = 2] = "c"; diff --git a/crates/swc/tests/tsc-references/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithOneOperandIsAny/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithOneOperandIsAny/input.ts/es5.1.normal/output.js index 4afd7694bee..5807403f8ac 100644 --- a/crates/swc/tests/tsc-references/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithOneOperandIsAny/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithOneOperandIsAny/input.ts/es5.1.normal/output.js @@ -1,9 +1,9 @@ var x; var E; -(function(E1) { - E1[E1["a"] = 0] = "a"; - E1[E1["b"] = 1] = "b"; - E1[E1["c"] = 2] = "c"; +(function(E) { + E[E["a"] = 0] = "a"; + E[E["b"] = 1] = "b"; + E[E["c"] = 2] = "c"; })(E || (E = { })); function foo(t) { diff --git a/crates/swc/tests/tsc-references/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithOneOperandIsAny/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithOneOperandIsAny/input.ts/es5.2.minified/output.js index 70238e87f03..97698574f44 100644 --- a/crates/swc/tests/tsc-references/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithOneOperandIsAny/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithOneOperandIsAny/input.ts/es5.2.minified/output.js @@ -1,3 +1,3 @@ -var E, E1; -(E = E1 || (E1 = { +var E, E; +(E = E || (E = { }))[E.a = 0] = "a", E[E.b = 1] = "b", E[E.c = 2] = "c"; diff --git a/crates/swc/tests/tsc-references/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithOneOperandIsNull/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithOneOperandIsNull/input.ts/es2015.1.normal/output.js index 71bf7c744d8..12b84492e46 100644 --- a/crates/swc/tests/tsc-references/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithOneOperandIsNull/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithOneOperandIsNull/input.ts/es2015.1.normal/output.js @@ -1,8 +1,8 @@ var E; -(function(E1) { - E1[E1["a"] = 0] = "a"; - E1[E1["b"] = 1] = "b"; - E1[E1["c"] = 2] = "c"; +(function(E) { + E[E["a"] = 0] = "a"; + E[E["b"] = 1] = "b"; + E[E["c"] = 2] = "c"; })(E || (E = { })); function foo(t) { diff --git a/crates/swc/tests/tsc-references/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithOneOperandIsNull/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithOneOperandIsNull/input.ts/es2015.2.minified/output.js index 70238e87f03..97698574f44 100644 --- a/crates/swc/tests/tsc-references/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithOneOperandIsNull/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithOneOperandIsNull/input.ts/es2015.2.minified/output.js @@ -1,3 +1,3 @@ -var E, E1; -(E = E1 || (E1 = { +var E, E; +(E = E || (E = { }))[E.a = 0] = "a", E[E.b = 1] = "b", E[E.c = 2] = "c"; diff --git a/crates/swc/tests/tsc-references/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithOneOperandIsNull/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithOneOperandIsNull/input.ts/es5.1.normal/output.js index 71bf7c744d8..12b84492e46 100644 --- a/crates/swc/tests/tsc-references/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithOneOperandIsNull/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithOneOperandIsNull/input.ts/es5.1.normal/output.js @@ -1,8 +1,8 @@ var E; -(function(E1) { - E1[E1["a"] = 0] = "a"; - E1[E1["b"] = 1] = "b"; - E1[E1["c"] = 2] = "c"; +(function(E) { + E[E["a"] = 0] = "a"; + E[E["b"] = 1] = "b"; + E[E["c"] = 2] = "c"; })(E || (E = { })); function foo(t) { diff --git a/crates/swc/tests/tsc-references/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithOneOperandIsNull/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithOneOperandIsNull/input.ts/es5.2.minified/output.js index 70238e87f03..97698574f44 100644 --- a/crates/swc/tests/tsc-references/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithOneOperandIsNull/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithOneOperandIsNull/input.ts/es5.2.minified/output.js @@ -1,3 +1,3 @@ -var E, E1; -(E = E1 || (E1 = { +var E, E; +(E = E || (E = { }))[E.a = 0] = "a", E[E.b = 1] = "b", E[E.c = 2] = "c"; diff --git a/crates/swc/tests/tsc-references/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithOneOperandIsUndefined/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithOneOperandIsUndefined/input.ts/es2015.1.normal/output.js index 4afd7694bee..5807403f8ac 100644 --- a/crates/swc/tests/tsc-references/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithOneOperandIsUndefined/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithOneOperandIsUndefined/input.ts/es2015.1.normal/output.js @@ -1,9 +1,9 @@ var x; var E; -(function(E1) { - E1[E1["a"] = 0] = "a"; - E1[E1["b"] = 1] = "b"; - E1[E1["c"] = 2] = "c"; +(function(E) { + E[E["a"] = 0] = "a"; + E[E["b"] = 1] = "b"; + E[E["c"] = 2] = "c"; })(E || (E = { })); function foo(t) { diff --git a/crates/swc/tests/tsc-references/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithOneOperandIsUndefined/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithOneOperandIsUndefined/input.ts/es2015.2.minified/output.js index 70238e87f03..97698574f44 100644 --- a/crates/swc/tests/tsc-references/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithOneOperandIsUndefined/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithOneOperandIsUndefined/input.ts/es2015.2.minified/output.js @@ -1,3 +1,3 @@ -var E, E1; -(E = E1 || (E1 = { +var E, E; +(E = E || (E = { }))[E.a = 0] = "a", E[E.b = 1] = "b", E[E.c = 2] = "c"; diff --git a/crates/swc/tests/tsc-references/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithOneOperandIsUndefined/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithOneOperandIsUndefined/input.ts/es5.1.normal/output.js index 4afd7694bee..5807403f8ac 100644 --- a/crates/swc/tests/tsc-references/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithOneOperandIsUndefined/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithOneOperandIsUndefined/input.ts/es5.1.normal/output.js @@ -1,9 +1,9 @@ var x; var E; -(function(E1) { - E1[E1["a"] = 0] = "a"; - E1[E1["b"] = 1] = "b"; - E1[E1["c"] = 2] = "c"; +(function(E) { + E[E["a"] = 0] = "a"; + E[E["b"] = 1] = "b"; + E[E["c"] = 2] = "c"; })(E || (E = { })); function foo(t) { diff --git a/crates/swc/tests/tsc-references/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithOneOperandIsUndefined/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithOneOperandIsUndefined/input.ts/es5.2.minified/output.js index 70238e87f03..97698574f44 100644 --- a/crates/swc/tests/tsc-references/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithOneOperandIsUndefined/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithOneOperandIsUndefined/input.ts/es5.2.minified/output.js @@ -1,3 +1,3 @@ -var E, E1; -(E = E1 || (E1 = { +var E, E; +(E = E || (E = { }))[E.a = 0] = "a", E[E.b = 1] = "b", E[E.c = 2] = "c"; diff --git a/crates/swc/tests/tsc-references/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithSubtypeEnumAndNumber/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithSubtypeEnumAndNumber/input.ts/es2015.1.normal/output.js index 9d42bd3fb76..01b110228f9 100644 --- a/crates/swc/tests/tsc-references/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithSubtypeEnumAndNumber/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithSubtypeEnumAndNumber/input.ts/es2015.1.normal/output.js @@ -1,8 +1,8 @@ var E; -(function(E1) { - E1[E1["a"] = 0] = "a"; - E1[E1["b"] = 1] = "b"; - E1[E1["c"] = 2] = "c"; +(function(E) { + E[E["a"] = 0] = "a"; + E[E["b"] = 1] = "b"; + E[E["c"] = 2] = "c"; })(E || (E = { })); var a; diff --git a/crates/swc/tests/tsc-references/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithSubtypeEnumAndNumber/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithSubtypeEnumAndNumber/input.ts/es2015.2.minified/output.js index b6fa50bc92a..506115d6441 100644 --- a/crates/swc/tests/tsc-references/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithSubtypeEnumAndNumber/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithSubtypeEnumAndNumber/input.ts/es2015.2.minified/output.js @@ -1,3 +1,3 @@ -var E, E1, a, b; -(E = E1 || (E1 = { -}))[E.a = 0] = "a", E[E.b = 1] = "b", E[E.c = 2] = "c", a < b, b < a, E1.a < b, b < E1.a, E1.a < 0, 0 < E1.a, E1.a > b, b > E1.a, E1.a > 0, 0 > E1.a, E1.a <= b, b <= E1.a, E1.a <= 0, 0 <= E1.a, E1.a >= b, b >= E1.a, E1.a >= 0, 0 >= E1.a, E1.a == b, b == E1.a, 0 == E1.a, 0 == E1.a, E1.a != b, b != E1.a, 0 != E1.a, 0 != E1.a, E1.a === b, b === E1.a, 0 === E1.a, 0 === E1.a, E1.a !== b, b !== E1.a, 0 !== E1.a, 0 !== E1.a; +var E, E, a, b; +(E = E || (E = { +}))[E.a = 0] = "a", E[E.b = 1] = "b", E[E.c = 2] = "c", a < b, b < a, E.a < b, b < E.a, E.a < 0, 0 < E.a, E.a > b, b > E.a, E.a > 0, 0 > E.a, E.a <= b, b <= E.a, E.a <= 0, 0 <= E.a, E.a >= b, b >= E.a, E.a >= 0, 0 >= E.a, E.a == b, b == E.a, 0 == E.a, 0 == E.a, E.a != b, b != E.a, 0 != E.a, 0 != E.a, E.a === b, b === E.a, 0 === E.a, 0 === E.a, E.a !== b, b !== E.a, 0 !== E.a, 0 !== E.a; diff --git a/crates/swc/tests/tsc-references/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithSubtypeEnumAndNumber/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithSubtypeEnumAndNumber/input.ts/es5.1.normal/output.js index 9d42bd3fb76..01b110228f9 100644 --- a/crates/swc/tests/tsc-references/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithSubtypeEnumAndNumber/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithSubtypeEnumAndNumber/input.ts/es5.1.normal/output.js @@ -1,8 +1,8 @@ var E; -(function(E1) { - E1[E1["a"] = 0] = "a"; - E1[E1["b"] = 1] = "b"; - E1[E1["c"] = 2] = "c"; +(function(E) { + E[E["a"] = 0] = "a"; + E[E["b"] = 1] = "b"; + E[E["c"] = 2] = "c"; })(E || (E = { })); var a; diff --git a/crates/swc/tests/tsc-references/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithSubtypeEnumAndNumber/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithSubtypeEnumAndNumber/input.ts/es5.2.minified/output.js index b6fa50bc92a..506115d6441 100644 --- a/crates/swc/tests/tsc-references/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithSubtypeEnumAndNumber/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithSubtypeEnumAndNumber/input.ts/es5.2.minified/output.js @@ -1,3 +1,3 @@ -var E, E1, a, b; -(E = E1 || (E1 = { -}))[E.a = 0] = "a", E[E.b = 1] = "b", E[E.c = 2] = "c", a < b, b < a, E1.a < b, b < E1.a, E1.a < 0, 0 < E1.a, E1.a > b, b > E1.a, E1.a > 0, 0 > E1.a, E1.a <= b, b <= E1.a, E1.a <= 0, 0 <= E1.a, E1.a >= b, b >= E1.a, E1.a >= 0, 0 >= E1.a, E1.a == b, b == E1.a, 0 == E1.a, 0 == E1.a, E1.a != b, b != E1.a, 0 != E1.a, 0 != E1.a, E1.a === b, b === E1.a, 0 === E1.a, 0 === E1.a, E1.a !== b, b !== E1.a, 0 !== E1.a, 0 !== E1.a; +var E, E, a, b; +(E = E || (E = { +}))[E.a = 0] = "a", E[E.b = 1] = "b", E[E.c = 2] = "c", a < b, b < a, E.a < b, b < E.a, E.a < 0, 0 < E.a, E.a > b, b > E.a, E.a > 0, 0 > E.a, E.a <= b, b <= E.a, E.a <= 0, 0 <= E.a, E.a >= b, b >= E.a, E.a >= 0, 0 >= E.a, E.a == b, b == E.a, 0 == E.a, 0 == E.a, E.a != b, b != E.a, 0 != E.a, 0 != E.a, E.a === b, b === E.a, 0 === E.a, 0 === E.a, E.a !== b, b !== E.a, 0 !== E.a, 0 !== E.a; diff --git a/crates/swc/tests/tsc-references/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands/input.ts/es2015.1.normal/output.js index d6413a5c03a..28cc602b24b 100644 --- a/crates/swc/tests/tsc-references/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands/input.ts/es2015.1.normal/output.js @@ -1,8 +1,8 @@ class Foo { } var E; -(function(E1) { - E1[E1["a"] = 0] = "a"; +(function(E) { + E[E["a"] = 0] = "a"; })(E || (E = { })); var x; diff --git a/crates/swc/tests/tsc-references/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands/input.ts/es2015.2.minified/output.js index e5144b9bfd5..a4ac76a48ee 100644 --- a/crates/swc/tests/tsc-references/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands/input.ts/es2015.2.minified/output.js @@ -1,3 +1,3 @@ -var E, E1, x, a1; -(E = E1 || (E1 = { -}))[E.a = 0] = "a", a1 in x, (void 0) in x, E1.a in x; +var E, E, x, a1; +(E = E || (E = { +}))[E.a = 0] = "a", a1 in x, (void 0) in x, E.a in x; diff --git a/crates/swc/tests/tsc-references/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands/input.ts/es5.1.normal/output.js index abbd9c6fdb1..3bea7d3764a 100644 --- a/crates/swc/tests/tsc-references/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands/input.ts/es5.1.normal/output.js @@ -8,8 +8,8 @@ var Foo = function Foo() { _classCallCheck(this, Foo); }; var E; -(function(E1) { - E1[E1["a"] = 0] = "a"; +(function(E) { + E[E["a"] = 0] = "a"; })(E || (E = { })); var x; diff --git a/crates/swc/tests/tsc-references/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands/input.ts/es5.2.minified/output.js index d76e251cea3..83c89c26886 100644 --- a/crates/swc/tests/tsc-references/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands/input.ts/es5.2.minified/output.js @@ -1,8 +1,8 @@ -var E, x, a1, E1, Foo = function() { +var E, x, a1, E, Foo = function() { "use strict"; !function(instance, Constructor) { if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function"); }(this, Foo); }; -(E1 = E || (E = { -}))[E1.a = 0] = "a", a1 in x, E.a in x; +(E = E || (E = { +}))[E.a = 0] = "a", a1 in x, E.a in x; diff --git a/crates/swc/tests/tsc-references/expressions/contextualTyping/functionExpressionContextualTyping1/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/expressions/contextualTyping/functionExpressionContextualTyping1/input.ts/es2015.1.normal/output.js index d5c685b5d5e..f601315db58 100644 --- a/crates/swc/tests/tsc-references/expressions/contextualTyping/functionExpressionContextualTyping1/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/expressions/contextualTyping/functionExpressionContextualTyping1/input.ts/es2015.1.normal/output.js @@ -1,9 +1,9 @@ var // When a function expression with no type parameters and no parameter type annotations // is contextually typed (section 4.19) by a type T and a contextual signature S can be extracted from T E; -(function(E1) { - E1[E1["red"] = 0] = "red"; - E1[E1["blue"] = 1] = "blue"; +(function(E) { + E[E["red"] = 0] = "red"; + E[E["blue"] = 1] = "blue"; })(E || (E = { })); // A contextual signature S is extracted from a function type T as follows: diff --git a/crates/swc/tests/tsc-references/expressions/contextualTyping/functionExpressionContextualTyping1/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/expressions/contextualTyping/functionExpressionContextualTyping1/input.ts/es2015.2.minified/output.js index aadc5b18e9f..3bc3c48ba9b 100644 --- a/crates/swc/tests/tsc-references/expressions/contextualTyping/functionExpressionContextualTyping1/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/expressions/contextualTyping/functionExpressionContextualTyping1/input.ts/es2015.2.minified/output.js @@ -1,4 +1,4 @@ -var E, E1; -(E = E1 || (E1 = { +var E, E; +(E = E || (E = { }))[E.red = 0] = "red", E[E.blue = 1] = "blue", (num, str)=>(num.toExponential(), 0) ; diff --git a/crates/swc/tests/tsc-references/expressions/contextualTyping/functionExpressionContextualTyping1/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/expressions/contextualTyping/functionExpressionContextualTyping1/input.ts/es5.1.normal/output.js index f6f2768cf32..53a43d47a1d 100644 --- a/crates/swc/tests/tsc-references/expressions/contextualTyping/functionExpressionContextualTyping1/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/expressions/contextualTyping/functionExpressionContextualTyping1/input.ts/es5.1.normal/output.js @@ -20,9 +20,9 @@ function _createClass(Constructor, protoProps, staticProps) { var // When a function expression with no type parameters and no parameter type annotations // is contextually typed (section 4.19) by a type T and a contextual signature S can be extracted from T E; -(function(E1) { - E1[E1["red"] = 0] = "red"; - E1[E1["blue"] = 1] = "blue"; +(function(E) { + E[E["red"] = 0] = "red"; + E[E["blue"] = 1] = "blue"; })(E || (E = { })); // A contextual signature S is extracted from a function type T as follows: diff --git a/crates/swc/tests/tsc-references/expressions/contextualTyping/functionExpressionContextualTyping1/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/expressions/contextualTyping/functionExpressionContextualTyping1/input.ts/es5.2.minified/output.js index 761923985fc..842c8423151 100644 --- a/crates/swc/tests/tsc-references/expressions/contextualTyping/functionExpressionContextualTyping1/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/expressions/contextualTyping/functionExpressionContextualTyping1/input.ts/es5.2.minified/output.js @@ -7,9 +7,9 @@ function _defineProperties(target, props) { descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor); } } -(E = E1 || (E1 = { +(E = E || (E = { }))[E.red = 0] = "red", E[E.blue = 1] = "blue"; -var E, E1, Class = function() { +var E, E, Class = function() { "use strict"; var Constructor, protoProps, staticProps; function Class() { diff --git a/crates/swc/tests/tsc-references/expressions/elementAccess/stringEnumInElementAccess01/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/expressions/elementAccess/stringEnumInElementAccess01/input.ts/es2015.1.normal/output.js index c41edaa3e75..d4d6327d9a0 100644 --- a/crates/swc/tests/tsc-references/expressions/elementAccess/stringEnumInElementAccess01/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/expressions/elementAccess/stringEnumInElementAccess01/input.ts/es2015.1.normal/output.js @@ -1,9 +1,9 @@ var // @noImplicitAny: true E; -(function(E1) { - E1["A"] = "a"; - E1["B"] = "b"; - E1["C"] = "c"; +(function(E) { + E["A"] = "a"; + E["B"] = "b"; + E["C"] = "c"; })(E || (E = { })); const snb = item[e]; diff --git a/crates/swc/tests/tsc-references/expressions/elementAccess/stringEnumInElementAccess01/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/expressions/elementAccess/stringEnumInElementAccess01/input.ts/es2015.2.minified/output.js index 5b69988482a..d254d0d12ea 100644 --- a/crates/swc/tests/tsc-references/expressions/elementAccess/stringEnumInElementAccess01/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/expressions/elementAccess/stringEnumInElementAccess01/input.ts/es2015.2.minified/output.js @@ -1,3 +1,3 @@ -var E, E1; -(E1 = E || (E = { -})).A = "a", E1.B = "b", E1.C = "c", item[e]; +var E, E; +(E = E || (E = { +})).A = "a", E.B = "b", E.C = "c", item[e]; diff --git a/crates/swc/tests/tsc-references/expressions/elementAccess/stringEnumInElementAccess01/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/expressions/elementAccess/stringEnumInElementAccess01/input.ts/es5.1.normal/output.js index ee760876514..84ace534122 100644 --- a/crates/swc/tests/tsc-references/expressions/elementAccess/stringEnumInElementAccess01/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/expressions/elementAccess/stringEnumInElementAccess01/input.ts/es5.1.normal/output.js @@ -1,9 +1,9 @@ var // @noImplicitAny: true E; -(function(E1) { - E1["A"] = "a"; - E1["B"] = "b"; - E1["C"] = "c"; +(function(E) { + E["A"] = "a"; + E["B"] = "b"; + E["C"] = "c"; })(E || (E = { })); var snb = item[e]; diff --git a/crates/swc/tests/tsc-references/expressions/elementAccess/stringEnumInElementAccess01/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/expressions/elementAccess/stringEnumInElementAccess01/input.ts/es5.2.minified/output.js index 5b69988482a..d254d0d12ea 100644 --- a/crates/swc/tests/tsc-references/expressions/elementAccess/stringEnumInElementAccess01/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/expressions/elementAccess/stringEnumInElementAccess01/input.ts/es5.2.minified/output.js @@ -1,3 +1,3 @@ -var E, E1; -(E1 = E || (E = { -})).A = "a", E1.B = "b", E1.C = "c", item[e]; +var E, E; +(E = E || (E = { +})).A = "a", E.B = "b", E.C = "c", item[e]; diff --git a/crates/swc/tests/tsc-references/expressions/functionCalls/typeArgumentInferenceWithObjectLiteral/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/expressions/functionCalls/typeArgumentInferenceWithObjectLiteral/input.ts/es2015.1.normal/output.js index 498d13c8048..78dc7293b0c 100644 --- a/crates/swc/tests/tsc-references/expressions/functionCalls/typeArgumentInferenceWithObjectLiteral/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/expressions/functionCalls/typeArgumentInferenceWithObjectLiteral/input.ts/es2015.1.normal/output.js @@ -13,13 +13,13 @@ foo({ read: ()=>s }); var E1; -(function(E11) { - E11[E11["X"] = 0] = "X"; +(function(E1) { + E1[E1["X"] = 0] = "X"; })(E1 || (E1 = { })); var E2; -(function(E21) { - E21[E21["X"] = 0] = "X"; +(function(E2) { + E2[E2["X"] = 0] = "X"; })(E2 || (E2 = { })); var v1; diff --git a/crates/swc/tests/tsc-references/expressions/functionCalls/typeArgumentInferenceWithObjectLiteral/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/expressions/functionCalls/typeArgumentInferenceWithObjectLiteral/input.ts/es2015.2.minified/output.js index 36f6f3d14f4..caf962c788d 100644 --- a/crates/swc/tests/tsc-references/expressions/functionCalls/typeArgumentInferenceWithObjectLiteral/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/expressions/functionCalls/typeArgumentInferenceWithObjectLiteral/input.ts/es2015.2.minified/output.js @@ -1,4 +1,4 @@ -var E1, E2, s, E11, E21; +var E1, E2, s, E1, E2; function foo(x) { } foo({ @@ -9,8 +9,8 @@ foo({ write: (value)=>s = value , read: ()=>s -}), (E1 = E11 || (E11 = { -}))[E1.X = 0] = "X", (E2 = E21 || (E21 = { +}), (E1 = E1 || (E1 = { +}))[E1.X = 0] = "X", (E2 = E2 || (E2 = { }))[E2.X = 0] = "X", f1({ w: (x)=>x , @@ -19,16 +19,16 @@ foo({ w: (x)=>x , r: ()=>0 -}, E11.X), f1({ +}, E1.X), f1({ w: (x)=>x , - r: ()=>E11.X + r: ()=>E1.X }, 0), f1({ w: (x)=>x , - r: ()=>E11.X -}, E11.X), f1({ + r: ()=>E1.X +}, E1.X), f1({ w: (x)=>x , - r: ()=>E11.X -}, E21.X); + r: ()=>E1.X +}, E2.X); diff --git a/crates/swc/tests/tsc-references/expressions/functionCalls/typeArgumentInferenceWithObjectLiteral/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/expressions/functionCalls/typeArgumentInferenceWithObjectLiteral/input.ts/es5.1.normal/output.js index fd03c3d6c84..e94430d6cf7 100644 --- a/crates/swc/tests/tsc-references/expressions/functionCalls/typeArgumentInferenceWithObjectLiteral/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/expressions/functionCalls/typeArgumentInferenceWithObjectLiteral/input.ts/es5.1.normal/output.js @@ -19,13 +19,13 @@ foo({ } }); var E1; -(function(E11) { - E11[E11["X"] = 0] = "X"; +(function(E1) { + E1[E1["X"] = 0] = "X"; })(E1 || (E1 = { })); var E2; -(function(E21) { - E21[E21["X"] = 0] = "X"; +(function(E2) { + E2[E2["X"] = 0] = "X"; })(E2 || (E2 = { })); var v1; diff --git a/crates/swc/tests/tsc-references/expressions/functionCalls/typeArgumentInferenceWithObjectLiteral/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/expressions/functionCalls/typeArgumentInferenceWithObjectLiteral/input.ts/es5.2.minified/output.js index 4106e742cbe..ab1a105f614 100644 --- a/crates/swc/tests/tsc-references/expressions/functionCalls/typeArgumentInferenceWithObjectLiteral/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/expressions/functionCalls/typeArgumentInferenceWithObjectLiteral/input.ts/es5.2.minified/output.js @@ -1,4 +1,4 @@ -var E1, E2, s, E11, E21; +var E1, E2, s, E1, E2; function foo(x) { } foo({ @@ -15,8 +15,8 @@ foo({ read: function() { return s; } -}), (E1 = E11 || (E11 = { -}))[E1.X = 0] = "X", (E2 = E21 || (E21 = { +}), (E1 = E1 || (E1 = { +}))[E1.X = 0] = "X", (E2 = E2 || (E2 = { }))[E2.X = 0] = "X", f1({ w: function(x) { return x; @@ -31,25 +31,25 @@ foo({ r: function() { return 0; } -}, E11.X), f1({ +}, E1.X), f1({ w: function(x) { return x; }, r: function() { - return E11.X; + return E1.X; } }, 0), f1({ w: function(x) { return x; }, r: function() { - return E11.X; + return E1.X; } -}, E11.X), f1({ +}, E1.X), f1({ w: function(x) { return x; }, r: function() { - return E11.X; + return E1.X; } -}, E21.X); +}, E2.X); diff --git a/crates/swc/tests/tsc-references/expressions/identifiers/scopeResolutionIdentifiers/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/expressions/identifiers/scopeResolutionIdentifiers/input.ts/es2015.1.normal/output.js index 3b4d45ee8c2..6029cd0db9b 100644 --- a/crates/swc/tests/tsc-references/expressions/identifiers/scopeResolutionIdentifiers/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/expressions/identifiers/scopeResolutionIdentifiers/input.ts/es2015.1.normal/output.js @@ -32,7 +32,7 @@ class C { var M3; (function(M3) { var s4; - var M4; + let M4; (function(M4) { var n = s4; var n; diff --git a/crates/swc/tests/tsc-references/expressions/propertyAccess/propertyAccess/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/expressions/propertyAccess/propertyAccess/input.ts/es2015.1.normal/output.js index 91ce0a7d3d7..7176c09d2cc 100644 --- a/crates/swc/tests/tsc-references/expressions/propertyAccess/propertyAccess/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/expressions/propertyAccess/propertyAccess/input.ts/es2015.1.normal/output.js @@ -3,11 +3,11 @@ class A { class B extends A { } var Compass; -(function(Compass1) { - Compass1[Compass1["North"] = 0] = "North"; - Compass1[Compass1["South"] = 1] = "South"; - Compass1[Compass1["East"] = 2] = "East"; - Compass1[Compass1["West"] = 3] = "West"; +(function(Compass) { + Compass[Compass["North"] = 0] = "North"; + Compass[Compass["South"] = 1] = "South"; + Compass[Compass["East"] = 2] = "East"; + Compass[Compass["West"] = 3] = "West"; })(Compass || (Compass = { })); var numIndex = { diff --git a/crates/swc/tests/tsc-references/expressions/propertyAccess/propertyAccess/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/expressions/propertyAccess/propertyAccess/input.ts/es2015.2.minified/output.js index 9f6ab7579f4..b171d0d4e79 100644 --- a/crates/swc/tests/tsc-references/expressions/propertyAccess/propertyAccess/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/expressions/propertyAccess/propertyAccess/input.ts/es2015.2.minified/output.js @@ -1,11 +1,11 @@ -(Compass = Compass1 || (Compass1 = { +(Compass = Compass || (Compass = { }))[Compass.North = 0] = "North", Compass[Compass.South = 1] = "South", Compass[Compass.East = 2] = "East", Compass[Compass.West = 3] = "West"; -var Compass, Compass1, bothIndex, stringOrNumber, someObject, numIndex = { +var Compass, Compass, bothIndex, stringOrNumber, someObject, numIndex = { 3: "three", three: "three" }, strIndex = { - N: Compass1.North, - E: Compass1.East + N: Compass.North, + E: Compass.East }; function noIndex() { } @@ -21,4 +21,4 @@ var obj = { "literal property": 100 }, anyVar = { }; -obj.y = 4, anyVar.x = anyVar.y = obj.x = anyVar.z, obj.x, obj.hasOwnProperty, obj.qqq, obj["literal property"], obj["wa wa wa wa wa"], obj["10"], obj["1"], numIndex[3], numIndex[Compass1.South], numIndex[anyVar], numIndex.what, numIndex[someObject], strIndex.N, strIndex.zzz, strIndex[10], strIndex[Compass1.East], strIndex[null], noIndex[123], noIndex[Compass1.South], noIndex[null], noIndex[someObject], noIndex[32], bothIndex[Compass1.East], bothIndex[null], bothIndex.foo, bothIndex["1.0"], bothIndex[someObject], numIndex[stringOrNumber], strIndex[stringOrNumber], bothIndex[stringOrNumber]; +obj.y = 4, anyVar.x = anyVar.y = obj.x = anyVar.z, obj.x, obj.hasOwnProperty, obj.qqq, obj["literal property"], obj["wa wa wa wa wa"], obj["10"], obj["1"], numIndex[3], numIndex[Compass.South], numIndex[anyVar], numIndex.what, numIndex[someObject], strIndex.N, strIndex.zzz, strIndex[10], strIndex[Compass.East], strIndex[null], noIndex[123], noIndex[Compass.South], noIndex[null], noIndex[someObject], noIndex[32], bothIndex[Compass.East], bothIndex[null], bothIndex.foo, bothIndex["1.0"], bothIndex[someObject], numIndex[stringOrNumber], strIndex[stringOrNumber], bothIndex[stringOrNumber]; diff --git a/crates/swc/tests/tsc-references/expressions/propertyAccess/propertyAccess/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/expressions/propertyAccess/propertyAccess/input.ts/es5.1.normal/output.js index 5e2d7badd5f..e10c2c8f14a 100644 --- a/crates/swc/tests/tsc-references/expressions/propertyAccess/propertyAccess/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/expressions/propertyAccess/propertyAccess/input.ts/es5.1.normal/output.js @@ -84,11 +84,11 @@ var B = /*#__PURE__*/ function(A) { return B; }(A); var Compass; -(function(Compass1) { - Compass1[Compass1["North"] = 0] = "North"; - Compass1[Compass1["South"] = 1] = "South"; - Compass1[Compass1["East"] = 2] = "East"; - Compass1[Compass1["West"] = 3] = "West"; +(function(Compass) { + Compass[Compass["North"] = 0] = "North"; + Compass[Compass["South"] = 1] = "South"; + Compass[Compass["East"] = 2] = "East"; + Compass[Compass["West"] = 3] = "West"; })(Compass || (Compass = { })); var numIndex = { diff --git a/crates/swc/tests/tsc-references/expressions/propertyAccess/propertyAccess/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/expressions/propertyAccess/propertyAccess/input.ts/es5.2.minified/output.js index a745a301d14..2870bbb4eb6 100644 --- a/crates/swc/tests/tsc-references/expressions/propertyAccess/propertyAccess/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/expressions/propertyAccess/propertyAccess/input.ts/es5.2.minified/output.js @@ -11,7 +11,7 @@ function _setPrototypeOf(o, p) { return o.__proto__ = p, o; }, _setPrototypeOf(o, p); } -var Compass, bothIndex, stringOrNumber, someObject, Compass1, A = function() { +var Compass, bothIndex, stringOrNumber, someObject, Compass, A = function() { "use strict"; _classCallCheck(this, A); }, B = function(A1) { @@ -55,8 +55,8 @@ var Compass, bothIndex, stringOrNumber, someObject, Compass1, A = function() { } return B; }(A); -(Compass1 = Compass || (Compass = { -}))[Compass1.North = 0] = "North", Compass1[Compass1.South = 1] = "South", Compass1[Compass1.East = 2] = "East", Compass1[Compass1.West = 3] = "West"; +(Compass = Compass || (Compass = { +}))[Compass.North = 0] = "North", Compass[Compass.South = 1] = "South", Compass[Compass.East = 2] = "East", Compass[Compass.West = 3] = "West"; var numIndex = { 3: "three", three: "three" diff --git a/crates/swc/tests/tsc-references/expressions/typeGuards/TypeGuardWithEnumUnion/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/expressions/typeGuards/TypeGuardWithEnumUnion/input.ts/es2015.1.normal/output.js index e65863078c9..3f70f44d762 100644 --- a/crates/swc/tests/tsc-references/expressions/typeGuards/TypeGuardWithEnumUnion/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/expressions/typeGuards/TypeGuardWithEnumUnion/input.ts/es2015.1.normal/output.js @@ -1,8 +1,8 @@ var Color; -(function(Color1) { - Color1[Color1["R"] = 0] = "R"; - Color1[Color1["G"] = 1] = "G"; - Color1[Color1["B"] = 2] = "B"; +(function(Color) { + Color[Color["R"] = 0] = "R"; + Color[Color["G"] = 1] = "G"; + Color[Color["B"] = 2] = "B"; })(Color || (Color = { })); function f1(x) { diff --git a/crates/swc/tests/tsc-references/expressions/typeGuards/TypeGuardWithEnumUnion/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/expressions/typeGuards/TypeGuardWithEnumUnion/input.ts/es2015.2.minified/output.js index b656b416f0b..519733d4d5f 100644 --- a/crates/swc/tests/tsc-references/expressions/typeGuards/TypeGuardWithEnumUnion/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/expressions/typeGuards/TypeGuardWithEnumUnion/input.ts/es2015.2.minified/output.js @@ -1,3 +1,3 @@ -var Color, Color1; -(Color1 = Color || (Color = { -}))[Color1.R = 0] = "R", Color1[Color1.G = 1] = "G", Color1[Color1.B = 2] = "B"; +var Color, Color; +(Color = Color || (Color = { +}))[Color.R = 0] = "R", Color[Color.G = 1] = "G", Color[Color.B = 2] = "B"; diff --git a/crates/swc/tests/tsc-references/expressions/typeGuards/TypeGuardWithEnumUnion/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/expressions/typeGuards/TypeGuardWithEnumUnion/input.ts/es5.1.normal/output.js index e65863078c9..3f70f44d762 100644 --- a/crates/swc/tests/tsc-references/expressions/typeGuards/TypeGuardWithEnumUnion/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/expressions/typeGuards/TypeGuardWithEnumUnion/input.ts/es5.1.normal/output.js @@ -1,8 +1,8 @@ var Color; -(function(Color1) { - Color1[Color1["R"] = 0] = "R"; - Color1[Color1["G"] = 1] = "G"; - Color1[Color1["B"] = 2] = "B"; +(function(Color) { + Color[Color["R"] = 0] = "R"; + Color[Color["G"] = 1] = "G"; + Color[Color["B"] = 2] = "B"; })(Color || (Color = { })); function f1(x) { diff --git a/crates/swc/tests/tsc-references/expressions/typeGuards/TypeGuardWithEnumUnion/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/expressions/typeGuards/TypeGuardWithEnumUnion/input.ts/es5.2.minified/output.js index b656b416f0b..519733d4d5f 100644 --- a/crates/swc/tests/tsc-references/expressions/typeGuards/TypeGuardWithEnumUnion/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/expressions/typeGuards/TypeGuardWithEnumUnion/input.ts/es5.2.minified/output.js @@ -1,3 +1,3 @@ -var Color, Color1; -(Color1 = Color || (Color = { -}))[Color1.R = 0] = "R", Color1[Color1.G = 1] = "G", Color1[Color1.B = 2] = "B"; +var Color, Color; +(Color = Color || (Color = { +}))[Color.R = 0] = "R", Color[Color.G = 1] = "G", Color[Color.B = 2] = "B"; diff --git a/crates/swc/tests/tsc-references/expressions/typeGuards/typeGuardsInFunctionAndModuleBlock/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/expressions/typeGuards/typeGuardsInFunctionAndModuleBlock/input.ts/es2015.1.normal/output.js index 71290e9fe08..8f6690feeda 100644 --- a/crates/swc/tests/tsc-references/expressions/typeGuards/typeGuardsInFunctionAndModuleBlock/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/expressions/typeGuards/typeGuardsInFunctionAndModuleBlock/input.ts/es2015.1.normal/output.js @@ -39,7 +39,7 @@ function foo5(x) { var m; (function(m) { var x; - var m2; + let m2; (function(m2) { var b = x; // new scope - number | boolean | string var y; diff --git a/crates/swc/tests/tsc-references/expressions/typeGuards/typeGuardsInFunctionAndModuleBlock/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/expressions/typeGuards/typeGuardsInFunctionAndModuleBlock/input.ts/es2015.2.minified/output.js index 54d84e5003f..60254b7d517 100644 --- a/crates/swc/tests/tsc-references/expressions/typeGuards/typeGuardsInFunctionAndModuleBlock/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/expressions/typeGuards/typeGuardsInFunctionAndModuleBlock/input.ts/es2015.2.minified/output.js @@ -1,6 +1,7 @@ var m; !function(m) { - var x, m2; + var x; + let m2; m2 || (m2 = { }), "string" == typeof x || ("boolean" == typeof x, x.toString()); }(m || (m = { diff --git a/crates/swc/tests/tsc-references/expressions/typeGuards/typeGuardsInModule/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/expressions/typeGuards/typeGuardsInModule/input.ts/es2015.1.normal/output.js index 4aa429cd96d..ce9359e61c9 100644 --- a/crates/swc/tests/tsc-references/expressions/typeGuards/typeGuardsInModule/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/expressions/typeGuards/typeGuardsInModule/input.ts/es2015.1.normal/output.js @@ -30,7 +30,7 @@ var m2; (function(m21) { var var2; var var3; - var m31; + let m31; (function(m3) { // global vars in function declaration num = typeof var1 === "string" && var1.length; // string diff --git a/crates/swc/tests/tsc-references/expressions/typeGuards/typeGuardsInModule/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/expressions/typeGuards/typeGuardsInModule/input.ts/es2015.2.minified/output.js index e9ff21dd9c3..377de6a2350 100644 --- a/crates/swc/tests/tsc-references/expressions/typeGuards/typeGuardsInModule/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/expressions/typeGuards/typeGuardsInModule/input.ts/es2015.2.minified/output.js @@ -4,8 +4,9 @@ var num, strOrNum, var1, m1, m2; num = "string" == typeof var1 && var1.length, num = "string" == typeof var2 ? var2.length : var2, "string" == typeof var3, strOrNum = var3, m11.var3 = var3; }(m1 || (m1 = { })), (function(m21) { - var var2, var3, m3, m31, var4, var5; - m31 = m3 || (m3 = { - }), num = "string" == typeof var1 && var1.length, num = "string" == typeof var2 && var2.length, strOrNum = "string" == typeof var3 && var3, num = "string" == typeof var4 ? var4.length : var4, "string" == typeof var5, strOrNum = var5, m31.var5 = var5, m21.var3 = var3; + var var2, var3, m3, var4, var5; + let m31; + m3 = m31 || (m31 = { + }), num = "string" == typeof var1 && var1.length, num = "string" == typeof var2 && var2.length, strOrNum = "string" == typeof var3 && var3, num = "string" == typeof var4 ? var4.length : var4, "string" == typeof var5, strOrNum = var5, m3.var5 = var5, m21.var3 = var3; })(m2 || (m2 = { })); diff --git a/crates/swc/tests/tsc-references/expressions/unaryOperators/bitwiseNotOperator/bitwiseNotOperatorWithEnumType/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/expressions/unaryOperators/bitwiseNotOperator/bitwiseNotOperatorWithEnumType/input.ts/es2015.1.normal/output.js index 29ca96c9727..ad5e6d95bb0 100644 --- a/crates/swc/tests/tsc-references/expressions/unaryOperators/bitwiseNotOperator/bitwiseNotOperatorWithEnumType/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/expressions/unaryOperators/bitwiseNotOperator/bitwiseNotOperatorWithEnumType/input.ts/es2015.1.normal/output.js @@ -1,10 +1,10 @@ var // @allowUnreachableCode: true // ~ operator on enum type ENUM1; -(function(ENUM11) { - ENUM11[ENUM11["A"] = 0] = "A"; - ENUM11[ENUM11["B"] = 1] = "B"; - ENUM11[ENUM11[""] = 2] = ""; +(function(ENUM1) { + ENUM1[ENUM1["A"] = 0] = "A"; + ENUM1[ENUM1["B"] = 1] = "B"; + ENUM1[ENUM1[""] = 2] = ""; })(ENUM1 || (ENUM1 = { })); // enum type var diff --git a/crates/swc/tests/tsc-references/expressions/unaryOperators/bitwiseNotOperator/bitwiseNotOperatorWithEnumType/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/expressions/unaryOperators/bitwiseNotOperator/bitwiseNotOperatorWithEnumType/input.ts/es2015.2.minified/output.js index d9d1855db2f..ac940c04281 100644 --- a/crates/swc/tests/tsc-references/expressions/unaryOperators/bitwiseNotOperator/bitwiseNotOperatorWithEnumType/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/expressions/unaryOperators/bitwiseNotOperator/bitwiseNotOperatorWithEnumType/input.ts/es2015.2.minified/output.js @@ -1,3 +1,3 @@ -var ENUM1, ENUM11; -(ENUM11 = ENUM1 || (ENUM1 = { -}))[ENUM11.A = 0] = "A", ENUM11[ENUM11.B = 1] = "B", ENUM11[ENUM11[""] = 2] = "", ENUM1.A, ENUM1.A + ENUM1.B, ENUM1.A + ENUM1.B, ENUM1.A, ENUM1.A, ENUM1.B; +var ENUM1, ENUM1; +(ENUM1 = ENUM1 || (ENUM1 = { +}))[ENUM1.A = 0] = "A", ENUM1[ENUM1.B = 1] = "B", ENUM1[ENUM1[""] = 2] = "", ENUM1.A, ENUM1.A + ENUM1.B, ENUM1.A + ENUM1.B, ENUM1.A, ENUM1.A, ENUM1.B; diff --git a/crates/swc/tests/tsc-references/expressions/unaryOperators/bitwiseNotOperator/bitwiseNotOperatorWithEnumType/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/expressions/unaryOperators/bitwiseNotOperator/bitwiseNotOperatorWithEnumType/input.ts/es5.1.normal/output.js index 29ca96c9727..ad5e6d95bb0 100644 --- a/crates/swc/tests/tsc-references/expressions/unaryOperators/bitwiseNotOperator/bitwiseNotOperatorWithEnumType/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/expressions/unaryOperators/bitwiseNotOperator/bitwiseNotOperatorWithEnumType/input.ts/es5.1.normal/output.js @@ -1,10 +1,10 @@ var // @allowUnreachableCode: true // ~ operator on enum type ENUM1; -(function(ENUM11) { - ENUM11[ENUM11["A"] = 0] = "A"; - ENUM11[ENUM11["B"] = 1] = "B"; - ENUM11[ENUM11[""] = 2] = ""; +(function(ENUM1) { + ENUM1[ENUM1["A"] = 0] = "A"; + ENUM1[ENUM1["B"] = 1] = "B"; + ENUM1[ENUM1[""] = 2] = ""; })(ENUM1 || (ENUM1 = { })); // enum type var diff --git a/crates/swc/tests/tsc-references/expressions/unaryOperators/bitwiseNotOperator/bitwiseNotOperatorWithEnumType/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/expressions/unaryOperators/bitwiseNotOperator/bitwiseNotOperatorWithEnumType/input.ts/es5.2.minified/output.js index d9d1855db2f..ac940c04281 100644 --- a/crates/swc/tests/tsc-references/expressions/unaryOperators/bitwiseNotOperator/bitwiseNotOperatorWithEnumType/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/expressions/unaryOperators/bitwiseNotOperator/bitwiseNotOperatorWithEnumType/input.ts/es5.2.minified/output.js @@ -1,3 +1,3 @@ -var ENUM1, ENUM11; -(ENUM11 = ENUM1 || (ENUM1 = { -}))[ENUM11.A = 0] = "A", ENUM11[ENUM11.B = 1] = "B", ENUM11[ENUM11[""] = 2] = "", ENUM1.A, ENUM1.A + ENUM1.B, ENUM1.A + ENUM1.B, ENUM1.A, ENUM1.A, ENUM1.B; +var ENUM1, ENUM1; +(ENUM1 = ENUM1 || (ENUM1 = { +}))[ENUM1.A = 0] = "A", ENUM1[ENUM1.B = 1] = "B", ENUM1[ENUM1[""] = 2] = "", ENUM1.A, ENUM1.A + ENUM1.B, ENUM1.A + ENUM1.B, ENUM1.A, ENUM1.A, ENUM1.B; diff --git a/crates/swc/tests/tsc-references/expressions/unaryOperators/decrementOperator/decrementOperatorWithEnumType/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/expressions/unaryOperators/decrementOperator/decrementOperatorWithEnumType/input.ts/es2015.1.normal/output.js index c076c601bc2..f7b417042a0 100644 --- a/crates/swc/tests/tsc-references/expressions/unaryOperators/decrementOperator/decrementOperatorWithEnumType/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/expressions/unaryOperators/decrementOperator/decrementOperatorWithEnumType/input.ts/es2015.1.normal/output.js @@ -1,9 +1,9 @@ var // -- operator on enum type ENUM1; -(function(ENUM11) { - ENUM11[ENUM11["A"] = 0] = "A"; - ENUM11[ENUM11["B"] = 1] = "B"; - ENUM11[ENUM11[""] = 2] = ""; +(function(ENUM1) { + ENUM1[ENUM1["A"] = 0] = "A"; + ENUM1[ENUM1["B"] = 1] = "B"; + ENUM1[ENUM1[""] = 2] = ""; })(ENUM1 || (ENUM1 = { })); // expression diff --git a/crates/swc/tests/tsc-references/expressions/unaryOperators/decrementOperator/decrementOperatorWithEnumType/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/expressions/unaryOperators/decrementOperator/decrementOperatorWithEnumType/input.ts/es2015.2.minified/output.js index efd75102cdd..08120e8acc4 100644 --- a/crates/swc/tests/tsc-references/expressions/unaryOperators/decrementOperator/decrementOperatorWithEnumType/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/expressions/unaryOperators/decrementOperator/decrementOperatorWithEnumType/input.ts/es2015.2.minified/output.js @@ -1,3 +1,3 @@ -var ENUM1, ENUM11; -(ENUM11 = ENUM1 || (ENUM1 = { -}))[ENUM11.A = 0] = "A", ENUM11[ENUM11.B = 1] = "B", ENUM11[ENUM11[""] = 2] = "", --ENUM1.A, ENUM1.A--, --ENUM1.A, ENUM1[A]--; +var ENUM1, ENUM1; +(ENUM1 = ENUM1 || (ENUM1 = { +}))[ENUM1.A = 0] = "A", ENUM1[ENUM1.B = 1] = "B", ENUM1[ENUM1[""] = 2] = "", --ENUM1.A, ENUM1.A--, --ENUM1.A, ENUM1[A]--; diff --git a/crates/swc/tests/tsc-references/expressions/unaryOperators/decrementOperator/decrementOperatorWithEnumType/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/expressions/unaryOperators/decrementOperator/decrementOperatorWithEnumType/input.ts/es5.1.normal/output.js index c076c601bc2..f7b417042a0 100644 --- a/crates/swc/tests/tsc-references/expressions/unaryOperators/decrementOperator/decrementOperatorWithEnumType/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/expressions/unaryOperators/decrementOperator/decrementOperatorWithEnumType/input.ts/es5.1.normal/output.js @@ -1,9 +1,9 @@ var // -- operator on enum type ENUM1; -(function(ENUM11) { - ENUM11[ENUM11["A"] = 0] = "A"; - ENUM11[ENUM11["B"] = 1] = "B"; - ENUM11[ENUM11[""] = 2] = ""; +(function(ENUM1) { + ENUM1[ENUM1["A"] = 0] = "A"; + ENUM1[ENUM1["B"] = 1] = "B"; + ENUM1[ENUM1[""] = 2] = ""; })(ENUM1 || (ENUM1 = { })); // expression diff --git a/crates/swc/tests/tsc-references/expressions/unaryOperators/decrementOperator/decrementOperatorWithEnumType/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/expressions/unaryOperators/decrementOperator/decrementOperatorWithEnumType/input.ts/es5.2.minified/output.js index efd75102cdd..08120e8acc4 100644 --- a/crates/swc/tests/tsc-references/expressions/unaryOperators/decrementOperator/decrementOperatorWithEnumType/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/expressions/unaryOperators/decrementOperator/decrementOperatorWithEnumType/input.ts/es5.2.minified/output.js @@ -1,3 +1,3 @@ -var ENUM1, ENUM11; -(ENUM11 = ENUM1 || (ENUM1 = { -}))[ENUM11.A = 0] = "A", ENUM11[ENUM11.B = 1] = "B", ENUM11[ENUM11[""] = 2] = "", --ENUM1.A, ENUM1.A--, --ENUM1.A, ENUM1[A]--; +var ENUM1, ENUM1; +(ENUM1 = ENUM1 || (ENUM1 = { +}))[ENUM1.A = 0] = "A", ENUM1[ENUM1.B = 1] = "B", ENUM1[ENUM1[""] = 2] = "", --ENUM1.A, ENUM1.A--, --ENUM1.A, ENUM1[A]--; diff --git a/crates/swc/tests/tsc-references/expressions/unaryOperators/decrementOperator/decrementOperatorWithEnumTypeInvalidOperations/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/expressions/unaryOperators/decrementOperator/decrementOperatorWithEnumTypeInvalidOperations/input.ts/es2015.1.normal/output.js index 600804d8617..615594dd7f4 100644 --- a/crates/swc/tests/tsc-references/expressions/unaryOperators/decrementOperator/decrementOperatorWithEnumTypeInvalidOperations/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/expressions/unaryOperators/decrementOperator/decrementOperatorWithEnumTypeInvalidOperations/input.ts/es2015.1.normal/output.js @@ -4,10 +4,10 @@ ENUM; })(ENUM || (ENUM = { })); var ENUM1; -(function(ENUM11) { - ENUM11[ENUM11["A"] = 0] = "A"; - ENUM11[ENUM11["B"] = 1] = "B"; - ENUM11[ENUM11[""] = 2] = ""; +(function(ENUM1) { + ENUM1[ENUM1["A"] = 0] = "A"; + ENUM1[ENUM1["B"] = 1] = "B"; + ENUM1[ENUM1[""] = 2] = ""; })(ENUM1 || (ENUM1 = { })); // enum type var diff --git a/crates/swc/tests/tsc-references/expressions/unaryOperators/decrementOperator/decrementOperatorWithEnumTypeInvalidOperations/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/expressions/unaryOperators/decrementOperator/decrementOperatorWithEnumTypeInvalidOperations/input.ts/es2015.2.minified/output.js index edf05e171ff..1055a5b87ce 100644 --- a/crates/swc/tests/tsc-references/expressions/unaryOperators/decrementOperator/decrementOperatorWithEnumTypeInvalidOperations/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/expressions/unaryOperators/decrementOperator/decrementOperatorWithEnumTypeInvalidOperations/input.ts/es2015.2.minified/output.js @@ -1,3 +1,3 @@ -var ENUM1, ENUM, ENUM11; -(ENUM1 = ENUM11 || (ENUM11 = { -}))[ENUM1.A = 0] = "A", ENUM1[ENUM1.B = 1] = "B", ENUM1[ENUM1[""] = 2] = "", --ENUM, --ENUM11, ENUM--, ENUM11--, --ENUM.A + ENUM.B, ENUM.A + ENUM.B--, --ENUM, --ENUM11, ENUM--, ENUM11--; +var ENUM1, ENUM, ENUM1; +(ENUM1 = ENUM1 || (ENUM1 = { +}))[ENUM1.A = 0] = "A", ENUM1[ENUM1.B = 1] = "B", ENUM1[ENUM1[""] = 2] = "", --ENUM, --ENUM1, ENUM--, ENUM1--, --ENUM.A + ENUM.B, ENUM.A + ENUM.B--, --ENUM, --ENUM1, ENUM--, ENUM1--; diff --git a/crates/swc/tests/tsc-references/expressions/unaryOperators/decrementOperator/decrementOperatorWithEnumTypeInvalidOperations/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/expressions/unaryOperators/decrementOperator/decrementOperatorWithEnumTypeInvalidOperations/input.ts/es5.1.normal/output.js index 600804d8617..615594dd7f4 100644 --- a/crates/swc/tests/tsc-references/expressions/unaryOperators/decrementOperator/decrementOperatorWithEnumTypeInvalidOperations/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/expressions/unaryOperators/decrementOperator/decrementOperatorWithEnumTypeInvalidOperations/input.ts/es5.1.normal/output.js @@ -4,10 +4,10 @@ ENUM; })(ENUM || (ENUM = { })); var ENUM1; -(function(ENUM11) { - ENUM11[ENUM11["A"] = 0] = "A"; - ENUM11[ENUM11["B"] = 1] = "B"; - ENUM11[ENUM11[""] = 2] = ""; +(function(ENUM1) { + ENUM1[ENUM1["A"] = 0] = "A"; + ENUM1[ENUM1["B"] = 1] = "B"; + ENUM1[ENUM1[""] = 2] = ""; })(ENUM1 || (ENUM1 = { })); // enum type var diff --git a/crates/swc/tests/tsc-references/expressions/unaryOperators/decrementOperator/decrementOperatorWithEnumTypeInvalidOperations/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/expressions/unaryOperators/decrementOperator/decrementOperatorWithEnumTypeInvalidOperations/input.ts/es5.2.minified/output.js index edf05e171ff..1055a5b87ce 100644 --- a/crates/swc/tests/tsc-references/expressions/unaryOperators/decrementOperator/decrementOperatorWithEnumTypeInvalidOperations/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/expressions/unaryOperators/decrementOperator/decrementOperatorWithEnumTypeInvalidOperations/input.ts/es5.2.minified/output.js @@ -1,3 +1,3 @@ -var ENUM1, ENUM, ENUM11; -(ENUM1 = ENUM11 || (ENUM11 = { -}))[ENUM1.A = 0] = "A", ENUM1[ENUM1.B = 1] = "B", ENUM1[ENUM1[""] = 2] = "", --ENUM, --ENUM11, ENUM--, ENUM11--, --ENUM.A + ENUM.B, ENUM.A + ENUM.B--, --ENUM, --ENUM11, ENUM--, ENUM11--; +var ENUM1, ENUM, ENUM1; +(ENUM1 = ENUM1 || (ENUM1 = { +}))[ENUM1.A = 0] = "A", ENUM1[ENUM1.B = 1] = "B", ENUM1[ENUM1[""] = 2] = "", --ENUM, --ENUM1, ENUM--, ENUM1--, --ENUM.A + ENUM.B, ENUM.A + ENUM.B--, --ENUM, --ENUM1, ENUM--, ENUM1--; diff --git a/crates/swc/tests/tsc-references/expressions/unaryOperators/incrementOperator/incrementOperatorWithEnumType/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/expressions/unaryOperators/incrementOperator/incrementOperatorWithEnumType/input.ts/es2015.1.normal/output.js index f42a407fbe4..07292be8f32 100644 --- a/crates/swc/tests/tsc-references/expressions/unaryOperators/incrementOperator/incrementOperatorWithEnumType/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/expressions/unaryOperators/incrementOperator/incrementOperatorWithEnumType/input.ts/es2015.1.normal/output.js @@ -1,9 +1,9 @@ var // ++ operator on enum type ENUM1; -(function(ENUM11) { - ENUM11[ENUM11["A"] = 0] = "A"; - ENUM11[ENUM11["B"] = 1] = "B"; - ENUM11[ENUM11[""] = 2] = ""; +(function(ENUM1) { + ENUM1[ENUM1["A"] = 0] = "A"; + ENUM1[ENUM1["B"] = 1] = "B"; + ENUM1[ENUM1[""] = 2] = ""; })(ENUM1 || (ENUM1 = { })); // expression diff --git a/crates/swc/tests/tsc-references/expressions/unaryOperators/incrementOperator/incrementOperatorWithEnumType/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/expressions/unaryOperators/incrementOperator/incrementOperatorWithEnumType/input.ts/es2015.2.minified/output.js index 6116264c7fe..78b45bb31fb 100644 --- a/crates/swc/tests/tsc-references/expressions/unaryOperators/incrementOperator/incrementOperatorWithEnumType/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/expressions/unaryOperators/incrementOperator/incrementOperatorWithEnumType/input.ts/es2015.2.minified/output.js @@ -1,3 +1,3 @@ -var ENUM1, ENUM11; -(ENUM11 = ENUM1 || (ENUM1 = { -}))[ENUM11.A = 0] = "A", ENUM11[ENUM11.B = 1] = "B", ENUM11[ENUM11[""] = 2] = "", ++ENUM1.B, ENUM1.B++, ++ENUM1.B, ENUM1.B++; +var ENUM1, ENUM1; +(ENUM1 = ENUM1 || (ENUM1 = { +}))[ENUM1.A = 0] = "A", ENUM1[ENUM1.B = 1] = "B", ENUM1[ENUM1[""] = 2] = "", ++ENUM1.B, ENUM1.B++, ++ENUM1.B, ENUM1.B++; diff --git a/crates/swc/tests/tsc-references/expressions/unaryOperators/incrementOperator/incrementOperatorWithEnumType/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/expressions/unaryOperators/incrementOperator/incrementOperatorWithEnumType/input.ts/es5.1.normal/output.js index f42a407fbe4..07292be8f32 100644 --- a/crates/swc/tests/tsc-references/expressions/unaryOperators/incrementOperator/incrementOperatorWithEnumType/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/expressions/unaryOperators/incrementOperator/incrementOperatorWithEnumType/input.ts/es5.1.normal/output.js @@ -1,9 +1,9 @@ var // ++ operator on enum type ENUM1; -(function(ENUM11) { - ENUM11[ENUM11["A"] = 0] = "A"; - ENUM11[ENUM11["B"] = 1] = "B"; - ENUM11[ENUM11[""] = 2] = ""; +(function(ENUM1) { + ENUM1[ENUM1["A"] = 0] = "A"; + ENUM1[ENUM1["B"] = 1] = "B"; + ENUM1[ENUM1[""] = 2] = ""; })(ENUM1 || (ENUM1 = { })); // expression diff --git a/crates/swc/tests/tsc-references/expressions/unaryOperators/incrementOperator/incrementOperatorWithEnumType/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/expressions/unaryOperators/incrementOperator/incrementOperatorWithEnumType/input.ts/es5.2.minified/output.js index 6116264c7fe..78b45bb31fb 100644 --- a/crates/swc/tests/tsc-references/expressions/unaryOperators/incrementOperator/incrementOperatorWithEnumType/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/expressions/unaryOperators/incrementOperator/incrementOperatorWithEnumType/input.ts/es5.2.minified/output.js @@ -1,3 +1,3 @@ -var ENUM1, ENUM11; -(ENUM11 = ENUM1 || (ENUM1 = { -}))[ENUM11.A = 0] = "A", ENUM11[ENUM11.B = 1] = "B", ENUM11[ENUM11[""] = 2] = "", ++ENUM1.B, ENUM1.B++, ++ENUM1.B, ENUM1.B++; +var ENUM1, ENUM1; +(ENUM1 = ENUM1 || (ENUM1 = { +}))[ENUM1.A = 0] = "A", ENUM1[ENUM1.B = 1] = "B", ENUM1[ENUM1[""] = 2] = "", ++ENUM1.B, ENUM1.B++, ++ENUM1.B, ENUM1.B++; diff --git a/crates/swc/tests/tsc-references/expressions/unaryOperators/incrementOperator/incrementOperatorWithEnumTypeInvalidOperations/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/expressions/unaryOperators/incrementOperator/incrementOperatorWithEnumTypeInvalidOperations/input.ts/es2015.1.normal/output.js index 8cd62df0e06..31b35341f90 100644 --- a/crates/swc/tests/tsc-references/expressions/unaryOperators/incrementOperator/incrementOperatorWithEnumTypeInvalidOperations/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/expressions/unaryOperators/incrementOperator/incrementOperatorWithEnumTypeInvalidOperations/input.ts/es2015.1.normal/output.js @@ -4,10 +4,10 @@ ENUM; })(ENUM || (ENUM = { })); var ENUM1; -(function(ENUM11) { - ENUM11[ENUM11["A"] = 0] = "A"; - ENUM11[ENUM11["B"] = 1] = "B"; - ENUM11[ENUM11[""] = 2] = ""; +(function(ENUM1) { + ENUM1[ENUM1["A"] = 0] = "A"; + ENUM1[ENUM1["B"] = 1] = "B"; + ENUM1[ENUM1[""] = 2] = ""; })(ENUM1 || (ENUM1 = { })); // enum type var diff --git a/crates/swc/tests/tsc-references/expressions/unaryOperators/incrementOperator/incrementOperatorWithEnumTypeInvalidOperations/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/expressions/unaryOperators/incrementOperator/incrementOperatorWithEnumTypeInvalidOperations/input.ts/es2015.2.minified/output.js index afa44ef0944..11fe3a8a9b9 100644 --- a/crates/swc/tests/tsc-references/expressions/unaryOperators/incrementOperator/incrementOperatorWithEnumTypeInvalidOperations/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/expressions/unaryOperators/incrementOperator/incrementOperatorWithEnumTypeInvalidOperations/input.ts/es2015.2.minified/output.js @@ -1,3 +1,3 @@ -var ENUM1, ENUM, ENUM11; -(ENUM1 = ENUM11 || (ENUM11 = { -}))[ENUM1.A = 0] = "A", ENUM1[ENUM1.B = 1] = "B", ENUM1[ENUM1[""] = 2] = "", ++ENUM, ++ENUM11, ENUM++, ENUM11++, ++ENUM[1] + ENUM[2], ENUM[1] + ENUM[2]++, ++ENUM, ++ENUM11, ENUM++, ENUM11++; +var ENUM1, ENUM, ENUM1; +(ENUM1 = ENUM1 || (ENUM1 = { +}))[ENUM1.A = 0] = "A", ENUM1[ENUM1.B = 1] = "B", ENUM1[ENUM1[""] = 2] = "", ++ENUM, ++ENUM1, ENUM++, ENUM1++, ++ENUM[1] + ENUM[2], ENUM[1] + ENUM[2]++, ++ENUM, ++ENUM1, ENUM++, ENUM1++; diff --git a/crates/swc/tests/tsc-references/expressions/unaryOperators/incrementOperator/incrementOperatorWithEnumTypeInvalidOperations/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/expressions/unaryOperators/incrementOperator/incrementOperatorWithEnumTypeInvalidOperations/input.ts/es5.1.normal/output.js index 8cd62df0e06..31b35341f90 100644 --- a/crates/swc/tests/tsc-references/expressions/unaryOperators/incrementOperator/incrementOperatorWithEnumTypeInvalidOperations/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/expressions/unaryOperators/incrementOperator/incrementOperatorWithEnumTypeInvalidOperations/input.ts/es5.1.normal/output.js @@ -4,10 +4,10 @@ ENUM; })(ENUM || (ENUM = { })); var ENUM1; -(function(ENUM11) { - ENUM11[ENUM11["A"] = 0] = "A"; - ENUM11[ENUM11["B"] = 1] = "B"; - ENUM11[ENUM11[""] = 2] = ""; +(function(ENUM1) { + ENUM1[ENUM1["A"] = 0] = "A"; + ENUM1[ENUM1["B"] = 1] = "B"; + ENUM1[ENUM1[""] = 2] = ""; })(ENUM1 || (ENUM1 = { })); // enum type var diff --git a/crates/swc/tests/tsc-references/expressions/unaryOperators/incrementOperator/incrementOperatorWithEnumTypeInvalidOperations/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/expressions/unaryOperators/incrementOperator/incrementOperatorWithEnumTypeInvalidOperations/input.ts/es5.2.minified/output.js index afa44ef0944..11fe3a8a9b9 100644 --- a/crates/swc/tests/tsc-references/expressions/unaryOperators/incrementOperator/incrementOperatorWithEnumTypeInvalidOperations/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/expressions/unaryOperators/incrementOperator/incrementOperatorWithEnumTypeInvalidOperations/input.ts/es5.2.minified/output.js @@ -1,3 +1,3 @@ -var ENUM1, ENUM, ENUM11; -(ENUM1 = ENUM11 || (ENUM11 = { -}))[ENUM1.A = 0] = "A", ENUM1[ENUM1.B = 1] = "B", ENUM1[ENUM1[""] = 2] = "", ++ENUM, ++ENUM11, ENUM++, ENUM11++, ++ENUM[1] + ENUM[2], ENUM[1] + ENUM[2]++, ++ENUM, ++ENUM11, ENUM++, ENUM11++; +var ENUM1, ENUM, ENUM1; +(ENUM1 = ENUM1 || (ENUM1 = { +}))[ENUM1.A = 0] = "A", ENUM1[ENUM1.B = 1] = "B", ENUM1[ENUM1[""] = 2] = "", ++ENUM, ++ENUM1, ENUM++, ENUM1++, ++ENUM[1] + ENUM[2], ENUM[1] + ENUM[2]++, ++ENUM, ++ENUM1, ENUM++, ENUM1++; diff --git a/crates/swc/tests/tsc-references/expressions/unaryOperators/logicalNotOperator/logicalNotOperatorWithEnumType/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/expressions/unaryOperators/logicalNotOperator/logicalNotOperatorWithEnumType/input.ts/es2015.1.normal/output.js index 4df3b4d929d..a0720e3bcb1 100644 --- a/crates/swc/tests/tsc-references/expressions/unaryOperators/logicalNotOperator/logicalNotOperatorWithEnumType/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/expressions/unaryOperators/logicalNotOperator/logicalNotOperatorWithEnumType/input.ts/es2015.1.normal/output.js @@ -1,9 +1,9 @@ var // ! operator on enum type ENUM; -(function(ENUM2) { - ENUM2[ENUM2["A"] = 0] = "A"; - ENUM2[ENUM2["B"] = 1] = "B"; - ENUM2[ENUM2["C"] = 2] = "C"; +(function(ENUM) { + ENUM[ENUM["A"] = 0] = "A"; + ENUM[ENUM["B"] = 1] = "B"; + ENUM[ENUM["C"] = 2] = "C"; })(ENUM || (ENUM = { })); var ENUM1; diff --git a/crates/swc/tests/tsc-references/expressions/unaryOperators/logicalNotOperator/logicalNotOperatorWithEnumType/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/expressions/unaryOperators/logicalNotOperator/logicalNotOperatorWithEnumType/input.ts/es2015.2.minified/output.js index 7dedaa6ff74..b742cfac511 100644 --- a/crates/swc/tests/tsc-references/expressions/unaryOperators/logicalNotOperator/logicalNotOperatorWithEnumType/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/expressions/unaryOperators/logicalNotOperator/logicalNotOperatorWithEnumType/input.ts/es2015.2.minified/output.js @@ -1,3 +1,3 @@ -var ENUM, ENUM1; -(ENUM = ENUM1 || (ENUM1 = { -}))[ENUM.A = 0] = "A", ENUM[ENUM.B = 1] = "B", ENUM[ENUM.C = 2] = "C", ENUM1.B + ENUM1.C, ENUM1.B + ENUM1.C; +var ENUM, ENUM; +(ENUM = ENUM || (ENUM = { +}))[ENUM.A = 0] = "A", ENUM[ENUM.B = 1] = "B", ENUM[ENUM.C = 2] = "C", ENUM.B, ENUM.B + ENUM.C, ENUM.B + ENUM.C, ENUM.B; diff --git a/crates/swc/tests/tsc-references/expressions/unaryOperators/logicalNotOperator/logicalNotOperatorWithEnumType/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/expressions/unaryOperators/logicalNotOperator/logicalNotOperatorWithEnumType/input.ts/es5.1.normal/output.js index 4df3b4d929d..a0720e3bcb1 100644 --- a/crates/swc/tests/tsc-references/expressions/unaryOperators/logicalNotOperator/logicalNotOperatorWithEnumType/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/expressions/unaryOperators/logicalNotOperator/logicalNotOperatorWithEnumType/input.ts/es5.1.normal/output.js @@ -1,9 +1,9 @@ var // ! operator on enum type ENUM; -(function(ENUM2) { - ENUM2[ENUM2["A"] = 0] = "A"; - ENUM2[ENUM2["B"] = 1] = "B"; - ENUM2[ENUM2["C"] = 2] = "C"; +(function(ENUM) { + ENUM[ENUM["A"] = 0] = "A"; + ENUM[ENUM["B"] = 1] = "B"; + ENUM[ENUM["C"] = 2] = "C"; })(ENUM || (ENUM = { })); var ENUM1; diff --git a/crates/swc/tests/tsc-references/expressions/unaryOperators/logicalNotOperator/logicalNotOperatorWithEnumType/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/expressions/unaryOperators/logicalNotOperator/logicalNotOperatorWithEnumType/input.ts/es5.2.minified/output.js index 7dedaa6ff74..b742cfac511 100644 --- a/crates/swc/tests/tsc-references/expressions/unaryOperators/logicalNotOperator/logicalNotOperatorWithEnumType/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/expressions/unaryOperators/logicalNotOperator/logicalNotOperatorWithEnumType/input.ts/es5.2.minified/output.js @@ -1,3 +1,3 @@ -var ENUM, ENUM1; -(ENUM = ENUM1 || (ENUM1 = { -}))[ENUM.A = 0] = "A", ENUM[ENUM.B = 1] = "B", ENUM[ENUM.C = 2] = "C", ENUM1.B + ENUM1.C, ENUM1.B + ENUM1.C; +var ENUM, ENUM; +(ENUM = ENUM || (ENUM = { +}))[ENUM.A = 0] = "A", ENUM[ENUM.B = 1] = "B", ENUM[ENUM.C = 2] = "C", ENUM.B, ENUM.B + ENUM.C, ENUM.B + ENUM.C, ENUM.B; diff --git a/crates/swc/tests/tsc-references/expressions/unaryOperators/negateOperator/negateOperatorWithEnumType/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/expressions/unaryOperators/negateOperator/negateOperatorWithEnumType/input.ts/es2015.1.normal/output.js index a1d7da6bc3a..9c045bb61f2 100644 --- a/crates/swc/tests/tsc-references/expressions/unaryOperators/negateOperator/negateOperatorWithEnumType/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/expressions/unaryOperators/negateOperator/negateOperatorWithEnumType/input.ts/es2015.1.normal/output.js @@ -4,10 +4,10 @@ ENUM; })(ENUM || (ENUM = { })); var ENUM1; -(function(ENUM11) { - ENUM11[ENUM11["A"] = 0] = "A"; - ENUM11[ENUM11["B"] = 1] = "B"; - ENUM11[ENUM11[""] = 2] = ""; +(function(ENUM1) { + ENUM1[ENUM1["A"] = 0] = "A"; + ENUM1[ENUM1["B"] = 1] = "B"; + ENUM1[ENUM1[""] = 2] = ""; })(ENUM1 || (ENUM1 = { })); // enum type var diff --git a/crates/swc/tests/tsc-references/expressions/unaryOperators/negateOperator/negateOperatorWithEnumType/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/expressions/unaryOperators/negateOperator/negateOperatorWithEnumType/input.ts/es2015.2.minified/output.js index 3ae6eee9162..75c3bfb4e56 100644 --- a/crates/swc/tests/tsc-references/expressions/unaryOperators/negateOperator/negateOperatorWithEnumType/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/expressions/unaryOperators/negateOperator/negateOperatorWithEnumType/input.ts/es2015.2.minified/output.js @@ -1,3 +1,3 @@ -var ENUM1, ENUM11; -(ENUM1 = ENUM11 || (ENUM11 = { -}))[ENUM1.A = 0] = "A", ENUM1[ENUM1.B = 1] = "B", ENUM1[ENUM1[""] = 2] = "", ENUM11.B, ENUM11.B + ENUM11[""], ENUM11.B; +var ENUM1, ENUM1; +(ENUM1 = ENUM1 || (ENUM1 = { +}))[ENUM1.A = 0] = "A", ENUM1[ENUM1.B = 1] = "B", ENUM1[ENUM1[""] = 2] = "", ENUM1.B, ENUM1.B + ENUM1[""], ENUM1.B; diff --git a/crates/swc/tests/tsc-references/expressions/unaryOperators/negateOperator/negateOperatorWithEnumType/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/expressions/unaryOperators/negateOperator/negateOperatorWithEnumType/input.ts/es5.1.normal/output.js index a1d7da6bc3a..9c045bb61f2 100644 --- a/crates/swc/tests/tsc-references/expressions/unaryOperators/negateOperator/negateOperatorWithEnumType/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/expressions/unaryOperators/negateOperator/negateOperatorWithEnumType/input.ts/es5.1.normal/output.js @@ -4,10 +4,10 @@ ENUM; })(ENUM || (ENUM = { })); var ENUM1; -(function(ENUM11) { - ENUM11[ENUM11["A"] = 0] = "A"; - ENUM11[ENUM11["B"] = 1] = "B"; - ENUM11[ENUM11[""] = 2] = ""; +(function(ENUM1) { + ENUM1[ENUM1["A"] = 0] = "A"; + ENUM1[ENUM1["B"] = 1] = "B"; + ENUM1[ENUM1[""] = 2] = ""; })(ENUM1 || (ENUM1 = { })); // enum type var diff --git a/crates/swc/tests/tsc-references/expressions/unaryOperators/negateOperator/negateOperatorWithEnumType/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/expressions/unaryOperators/negateOperator/negateOperatorWithEnumType/input.ts/es5.2.minified/output.js index 3ae6eee9162..75c3bfb4e56 100644 --- a/crates/swc/tests/tsc-references/expressions/unaryOperators/negateOperator/negateOperatorWithEnumType/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/expressions/unaryOperators/negateOperator/negateOperatorWithEnumType/input.ts/es5.2.minified/output.js @@ -1,3 +1,3 @@ -var ENUM1, ENUM11; -(ENUM1 = ENUM11 || (ENUM11 = { -}))[ENUM1.A = 0] = "A", ENUM1[ENUM1.B = 1] = "B", ENUM1[ENUM1[""] = 2] = "", ENUM11.B, ENUM11.B + ENUM11[""], ENUM11.B; +var ENUM1, ENUM1; +(ENUM1 = ENUM1 || (ENUM1 = { +}))[ENUM1.A = 0] = "A", ENUM1[ENUM1.B = 1] = "B", ENUM1[ENUM1[""] = 2] = "", ENUM1.B, ENUM1.B + ENUM1[""], ENUM1.B; diff --git a/crates/swc/tests/tsc-references/expressions/unaryOperators/plusOperator/plusOperatorWithEnumType/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/expressions/unaryOperators/plusOperator/plusOperatorWithEnumType/input.ts/es2015.1.normal/output.js index 30dae7002f9..365bee30ae4 100644 --- a/crates/swc/tests/tsc-references/expressions/unaryOperators/plusOperator/plusOperatorWithEnumType/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/expressions/unaryOperators/plusOperator/plusOperatorWithEnumType/input.ts/es2015.1.normal/output.js @@ -4,10 +4,10 @@ ENUM; })(ENUM || (ENUM = { })); var ENUM1; -(function(ENUM11) { - ENUM11[ENUM11["A"] = 0] = "A"; - ENUM11[ENUM11["B"] = 1] = "B"; - ENUM11[ENUM11[""] = 2] = ""; +(function(ENUM1) { + ENUM1[ENUM1["A"] = 0] = "A"; + ENUM1[ENUM1["B"] = 1] = "B"; + ENUM1[ENUM1[""] = 2] = ""; })(ENUM1 || (ENUM1 = { })); // enum type var diff --git a/crates/swc/tests/tsc-references/expressions/unaryOperators/plusOperator/plusOperatorWithEnumType/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/expressions/unaryOperators/plusOperator/plusOperatorWithEnumType/input.ts/es2015.2.minified/output.js index 7529de1a72b..d39c228c4cd 100644 --- a/crates/swc/tests/tsc-references/expressions/unaryOperators/plusOperator/plusOperatorWithEnumType/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/expressions/unaryOperators/plusOperator/plusOperatorWithEnumType/input.ts/es2015.2.minified/output.js @@ -1,3 +1,3 @@ -var ENUM1, ENUM, ENUM11; -(ENUM1 = ENUM11 || (ENUM11 = { -}))[ENUM1.A = 0] = "A", ENUM1[ENUM1.B = 1] = "B", ENUM1[ENUM1[""] = 2] = "", ENUM11.A, ENUM[0] + ENUM11.B, ENUM11.B; +var ENUM1, ENUM, ENUM1; +(ENUM1 = ENUM1 || (ENUM1 = { +}))[ENUM1.A = 0] = "A", ENUM1[ENUM1.B = 1] = "B", ENUM1[ENUM1[""] = 2] = "", ENUM1.A, ENUM[0] + ENUM1.B, ENUM1.B; diff --git a/crates/swc/tests/tsc-references/expressions/unaryOperators/plusOperator/plusOperatorWithEnumType/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/expressions/unaryOperators/plusOperator/plusOperatorWithEnumType/input.ts/es5.1.normal/output.js index 30dae7002f9..365bee30ae4 100644 --- a/crates/swc/tests/tsc-references/expressions/unaryOperators/plusOperator/plusOperatorWithEnumType/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/expressions/unaryOperators/plusOperator/plusOperatorWithEnumType/input.ts/es5.1.normal/output.js @@ -4,10 +4,10 @@ ENUM; })(ENUM || (ENUM = { })); var ENUM1; -(function(ENUM11) { - ENUM11[ENUM11["A"] = 0] = "A"; - ENUM11[ENUM11["B"] = 1] = "B"; - ENUM11[ENUM11[""] = 2] = ""; +(function(ENUM1) { + ENUM1[ENUM1["A"] = 0] = "A"; + ENUM1[ENUM1["B"] = 1] = "B"; + ENUM1[ENUM1[""] = 2] = ""; })(ENUM1 || (ENUM1 = { })); // enum type var diff --git a/crates/swc/tests/tsc-references/expressions/unaryOperators/plusOperator/plusOperatorWithEnumType/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/expressions/unaryOperators/plusOperator/plusOperatorWithEnumType/input.ts/es5.2.minified/output.js index 7529de1a72b..d39c228c4cd 100644 --- a/crates/swc/tests/tsc-references/expressions/unaryOperators/plusOperator/plusOperatorWithEnumType/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/expressions/unaryOperators/plusOperator/plusOperatorWithEnumType/input.ts/es5.2.minified/output.js @@ -1,3 +1,3 @@ -var ENUM1, ENUM, ENUM11; -(ENUM1 = ENUM11 || (ENUM11 = { -}))[ENUM1.A = 0] = "A", ENUM1[ENUM1.B = 1] = "B", ENUM1[ENUM1[""] = 2] = "", ENUM11.A, ENUM[0] + ENUM11.B, ENUM11.B; +var ENUM1, ENUM, ENUM1; +(ENUM1 = ENUM1 || (ENUM1 = { +}))[ENUM1.A = 0] = "A", ENUM1[ENUM1.B = 1] = "B", ENUM1[ENUM1[""] = 2] = "", ENUM1.A, ENUM[0] + ENUM1.B, ENUM1.B; diff --git a/crates/swc/tests/tsc-references/expressions/unaryOperators/typeofOperator/typeofOperatorWithEnumType/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/expressions/unaryOperators/typeofOperator/typeofOperatorWithEnumType/input.ts/es2015.1.normal/output.js index 0005bbc55c7..35a4a4af959 100644 --- a/crates/swc/tests/tsc-references/expressions/unaryOperators/typeofOperator/typeofOperatorWithEnumType/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/expressions/unaryOperators/typeofOperator/typeofOperatorWithEnumType/input.ts/es2015.1.normal/output.js @@ -5,10 +5,10 @@ ENUM; })(ENUM || (ENUM = { })); var ENUM1; -(function(ENUM11) { - ENUM11[ENUM11["A"] = 0] = "A"; - ENUM11[ENUM11["B"] = 1] = "B"; - ENUM11[ENUM11[""] = 2] = ""; +(function(ENUM1) { + ENUM1[ENUM1["A"] = 0] = "A"; + ENUM1[ENUM1["B"] = 1] = "B"; + ENUM1[ENUM1[""] = 2] = ""; })(ENUM1 || (ENUM1 = { })); // enum type var diff --git a/crates/swc/tests/tsc-references/expressions/unaryOperators/typeofOperator/typeofOperatorWithEnumType/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/expressions/unaryOperators/typeofOperator/typeofOperatorWithEnumType/input.ts/es2015.2.minified/output.js index 3ea0ad4ae2f..f297a4d7bc4 100644 --- a/crates/swc/tests/tsc-references/expressions/unaryOperators/typeofOperator/typeofOperatorWithEnumType/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/expressions/unaryOperators/typeofOperator/typeofOperatorWithEnumType/input.ts/es2015.2.minified/output.js @@ -1,5 +1,5 @@ -var ENUM1, ENUM, ENUM11; -(ENUM1 = ENUM11 || (ENUM11 = { -}))[ENUM1.A = 0] = "A", ENUM1[ENUM1.B = 1] = "B", ENUM1[ENUM1[""] = 2] = "", ENUM11.A, ENUM[0] + ENUM11.B, ENUM[0] + ENUM11.B, ENUM11.B; +var ENUM1, ENUM, ENUM1; +(ENUM1 = ENUM1 || (ENUM1 = { +}))[ENUM1.A = 0] = "A", ENUM1[ENUM1.B = 1] = "B", ENUM1[ENUM1[""] = 2] = "", ENUM1.A, ENUM[0] + ENUM1.B, ENUM[0] + ENUM1.B, ENUM1.B; z: ; z: ; diff --git a/crates/swc/tests/tsc-references/expressions/unaryOperators/typeofOperator/typeofOperatorWithEnumType/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/expressions/unaryOperators/typeofOperator/typeofOperatorWithEnumType/input.ts/es5.1.normal/output.js index ca5bf29a698..61f77a05240 100644 --- a/crates/swc/tests/tsc-references/expressions/unaryOperators/typeofOperator/typeofOperatorWithEnumType/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/expressions/unaryOperators/typeofOperator/typeofOperatorWithEnumType/input.ts/es5.1.normal/output.js @@ -8,10 +8,10 @@ ENUM; })(ENUM || (ENUM = { })); var ENUM1; -(function(ENUM11) { - ENUM11[ENUM11["A"] = 0] = "A"; - ENUM11[ENUM11["B"] = 1] = "B"; - ENUM11[ENUM11[""] = 2] = ""; +(function(ENUM1) { + ENUM1[ENUM1["A"] = 0] = "A"; + ENUM1[ENUM1["B"] = 1] = "B"; + ENUM1[ENUM1[""] = 2] = ""; })(ENUM1 || (ENUM1 = { })); // enum type var diff --git a/crates/swc/tests/tsc-references/expressions/unaryOperators/typeofOperator/typeofOperatorWithEnumType/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/expressions/unaryOperators/typeofOperator/typeofOperatorWithEnumType/input.ts/es5.2.minified/output.js index 493426b2005..21c26f24de5 100644 --- a/crates/swc/tests/tsc-references/expressions/unaryOperators/typeofOperator/typeofOperatorWithEnumType/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/expressions/unaryOperators/typeofOperator/typeofOperatorWithEnumType/input.ts/es5.2.minified/output.js @@ -1,7 +1,7 @@ -var ENUM1, ENUM, ENUM11, _typeof = function(obj) { +var ENUM1, ENUM, ENUM1, _typeof = function(obj) { return obj && "undefined" != typeof Symbol && obj.constructor === Symbol ? "symbol" : typeof obj; }; -(ENUM1 = ENUM11 || (ENUM11 = { -}))[ENUM1.A = 0] = "A", ENUM1[ENUM1.B = 1] = "B", ENUM1[ENUM1[""] = 2] = "", void 0 === ENUM || _typeof(ENUM), void 0 === ENUM11 || _typeof(ENUM11), _typeof(ENUM11.A), _typeof(ENUM[0] + ENUM11.B), _typeof(void 0 === ENUM ? "undefined" : _typeof(ENUM)), _typeof(_typeof(_typeof(ENUM[0] + ENUM11.B))), void 0 === ENUM || _typeof(ENUM), void 0 === ENUM11 || _typeof(ENUM11), _typeof(ENUM11.B), void 0 === ENUM || _typeof(ENUM); +(ENUM1 = ENUM1 || (ENUM1 = { +}))[ENUM1.A = 0] = "A", ENUM1[ENUM1.B = 1] = "B", ENUM1[ENUM1[""] = 2] = "", void 0 === ENUM || _typeof(ENUM), void 0 === ENUM1 || _typeof(ENUM1), _typeof(ENUM1.A), _typeof(ENUM[0] + ENUM1.B), _typeof(void 0 === ENUM ? "undefined" : _typeof(ENUM)), _typeof(_typeof(_typeof(ENUM[0] + ENUM1.B))), void 0 === ENUM || _typeof(ENUM), void 0 === ENUM1 || _typeof(ENUM1), _typeof(ENUM1.B), void 0 === ENUM || _typeof(ENUM); z: void 0 === ENUM || _typeof(ENUM); -z: void 0 === ENUM11 || _typeof(ENUM11); +z: void 0 === ENUM1 || _typeof(ENUM1); diff --git a/crates/swc/tests/tsc-references/expressions/unaryOperators/voidOperator/voidOperatorWithEnumType/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/expressions/unaryOperators/voidOperator/voidOperatorWithEnumType/input.ts/es2015.1.normal/output.js index 202c83066e1..a609783713b 100644 --- a/crates/swc/tests/tsc-references/expressions/unaryOperators/voidOperator/voidOperatorWithEnumType/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/expressions/unaryOperators/voidOperator/voidOperatorWithEnumType/input.ts/es2015.1.normal/output.js @@ -4,10 +4,10 @@ ENUM; })(ENUM || (ENUM = { })); var ENUM1; -(function(ENUM11) { - ENUM11[ENUM11["A"] = 0] = "A"; - ENUM11[ENUM11["B"] = 1] = "B"; - ENUM11[ENUM11[""] = 2] = ""; +(function(ENUM1) { + ENUM1[ENUM1["A"] = 0] = "A"; + ENUM1[ENUM1["B"] = 1] = "B"; + ENUM1[ENUM1[""] = 2] = ""; })(ENUM1 || (ENUM1 = { })); // enum type var diff --git a/crates/swc/tests/tsc-references/expressions/unaryOperators/voidOperator/voidOperatorWithEnumType/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/expressions/unaryOperators/voidOperator/voidOperatorWithEnumType/input.ts/es2015.2.minified/output.js index fe9f72508a6..ac8e327a192 100644 --- a/crates/swc/tests/tsc-references/expressions/unaryOperators/voidOperator/voidOperatorWithEnumType/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/expressions/unaryOperators/voidOperator/voidOperatorWithEnumType/input.ts/es2015.2.minified/output.js @@ -1,3 +1,3 @@ -var ENUM1, ENUM, ENUM11; -(ENUM1 = ENUM11 || (ENUM11 = { -}))[ENUM1.A = 0] = "A", ENUM1[ENUM1.B = 1] = "B", ENUM1[ENUM1[""] = 2] = "", ENUM11.A, ENUM[0] + ENUM11.B, ENUM[0] + ENUM11.B, ENUM11.B; +var ENUM1, ENUM, ENUM1; +(ENUM1 = ENUM1 || (ENUM1 = { +}))[ENUM1.A = 0] = "A", ENUM1[ENUM1.B = 1] = "B", ENUM1[ENUM1[""] = 2] = "", ENUM1.A, ENUM[0] + ENUM1.B, ENUM[0] + ENUM1.B, ENUM1.B; diff --git a/crates/swc/tests/tsc-references/expressions/unaryOperators/voidOperator/voidOperatorWithEnumType/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/expressions/unaryOperators/voidOperator/voidOperatorWithEnumType/input.ts/es5.1.normal/output.js index 202c83066e1..a609783713b 100644 --- a/crates/swc/tests/tsc-references/expressions/unaryOperators/voidOperator/voidOperatorWithEnumType/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/expressions/unaryOperators/voidOperator/voidOperatorWithEnumType/input.ts/es5.1.normal/output.js @@ -4,10 +4,10 @@ ENUM; })(ENUM || (ENUM = { })); var ENUM1; -(function(ENUM11) { - ENUM11[ENUM11["A"] = 0] = "A"; - ENUM11[ENUM11["B"] = 1] = "B"; - ENUM11[ENUM11[""] = 2] = ""; +(function(ENUM1) { + ENUM1[ENUM1["A"] = 0] = "A"; + ENUM1[ENUM1["B"] = 1] = "B"; + ENUM1[ENUM1[""] = 2] = ""; })(ENUM1 || (ENUM1 = { })); // enum type var diff --git a/crates/swc/tests/tsc-references/expressions/unaryOperators/voidOperator/voidOperatorWithEnumType/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/expressions/unaryOperators/voidOperator/voidOperatorWithEnumType/input.ts/es5.2.minified/output.js index fe9f72508a6..ac8e327a192 100644 --- a/crates/swc/tests/tsc-references/expressions/unaryOperators/voidOperator/voidOperatorWithEnumType/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/expressions/unaryOperators/voidOperator/voidOperatorWithEnumType/input.ts/es5.2.minified/output.js @@ -1,3 +1,3 @@ -var ENUM1, ENUM, ENUM11; -(ENUM1 = ENUM11 || (ENUM11 = { -}))[ENUM1.A = 0] = "A", ENUM1[ENUM1.B = 1] = "B", ENUM1[ENUM1[""] = 2] = "", ENUM11.A, ENUM[0] + ENUM11.B, ENUM[0] + ENUM11.B, ENUM11.B; +var ENUM1, ENUM, ENUM1; +(ENUM1 = ENUM1 || (ENUM1 = { +}))[ENUM1.A = 0] = "A", ENUM1[ENUM1.B = 1] = "B", ENUM1[ENUM1[""] = 2] = "", ENUM1.A, ENUM[0] + ENUM1.B, ENUM[0] + ENUM1.B, ENUM1.B; diff --git a/crates/swc/tests/tsc-references/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers/input.ts/es2015.1.normal/output.js index fd0f4d911f1..412de8e3406 100644 --- a/crates/swc/tests/tsc-references/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers/input.ts/es2015.1.normal/output.js @@ -23,7 +23,7 @@ M = { }; // Error var M2; (function(M21) { - var M31; + let M31; (function(M3) { var x1; M3.x = x1; @@ -76,8 +76,8 @@ function fn2(x2, y) { y['t'] = ''; // Error } var E; -(function(E1) { - E1[E1["A"] = 0] = "A"; +(function(E) { + E[E["A"] = 0] = "A"; })(E || (E = { })); E = undefined; // Error diff --git a/crates/swc/tests/tsc-references/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers/input.ts/es2015.2.minified/output.js index 6c42806083e..a35b6cd5609 100644 --- a/crates/swc/tests/tsc-references/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers/input.ts/es2015.2.minified/output.js @@ -1,4 +1,4 @@ -var x, M, M2, E, E1; +var x, M, M2, E, E; function fn() { } x = 3 = "", (function(M1) { @@ -10,7 +10,8 @@ x = 3 = "", (function(M1) { } = { y: 3 }, (function(M21) { - var M3, x1; + var x1; + let M3; (M3 || (M3 = { })).x = x1, M3 = { x: 3 @@ -29,8 +30,8 @@ x = 3 = "", (function(M1) { }, M2.M3 = { x: "" }, fn = ()=>3 -, (E1 = E || (E = { -}))[E1.A = 0] = "A", E = void 0 = void 0; +, (E = E || (E = { +}))[E.A = 0] = "A", E = void 0 = void 0; class C { } C = void 0; diff --git a/crates/swc/tests/tsc-references/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers/input.ts/es5.1.normal/output.js index 1ef83d973fc..dbc1cebde61 100644 --- a/crates/swc/tests/tsc-references/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers/input.ts/es5.1.normal/output.js @@ -83,8 +83,8 @@ function fn2(x2, y) { y['t'] = ''; // Error } var E; -(function(E1) { - E1[E1["A"] = 0] = "A"; +(function(E) { + E[E["A"] = 0] = "A"; })(E || (E = { })); E = undefined; // Error diff --git a/crates/swc/tests/tsc-references/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers/input.ts/es5.2.minified/output.js index 5cff016f5d9..ce5ee1bcaf3 100644 --- a/crates/swc/tests/tsc-references/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers/input.ts/es5.2.minified/output.js @@ -29,9 +29,9 @@ x = 3 = "", (function(M1) { x: "" }, fn = function() { return 3; -}, (E = E1 || (E1 = { -}))[E.A = 0] = "A", E1 = void 0 = void 0; -var E, x, M, M2, E1, C = function() { +}, (E = E || (E = { +}))[E.A = 0] = "A", E = void 0 = void 0; +var E, x, M, M2, E, C = function() { "use strict"; !function(instance, Constructor) { if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function"); diff --git a/crates/swc/tests/tsc-references/expressions/valuesAndReferences/assignments/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/expressions/valuesAndReferences/assignments/input.ts/es2015.1.normal/output.js index ce4a0808c71..c13274083f9 100644 --- a/crates/swc/tests/tsc-references/expressions/valuesAndReferences/assignments/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/expressions/valuesAndReferences/assignments/input.ts/es2015.1.normal/output.js @@ -3,8 +3,8 @@ class C { } C = null; // Error var E; -(function(E1) { - E1[E1["A"] = 0] = "A"; +(function(E) { + E[E["A"] = 0] = "A"; })(E || (E = { })); E = null; // Error diff --git a/crates/swc/tests/tsc-references/expressions/valuesAndReferences/assignments/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/expressions/valuesAndReferences/assignments/input.ts/es2015.2.minified/output.js index b4776169389..23b9e18b3bd 100644 --- a/crates/swc/tests/tsc-references/expressions/valuesAndReferences/assignments/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/expressions/valuesAndReferences/assignments/input.ts/es2015.2.minified/output.js @@ -1,3 +1,3 @@ -var E, E1; -M = null, (E1 = E || (E = { -}))[E1.A = 0] = "A", (E = null).A = null, I = null; +var E, E; +M = null, (E = E || (E = { +}))[E.A = 0] = "A", (E = null).A = null, I = null; diff --git a/crates/swc/tests/tsc-references/expressions/valuesAndReferences/assignments/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/expressions/valuesAndReferences/assignments/input.ts/es5.1.normal/output.js index e60353a665d..8f216b0bc12 100644 --- a/crates/swc/tests/tsc-references/expressions/valuesAndReferences/assignments/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/expressions/valuesAndReferences/assignments/input.ts/es5.1.normal/output.js @@ -10,8 +10,8 @@ var C = function C() { }; C = null; // Error var E; -(function(E1) { - E1[E1["A"] = 0] = "A"; +(function(E) { + E[E["A"] = 0] = "A"; })(E || (E = { })); E = null; // Error diff --git a/crates/swc/tests/tsc-references/expressions/valuesAndReferences/assignments/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/expressions/valuesAndReferences/assignments/input.ts/es5.2.minified/output.js index c34a6dbe66e..8d0604f38c9 100644 --- a/crates/swc/tests/tsc-references/expressions/valuesAndReferences/assignments/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/expressions/valuesAndReferences/assignments/input.ts/es5.2.minified/output.js @@ -1,9 +1,9 @@ M = null; -var E, E1, C = function() { +var E, E, C = function() { "use strict"; !function(instance, Constructor) { if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function"); }(this, C); }; -C = null, (E = E1 || (E1 = { -}))[E.A = 0] = "A", (E1 = null).A = null, I = null; +C = null, (E = E || (E = { +}))[E.A = 0] = "A", (E = null).A = null, I = null; diff --git a/crates/swc/tests/tsc-references/externalModules/amdImportAsPrimaryExpression/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/externalModules/amdImportAsPrimaryExpression/input.ts/es2015.1.normal/output.js index cfee5cb113f..838b3fc6857 100644 --- a/crates/swc/tests/tsc-references/externalModules/amdImportAsPrimaryExpression/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/externalModules/amdImportAsPrimaryExpression/input.ts/es2015.1.normal/output.js @@ -1,8 +1,8 @@ export var E1; -(function(E11) { - E11[E11["A"] = 0] = "A"; - E11[E11["B"] = 1] = "B"; - E11[E11["C"] = 2] = "C"; +(function(E1) { + E1[E1["A"] = 0] = "A"; + E1[E1["B"] = 1] = "B"; + E1[E1["C"] = 2] = "C"; })(E1 || (E1 = { })); // @Filename: foo_1.ts diff --git a/crates/swc/tests/tsc-references/externalModules/amdImportAsPrimaryExpression/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/externalModules/amdImportAsPrimaryExpression/input.ts/es2015.2.minified/output.js index 05d561d1607..f215e6b892e 100644 --- a/crates/swc/tests/tsc-references/externalModules/amdImportAsPrimaryExpression/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/externalModules/amdImportAsPrimaryExpression/input.ts/es2015.2.minified/output.js @@ -1,5 +1,5 @@ -var E1, E11; -(E11 = E1 || (E1 = { -}))[E11.A = 0] = "A", E11[E11.B = 1] = "B", E11[E11.C = 2] = "C"; +var E1, E1; +(E1 = E1 || (E1 = { +}))[E1.A = 0] = "A", E1[E1.B = 1] = "B", E1[E1.C = 2] = "C"; const foo = require("./foo_0"); 0 === foo.E1.A; diff --git a/crates/swc/tests/tsc-references/externalModules/amdImportAsPrimaryExpression/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/externalModules/amdImportAsPrimaryExpression/input.ts/es5.1.normal/output.js index b9c2895a7d0..cf77d8bea5d 100644 --- a/crates/swc/tests/tsc-references/externalModules/amdImportAsPrimaryExpression/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/externalModules/amdImportAsPrimaryExpression/input.ts/es5.1.normal/output.js @@ -1,8 +1,8 @@ export var E1; -(function(E11) { - E11[E11["A"] = 0] = "A"; - E11[E11["B"] = 1] = "B"; - E11[E11["C"] = 2] = "C"; +(function(E1) { + E1[E1["A"] = 0] = "A"; + E1[E1["B"] = 1] = "B"; + E1[E1["C"] = 2] = "C"; })(E1 || (E1 = { })); // @Filename: foo_1.ts diff --git a/crates/swc/tests/tsc-references/externalModules/amdImportAsPrimaryExpression/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/externalModules/amdImportAsPrimaryExpression/input.ts/es5.2.minified/output.js index 9239714a94f..9b6c0c49bdd 100644 --- a/crates/swc/tests/tsc-references/externalModules/amdImportAsPrimaryExpression/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/externalModules/amdImportAsPrimaryExpression/input.ts/es5.2.minified/output.js @@ -1,3 +1,3 @@ -var E1, E11; -(E11 = E1 || (E1 = { -}))[E11.A = 0] = "A", E11[E11.B = 1] = "B", E11[E11.C = 2] = "C", 0 === require("./foo_0").E1.A; +var E1, E1; +(E1 = E1 || (E1 = { +}))[E1.A = 0] = "A", E1[E1.B = 1] = "B", E1[E1.C = 2] = "C", 0 === require("./foo_0").E1.A; diff --git a/crates/swc/tests/tsc-references/externalModules/amdImportNotAsPrimaryExpression/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/externalModules/amdImportNotAsPrimaryExpression/input.ts/es2015.1.normal/output.js index 153c9b1c505..b6fe5df12ff 100644 --- a/crates/swc/tests/tsc-references/externalModules/amdImportNotAsPrimaryExpression/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/externalModules/amdImportNotAsPrimaryExpression/input.ts/es2015.1.normal/output.js @@ -7,10 +7,10 @@ export class C1 { } C1.s1 = true; export var E1; -(function(E11) { - E11[E11["A"] = 0] = "A"; - E11[E11["B"] = 1] = "B"; - E11[E11["C"] = 2] = "C"; +(function(E1) { + E1[E1["A"] = 0] = "A"; + E1[E1["B"] = 1] = "B"; + E1[E1["C"] = 2] = "C"; })(E1 || (E1 = { })); // @Filename: foo_1.ts diff --git a/crates/swc/tests/tsc-references/externalModules/amdImportNotAsPrimaryExpression/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/externalModules/amdImportNotAsPrimaryExpression/input.ts/es2015.2.minified/output.js index 3f28f541312..54585c7e769 100644 --- a/crates/swc/tests/tsc-references/externalModules/amdImportNotAsPrimaryExpression/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/externalModules/amdImportNotAsPrimaryExpression/input.ts/es2015.2.minified/output.js @@ -1,8 +1,8 @@ -var E1, E11; +var E1, E1; export class C1 { constructor(){ this.m1 = 42; } } -C1.s1 = !0, (E1 = E11 || (E11 = { +C1.s1 = !0, (E1 = E1 || (E1 = { }))[E1.A = 0] = "A", E1[E1.B = 1] = "B", E1[E1.C = 2] = "C", require("./foo_0"); diff --git a/crates/swc/tests/tsc-references/externalModules/amdImportNotAsPrimaryExpression/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/externalModules/amdImportNotAsPrimaryExpression/input.ts/es5.1.normal/output.js index 686fe2974ec..23aaf113d25 100644 --- a/crates/swc/tests/tsc-references/externalModules/amdImportNotAsPrimaryExpression/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/externalModules/amdImportNotAsPrimaryExpression/input.ts/es5.1.normal/output.js @@ -12,10 +12,10 @@ export var C1 = function C1() { }; C1.s1 = true; export var E1; -(function(E11) { - E11[E11["A"] = 0] = "A"; - E11[E11["B"] = 1] = "B"; - E11[E11["C"] = 2] = "C"; +(function(E1) { + E1[E1["A"] = 0] = "A"; + E1[E1["B"] = 1] = "B"; + E1[E1["C"] = 2] = "C"; })(E1 || (E1 = { })); // @Filename: foo_1.ts diff --git a/crates/swc/tests/tsc-references/externalModules/amdImportNotAsPrimaryExpression/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/externalModules/amdImportNotAsPrimaryExpression/input.ts/es5.2.minified/output.js index 65ad2959ef8..06ef9fb1916 100644 --- a/crates/swc/tests/tsc-references/externalModules/amdImportNotAsPrimaryExpression/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/externalModules/amdImportNotAsPrimaryExpression/input.ts/es5.2.minified/output.js @@ -1,9 +1,8 @@ -var E1, E11, i, z, C1 = function() { +export var E1, E1, i, z, C1 = function() { "use strict"; !function(instance, Constructor) { if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function"); }(this, C1), this.m1 = 42; }; -export { E11 as E1 }; -C1.s1 = !0, (E1 = E11 || (E11 = { +C1.s1 = !0, (E1 = E1 || (E1 = { }))[E1.A = 0] = "A", E1[E1.B = 1] = "B", E1[E1.C = 2] = "C", require("./foo_0"); diff --git a/crates/swc/tests/tsc-references/externalModules/commonJSImportNotAsPrimaryExpression/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/externalModules/commonJSImportNotAsPrimaryExpression/input.ts/es2015.1.normal/output.js index 88c8ee5ea49..ecfd1b0d0ec 100644 --- a/crates/swc/tests/tsc-references/externalModules/commonJSImportNotAsPrimaryExpression/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/externalModules/commonJSImportNotAsPrimaryExpression/input.ts/es2015.1.normal/output.js @@ -7,10 +7,10 @@ export class C1 { } C1.s1 = true; export var E1; -(function(E11) { - E11[E11["A"] = 0] = "A"; - E11[E11["B"] = 1] = "B"; - E11[E11["C"] = 2] = "C"; +(function(E1) { + E1[E1["A"] = 0] = "A"; + E1[E1["B"] = 1] = "B"; + E1[E1["C"] = 2] = "C"; })(E1 || (E1 = { })); // @Filename: foo_1.ts diff --git a/crates/swc/tests/tsc-references/externalModules/commonJSImportNotAsPrimaryExpression/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/externalModules/commonJSImportNotAsPrimaryExpression/input.ts/es2015.2.minified/output.js index 3f28f541312..54585c7e769 100644 --- a/crates/swc/tests/tsc-references/externalModules/commonJSImportNotAsPrimaryExpression/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/externalModules/commonJSImportNotAsPrimaryExpression/input.ts/es2015.2.minified/output.js @@ -1,8 +1,8 @@ -var E1, E11; +var E1, E1; export class C1 { constructor(){ this.m1 = 42; } } -C1.s1 = !0, (E1 = E11 || (E11 = { +C1.s1 = !0, (E1 = E1 || (E1 = { }))[E1.A = 0] = "A", E1[E1.B = 1] = "B", E1[E1.C = 2] = "C", require("./foo_0"); diff --git a/crates/swc/tests/tsc-references/externalModules/commonJSImportNotAsPrimaryExpression/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/externalModules/commonJSImportNotAsPrimaryExpression/input.ts/es5.1.normal/output.js index 094a5fca7bd..8a58ba88084 100644 --- a/crates/swc/tests/tsc-references/externalModules/commonJSImportNotAsPrimaryExpression/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/externalModules/commonJSImportNotAsPrimaryExpression/input.ts/es5.1.normal/output.js @@ -12,10 +12,10 @@ export var C1 = function C1() { }; C1.s1 = true; export var E1; -(function(E11) { - E11[E11["A"] = 0] = "A"; - E11[E11["B"] = 1] = "B"; - E11[E11["C"] = 2] = "C"; +(function(E1) { + E1[E1["A"] = 0] = "A"; + E1[E1["B"] = 1] = "B"; + E1[E1["C"] = 2] = "C"; })(E1 || (E1 = { })); // @Filename: foo_1.ts diff --git a/crates/swc/tests/tsc-references/externalModules/commonJSImportNotAsPrimaryExpression/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/externalModules/commonJSImportNotAsPrimaryExpression/input.ts/es5.2.minified/output.js index 65ad2959ef8..06ef9fb1916 100644 --- a/crates/swc/tests/tsc-references/externalModules/commonJSImportNotAsPrimaryExpression/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/externalModules/commonJSImportNotAsPrimaryExpression/input.ts/es5.2.minified/output.js @@ -1,9 +1,8 @@ -var E1, E11, i, z, C1 = function() { +export var E1, E1, i, z, C1 = function() { "use strict"; !function(instance, Constructor) { if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function"); }(this, C1), this.m1 = 42; }; -export { E11 as E1 }; -C1.s1 = !0, (E1 = E11 || (E11 = { +C1.s1 = !0, (E1 = E1 || (E1 = { }))[E1.A = 0] = "A", E1[E1.B = 1] = "B", E1[E1.C = 2] = "C", require("./foo_0"); diff --git a/crates/swc/tests/tsc-references/externalModules/es6/es6modulekindWithES5Target12/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/externalModules/es6/es6modulekindWithES5Target12/input.ts/es2015.1.normal/output.js index a5744ac9a62..808565a6961 100644 --- a/crates/swc/tests/tsc-references/externalModules/es6/es6modulekindWithES5Target12/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/externalModules/es6/es6modulekindWithES5Target12/input.ts/es2015.1.normal/output.js @@ -7,20 +7,20 @@ export class C { })(C || (C = { })); export var E; -(function(E1) { - E1[E1["w"] = 1] = "w"; +(function(E) { + E[E["w"] = 1] = "w"; })(E || (E = { })); -(function(E2) { - E2[E2["x"] = 2] = "x"; +(function(E) { + E[E["x"] = 2] = "x"; })(E || (E = { })); -(function(E3) { - E3.y = 1; +(function(E) { + E.y = 1; })(E || (E = { })); -(function(E4) { - E4.z = 1; +(function(E) { + E.z = 1; })(E || (E = { })); (function(N) { diff --git a/crates/swc/tests/tsc-references/externalModules/es6/es6modulekindWithES5Target12/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/externalModules/es6/es6modulekindWithES5Target12/input.ts/es2015.2.minified/output.js index 1247b0f71de..fab18a343c9 100644 --- a/crates/swc/tests/tsc-references/externalModules/es6/es6modulekindWithES5Target12/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/externalModules/es6/es6modulekindWithES5Target12/input.ts/es2015.2.minified/output.js @@ -1,10 +1,10 @@ -var E, E1, E2; +var E, E, E; export class C { } (C || (C = { -})).x = 1, (E1 = E || (E = { -}))[E1.w = 1] = "w", (E2 = E || (E = { -}))[E2.x = 2] = "x", (E || (E = { +})).x = 1, (E = E || (E = { +}))[E.w = 1] = "w", (E = E || (E = { +}))[E.x = 2] = "x", (E || (E = { })).y = 1, (E || (E = { })).z = 1, (N || (N = { })).x = 1; diff --git a/crates/swc/tests/tsc-references/externalModules/es6/es6modulekindWithES5Target12/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/externalModules/es6/es6modulekindWithES5Target12/input.ts/es5.1.normal/output.js index 46c31720f89..74c51d1045a 100644 --- a/crates/swc/tests/tsc-references/externalModules/es6/es6modulekindWithES5Target12/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/externalModules/es6/es6modulekindWithES5Target12/input.ts/es5.1.normal/output.js @@ -14,20 +14,20 @@ export var C = function C() { })(C || (C = { })); export var E; -(function(E1) { - E1[E1["w"] = 1] = "w"; +(function(E) { + E[E["w"] = 1] = "w"; })(E || (E = { })); -(function(E2) { - E2[E2["x"] = 2] = "x"; +(function(E) { + E[E["x"] = 2] = "x"; })(E || (E = { })); -(function(E3) { - E3.y = 1; +(function(E) { + E.y = 1; })(E || (E = { })); -(function(E4) { - E4.z = 1; +(function(E) { + E.z = 1; })(E || (E = { })); (function(N) { diff --git a/crates/swc/tests/tsc-references/externalModules/es6/es6modulekindWithES5Target12/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/externalModules/es6/es6modulekindWithES5Target12/input.ts/es5.2.minified/output.js index 4bc9dc20889..e3e8e6fb001 100644 --- a/crates/swc/tests/tsc-references/externalModules/es6/es6modulekindWithES5Target12/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/externalModules/es6/es6modulekindWithES5Target12/input.ts/es5.2.minified/output.js @@ -1,15 +1,14 @@ -var E, E1, E2, C = function() { +export var E, E, E, C = function() { "use strict"; !function(instance, Constructor) { if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function"); }(this, C); }; -export { E1 as E, E2 as E }; (C || (C = { -})).x = 1, (E = E2 || (E2 = { -}))[E.w = 1] = "w", (E1 = E2 || (E2 = { -}))[E1.x = 2] = "x", (E2 || (E2 = { -})).y = 1, (E2 || (E2 = { +})).x = 1, (E = E || (E = { +}))[E.w = 1] = "w", (E = E || (E = { +}))[E.x = 2] = "x", (E || (E = { +})).y = 1, (E || (E = { })).z = 1, (N || (N = { })).x = 1; export function F() { diff --git a/crates/swc/tests/tsc-references/externalModules/es6/es6modulekindWithES5Target5/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/externalModules/es6/es6modulekindWithES5Target5/input.ts/es2015.1.normal/output.js index 3e6b9c68df2..55833d3eec7 100644 --- a/crates/swc/tests/tsc-references/externalModules/es6/es6modulekindWithES5Target5/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/externalModules/es6/es6modulekindWithES5Target5/input.ts/es2015.1.normal/output.js @@ -1,10 +1,10 @@ export var E1; -(function(E11) { - E11[E11["value1"] = 0] = "value1"; +(function(E1) { + E1[E1["value1"] = 0] = "value1"; })(E1 || (E1 = { })); export var E2; -(function(E21) { - E21[E21["value1"] = 0] = "value1"; +(function(E2) { + E2[E2["value1"] = 0] = "value1"; })(E2 || (E2 = { })); diff --git a/crates/swc/tests/tsc-references/externalModules/es6/es6modulekindWithES5Target5/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/externalModules/es6/es6modulekindWithES5Target5/input.ts/es2015.2.minified/output.js index 1fad1beba18..919f976bb18 100644 --- a/crates/swc/tests/tsc-references/externalModules/es6/es6modulekindWithES5Target5/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/externalModules/es6/es6modulekindWithES5Target5/input.ts/es2015.2.minified/output.js @@ -1,4 +1,4 @@ -var E1, E2, E11, E21; -(E11 = E1 || (E1 = { -}))[E11.value1 = 0] = "value1", (E21 = E2 || (E2 = { -}))[E21.value1 = 0] = "value1"; +var E1, E2, E1, E2; +(E1 = E1 || (E1 = { +}))[E1.value1 = 0] = "value1", (E2 = E2 || (E2 = { +}))[E2.value1 = 0] = "value1"; diff --git a/crates/swc/tests/tsc-references/externalModules/es6/es6modulekindWithES5Target5/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/externalModules/es6/es6modulekindWithES5Target5/input.ts/es5.1.normal/output.js index 3e6b9c68df2..55833d3eec7 100644 --- a/crates/swc/tests/tsc-references/externalModules/es6/es6modulekindWithES5Target5/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/externalModules/es6/es6modulekindWithES5Target5/input.ts/es5.1.normal/output.js @@ -1,10 +1,10 @@ export var E1; -(function(E11) { - E11[E11["value1"] = 0] = "value1"; +(function(E1) { + E1[E1["value1"] = 0] = "value1"; })(E1 || (E1 = { })); export var E2; -(function(E21) { - E21[E21["value1"] = 0] = "value1"; +(function(E2) { + E2[E2["value1"] = 0] = "value1"; })(E2 || (E2 = { })); diff --git a/crates/swc/tests/tsc-references/externalModules/es6/es6modulekindWithES5Target5/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/externalModules/es6/es6modulekindWithES5Target5/input.ts/es5.2.minified/output.js index 1fad1beba18..919f976bb18 100644 --- a/crates/swc/tests/tsc-references/externalModules/es6/es6modulekindWithES5Target5/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/externalModules/es6/es6modulekindWithES5Target5/input.ts/es5.2.minified/output.js @@ -1,4 +1,4 @@ -var E1, E2, E11, E21; -(E11 = E1 || (E1 = { -}))[E11.value1 = 0] = "value1", (E21 = E2 || (E2 = { -}))[E21.value1 = 0] = "value1"; +var E1, E2, E1, E2; +(E1 = E1 || (E1 = { +}))[E1.value1 = 0] = "value1", (E2 = E2 || (E2 = { +}))[E2.value1 = 0] = "value1"; diff --git a/crates/swc/tests/tsc-references/externalModules/esnext/esnextmodulekindWithES5Target12/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/externalModules/esnext/esnextmodulekindWithES5Target12/input.ts/es2015.1.normal/output.js index 1aefa88bf48..b9e1f10d458 100644 --- a/crates/swc/tests/tsc-references/externalModules/esnext/esnextmodulekindWithES5Target12/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/externalModules/esnext/esnextmodulekindWithES5Target12/input.ts/es2015.1.normal/output.js @@ -7,20 +7,20 @@ export class C { })(C || (C = { })); export var E; -(function(E1) { - E1[E1["w"] = 1] = "w"; +(function(E) { + E[E["w"] = 1] = "w"; })(E || (E = { })); -(function(E2) { - E2[E2["x"] = 2] = "x"; +(function(E) { + E[E["x"] = 2] = "x"; })(E || (E = { })); -(function(E3) { - E3.y = 1; +(function(E) { + E.y = 1; })(E || (E = { })); -(function(E4) { - E4.z = 1; +(function(E) { + E.z = 1; })(E || (E = { })); (function(N) { diff --git a/crates/swc/tests/tsc-references/externalModules/esnext/esnextmodulekindWithES5Target12/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/externalModules/esnext/esnextmodulekindWithES5Target12/input.ts/es2015.2.minified/output.js index 1247b0f71de..fab18a343c9 100644 --- a/crates/swc/tests/tsc-references/externalModules/esnext/esnextmodulekindWithES5Target12/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/externalModules/esnext/esnextmodulekindWithES5Target12/input.ts/es2015.2.minified/output.js @@ -1,10 +1,10 @@ -var E, E1, E2; +var E, E, E; export class C { } (C || (C = { -})).x = 1, (E1 = E || (E = { -}))[E1.w = 1] = "w", (E2 = E || (E = { -}))[E2.x = 2] = "x", (E || (E = { +})).x = 1, (E = E || (E = { +}))[E.w = 1] = "w", (E = E || (E = { +}))[E.x = 2] = "x", (E || (E = { })).y = 1, (E || (E = { })).z = 1, (N || (N = { })).x = 1; diff --git a/crates/swc/tests/tsc-references/externalModules/esnext/esnextmodulekindWithES5Target12/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/externalModules/esnext/esnextmodulekindWithES5Target12/input.ts/es5.1.normal/output.js index 97b60d379fc..2ed213421c0 100644 --- a/crates/swc/tests/tsc-references/externalModules/esnext/esnextmodulekindWithES5Target12/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/externalModules/esnext/esnextmodulekindWithES5Target12/input.ts/es5.1.normal/output.js @@ -14,20 +14,20 @@ export var C = function C() { })(C || (C = { })); export var E; -(function(E1) { - E1[E1["w"] = 1] = "w"; +(function(E) { + E[E["w"] = 1] = "w"; })(E || (E = { })); -(function(E2) { - E2[E2["x"] = 2] = "x"; +(function(E) { + E[E["x"] = 2] = "x"; })(E || (E = { })); -(function(E3) { - E3.y = 1; +(function(E) { + E.y = 1; })(E || (E = { })); -(function(E4) { - E4.z = 1; +(function(E) { + E.z = 1; })(E || (E = { })); (function(N) { diff --git a/crates/swc/tests/tsc-references/externalModules/esnext/esnextmodulekindWithES5Target12/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/externalModules/esnext/esnextmodulekindWithES5Target12/input.ts/es5.2.minified/output.js index 4bc9dc20889..e3e8e6fb001 100644 --- a/crates/swc/tests/tsc-references/externalModules/esnext/esnextmodulekindWithES5Target12/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/externalModules/esnext/esnextmodulekindWithES5Target12/input.ts/es5.2.minified/output.js @@ -1,15 +1,14 @@ -var E, E1, E2, C = function() { +export var E, E, E, C = function() { "use strict"; !function(instance, Constructor) { if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function"); }(this, C); }; -export { E1 as E, E2 as E }; (C || (C = { -})).x = 1, (E = E2 || (E2 = { -}))[E.w = 1] = "w", (E1 = E2 || (E2 = { -}))[E1.x = 2] = "x", (E2 || (E2 = { -})).y = 1, (E2 || (E2 = { +})).x = 1, (E = E || (E = { +}))[E.w = 1] = "w", (E = E || (E = { +}))[E.x = 2] = "x", (E || (E = { +})).y = 1, (E || (E = { })).z = 1, (N || (N = { })).x = 1; export function F() { diff --git a/crates/swc/tests/tsc-references/externalModules/esnext/esnextmodulekindWithES5Target5/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/externalModules/esnext/esnextmodulekindWithES5Target5/input.ts/es2015.1.normal/output.js index 3e6b9c68df2..55833d3eec7 100644 --- a/crates/swc/tests/tsc-references/externalModules/esnext/esnextmodulekindWithES5Target5/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/externalModules/esnext/esnextmodulekindWithES5Target5/input.ts/es2015.1.normal/output.js @@ -1,10 +1,10 @@ export var E1; -(function(E11) { - E11[E11["value1"] = 0] = "value1"; +(function(E1) { + E1[E1["value1"] = 0] = "value1"; })(E1 || (E1 = { })); export var E2; -(function(E21) { - E21[E21["value1"] = 0] = "value1"; +(function(E2) { + E2[E2["value1"] = 0] = "value1"; })(E2 || (E2 = { })); diff --git a/crates/swc/tests/tsc-references/externalModules/esnext/esnextmodulekindWithES5Target5/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/externalModules/esnext/esnextmodulekindWithES5Target5/input.ts/es2015.2.minified/output.js index 1fad1beba18..919f976bb18 100644 --- a/crates/swc/tests/tsc-references/externalModules/esnext/esnextmodulekindWithES5Target5/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/externalModules/esnext/esnextmodulekindWithES5Target5/input.ts/es2015.2.minified/output.js @@ -1,4 +1,4 @@ -var E1, E2, E11, E21; -(E11 = E1 || (E1 = { -}))[E11.value1 = 0] = "value1", (E21 = E2 || (E2 = { -}))[E21.value1 = 0] = "value1"; +var E1, E2, E1, E2; +(E1 = E1 || (E1 = { +}))[E1.value1 = 0] = "value1", (E2 = E2 || (E2 = { +}))[E2.value1 = 0] = "value1"; diff --git a/crates/swc/tests/tsc-references/externalModules/esnext/esnextmodulekindWithES5Target5/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/externalModules/esnext/esnextmodulekindWithES5Target5/input.ts/es5.1.normal/output.js index 3e6b9c68df2..55833d3eec7 100644 --- a/crates/swc/tests/tsc-references/externalModules/esnext/esnextmodulekindWithES5Target5/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/externalModules/esnext/esnextmodulekindWithES5Target5/input.ts/es5.1.normal/output.js @@ -1,10 +1,10 @@ export var E1; -(function(E11) { - E11[E11["value1"] = 0] = "value1"; +(function(E1) { + E1[E1["value1"] = 0] = "value1"; })(E1 || (E1 = { })); export var E2; -(function(E21) { - E21[E21["value1"] = 0] = "value1"; +(function(E2) { + E2[E2["value1"] = 0] = "value1"; })(E2 || (E2 = { })); diff --git a/crates/swc/tests/tsc-references/externalModules/esnext/esnextmodulekindWithES5Target5/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/externalModules/esnext/esnextmodulekindWithES5Target5/input.ts/es5.2.minified/output.js index 1fad1beba18..919f976bb18 100644 --- a/crates/swc/tests/tsc-references/externalModules/esnext/esnextmodulekindWithES5Target5/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/externalModules/esnext/esnextmodulekindWithES5Target5/input.ts/es5.2.minified/output.js @@ -1,4 +1,4 @@ -var E1, E2, E11, E21; -(E11 = E1 || (E1 = { -}))[E11.value1 = 0] = "value1", (E21 = E2 || (E2 = { -}))[E21.value1 = 0] = "value1"; +var E1, E2, E1, E2; +(E1 = E1 || (E1 = { +}))[E1.value1 = 0] = "value1", (E2 = E2 || (E2 = { +}))[E2.value1 = 0] = "value1"; diff --git a/crates/swc/tests/tsc-references/externalModules/exportAssignmentAndDeclaration/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/externalModules/exportAssignmentAndDeclaration/input.ts/es2015.1.normal/output.js index c1fe7f6e32e..cbcd306241b 100644 --- a/crates/swc/tests/tsc-references/externalModules/exportAssignmentAndDeclaration/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/externalModules/exportAssignmentAndDeclaration/input.ts/es2015.1.normal/output.js @@ -1,8 +1,8 @@ export var E1; -(function(E11) { - E11[E11["A"] = 0] = "A"; - E11[E11["B"] = 1] = "B"; - E11[E11["C"] = 2] = "C"; +(function(E1) { + E1[E1["A"] = 0] = "A"; + E1[E1["B"] = 1] = "B"; + E1[E1["C"] = 2] = "C"; })(E1 || (E1 = { })); class C1 { diff --git a/crates/swc/tests/tsc-references/externalModules/exportAssignmentAndDeclaration/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/externalModules/exportAssignmentAndDeclaration/input.ts/es2015.2.minified/output.js index cad26995eae..184b73e09f8 100644 --- a/crates/swc/tests/tsc-references/externalModules/exportAssignmentAndDeclaration/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/externalModules/exportAssignmentAndDeclaration/input.ts/es2015.2.minified/output.js @@ -1,4 +1,4 @@ -var E1, E11; -(E11 = E1 || (E1 = { -}))[E11.A = 0] = "A", E11[E11.B = 1] = "B", E11[E11.C = 2] = "C", module.exports = class { +var E1, E1; +(E1 = E1 || (E1 = { +}))[E1.A = 0] = "A", E1[E1.B = 1] = "B", E1[E1.C = 2] = "C", module.exports = class { }; diff --git a/crates/swc/tests/tsc-references/externalModules/exportAssignmentAndDeclaration/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/externalModules/exportAssignmentAndDeclaration/input.ts/es5.1.normal/output.js index e5c115040d5..40eff201b00 100644 --- a/crates/swc/tests/tsc-references/externalModules/exportAssignmentAndDeclaration/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/externalModules/exportAssignmentAndDeclaration/input.ts/es5.1.normal/output.js @@ -4,10 +4,10 @@ function _classCallCheck(instance, Constructor) { } } export var E1; -(function(E11) { - E11[E11["A"] = 0] = "A"; - E11[E11["B"] = 1] = "B"; - E11[E11["C"] = 2] = "C"; +(function(E1) { + E1[E1["A"] = 0] = "A"; + E1[E1["B"] = 1] = "B"; + E1[E1["C"] = 2] = "C"; })(E1 || (E1 = { })); var C1 = function C1() { diff --git a/crates/swc/tests/tsc-references/externalModules/exportAssignmentAndDeclaration/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/externalModules/exportAssignmentAndDeclaration/input.ts/es5.2.minified/output.js index f0b056b1c65..7cb65f08630 100644 --- a/crates/swc/tests/tsc-references/externalModules/exportAssignmentAndDeclaration/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/externalModules/exportAssignmentAndDeclaration/input.ts/es5.2.minified/output.js @@ -1,6 +1,6 @@ -(E11 = E1 || (E1 = { -}))[E11.A = 0] = "A", E11[E11.B = 1] = "B", E11[E11.C = 2] = "C"; -var E1, E11, C1 = function() { +(E1 = E1 || (E1 = { +}))[E1.A = 0] = "A", E1[E1.B = 1] = "B", E1[E1.C = 2] = "C"; +var E1, E1, C1 = function() { "use strict"; !function(instance, Constructor) { if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function"); diff --git a/crates/swc/tests/tsc-references/externalModules/exportAssignmentMergedModule/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/externalModules/exportAssignmentMergedModule/input.ts/es2015.1.normal/output.js index d3806146ffe..d1ad1bba4ba 100644 --- a/crates/swc/tests/tsc-references/externalModules/exportAssignmentMergedModule/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/externalModules/exportAssignmentMergedModule/input.ts/es2015.1.normal/output.js @@ -14,7 +14,7 @@ var Foo; return a2; } Foo2.c = c; - var Test1; + let Test1; (function(Test) { Test.answer = 42; })(Test1 || (Test1 = { diff --git a/crates/swc/tests/tsc-references/externalModules/exportAssignmentMergedModule/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/externalModules/exportAssignmentMergedModule/input.ts/es2015.2.minified/output.js index 83976031769..b321b3d00f4 100644 --- a/crates/swc/tests/tsc-references/externalModules/exportAssignmentMergedModule/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/externalModules/exportAssignmentMergedModule/input.ts/es2015.2.minified/output.js @@ -3,10 +3,11 @@ var Foo, Foo1; })).a = function() { return 5; }, Foo1.b = !0, (function(Foo2) { - var Test; Foo2.c = function(a) { return a; - }, (Test || (Test = { + }; + let Test; + (Test || (Test = { })).answer = 42, Foo2.Test = Test; })(Foo || (Foo = { })), module.exports = Foo; diff --git a/crates/swc/tests/tsc-references/externalModules/exportAssignmentOfExportNamespaceWithDefault/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/externalModules/exportAssignmentOfExportNamespaceWithDefault/input.ts/es2015.1.normal/output.js index 55eb43a507f..a084df570a3 100644 --- a/crates/swc/tests/tsc-references/externalModules/exportAssignmentOfExportNamespaceWithDefault/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/externalModules/exportAssignmentOfExportNamespaceWithDefault/input.ts/es2015.1.normal/output.js @@ -1,7 +1,7 @@ -a(); // @esModuleInterop: true // @target: esnext // @filename: main.ts // @module: commonjs // https://github.com/microsoft/TypeScript/issues/39149 -export { }; +import a from "a"; +a(); diff --git a/crates/swc/tests/tsc-references/externalModules/exportAssignmentOfExportNamespaceWithDefault/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/externalModules/exportAssignmentOfExportNamespaceWithDefault/input.ts/es2015.2.minified/output.js index 1172057ec30..72798234eb2 100644 --- a/crates/swc/tests/tsc-references/externalModules/exportAssignmentOfExportNamespaceWithDefault/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/externalModules/exportAssignmentOfExportNamespaceWithDefault/input.ts/es2015.2.minified/output.js @@ -1,2 +1,2 @@ +import a from "a"; a(); -export { }; diff --git a/crates/swc/tests/tsc-references/externalModules/exportAssignmentOfExportNamespaceWithDefault/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/externalModules/exportAssignmentOfExportNamespaceWithDefault/input.ts/es5.1.normal/output.js index 55eb43a507f..a084df570a3 100644 --- a/crates/swc/tests/tsc-references/externalModules/exportAssignmentOfExportNamespaceWithDefault/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/externalModules/exportAssignmentOfExportNamespaceWithDefault/input.ts/es5.1.normal/output.js @@ -1,7 +1,7 @@ -a(); // @esModuleInterop: true // @target: esnext // @filename: main.ts // @module: commonjs // https://github.com/microsoft/TypeScript/issues/39149 -export { }; +import a from "a"; +a(); diff --git a/crates/swc/tests/tsc-references/externalModules/exportAssignmentOfExportNamespaceWithDefault/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/externalModules/exportAssignmentOfExportNamespaceWithDefault/input.ts/es5.2.minified/output.js index 1172057ec30..72798234eb2 100644 --- a/crates/swc/tests/tsc-references/externalModules/exportAssignmentOfExportNamespaceWithDefault/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/externalModules/exportAssignmentOfExportNamespaceWithDefault/input.ts/es5.2.minified/output.js @@ -1,2 +1,2 @@ +import a from "a"; a(); -export { }; diff --git a/crates/swc/tests/tsc-references/externalModules/exportAssignmentTopLevelEnumdule/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/externalModules/exportAssignmentTopLevelEnumdule/input.ts/es2015.1.normal/output.js index 101d38c9fd8..d354c105eb0 100644 --- a/crates/swc/tests/tsc-references/externalModules/exportAssignmentTopLevelEnumdule/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/externalModules/exportAssignmentTopLevelEnumdule/input.ts/es2015.1.normal/output.js @@ -1,14 +1,14 @@ var // @module: amd // @Filename: foo_0.ts foo; -(function(foo1) { - foo1[foo1["red"] = 0] = "red"; - foo1[foo1["green"] = 1] = "green"; - foo1[foo1["blue"] = 2] = "blue"; +(function(foo) { + foo[foo["red"] = 0] = "red"; + foo[foo["green"] = 1] = "green"; + foo[foo["blue"] = 2] = "blue"; })(foo || (foo = { })); -(function(foo2) { - foo2.answer = 42; +(function(foo) { + foo.answer = 42; })(foo || (foo = { })); module.exports = foo; diff --git a/crates/swc/tests/tsc-references/externalModules/exportAssignmentTopLevelEnumdule/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/externalModules/exportAssignmentTopLevelEnumdule/input.ts/es2015.2.minified/output.js index 575f9611888..bf38a4817ef 100644 --- a/crates/swc/tests/tsc-references/externalModules/exportAssignmentTopLevelEnumdule/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/externalModules/exportAssignmentTopLevelEnumdule/input.ts/es2015.2.minified/output.js @@ -1,6 +1,6 @@ -var foo, color, foo1; -(foo1 = foo || (foo = { -}))[foo1.red = 0] = "red", foo1[foo1.green = 1] = "green", foo1[foo1.blue = 2] = "blue", (foo || (foo = { +var foo, color, foo; +(foo = foo || (foo = { +}))[foo.red = 0] = "red", foo[foo.green = 1] = "green", foo[foo.blue = 2] = "blue", (foo || (foo = { })).answer = 42, module.exports = foo; const foo = require("./foo_0"); color === foo.green && (color = foo.answer); diff --git a/crates/swc/tests/tsc-references/externalModules/exportAssignmentTopLevelEnumdule/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/externalModules/exportAssignmentTopLevelEnumdule/input.ts/es5.1.normal/output.js index 9aea0b50017..a9416d3d7c5 100644 --- a/crates/swc/tests/tsc-references/externalModules/exportAssignmentTopLevelEnumdule/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/externalModules/exportAssignmentTopLevelEnumdule/input.ts/es5.1.normal/output.js @@ -1,14 +1,14 @@ var // @module: amd // @Filename: foo_0.ts foo; -(function(foo1) { - foo1[foo1["red"] = 0] = "red"; - foo1[foo1["green"] = 1] = "green"; - foo1[foo1["blue"] = 2] = "blue"; +(function(foo) { + foo[foo["red"] = 0] = "red"; + foo[foo["green"] = 1] = "green"; + foo[foo["blue"] = 2] = "blue"; })(foo || (foo = { })); -(function(foo2) { - foo2.answer = 42; +(function(foo) { + foo.answer = 42; })(foo || (foo = { })); module.exports = foo; diff --git a/crates/swc/tests/tsc-references/externalModules/exportAssignmentTopLevelEnumdule/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/externalModules/exportAssignmentTopLevelEnumdule/input.ts/es5.2.minified/output.js index f3fe55ca098..7d876c43d62 100644 --- a/crates/swc/tests/tsc-references/externalModules/exportAssignmentTopLevelEnumdule/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/externalModules/exportAssignmentTopLevelEnumdule/input.ts/es5.2.minified/output.js @@ -1,6 +1,6 @@ -(foo = foo1 || (foo1 = { -}))[foo.red = 0] = "red", foo[foo.green = 1] = "green", foo[foo.blue = 2] = "blue", (foo1 || (foo1 = { -})).answer = 42, module.exports = foo1; -var foo, foo1, color, foo1 = require("./foo_0"); -color === foo1.green && (color = foo1.answer); +(foo = foo || (foo = { +}))[foo.red = 0] = "red", foo[foo.green = 1] = "green", foo[foo.blue = 2] = "blue", (foo || (foo = { +})).answer = 42, module.exports = foo; +var foo, foo, color, foo = require("./foo_0"); +color === foo.green && (color = foo.answer); export { }; diff --git a/crates/swc/tests/tsc-references/externalModules/typeOnly/filterNamespace_import/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/externalModules/typeOnly/filterNamespace_import/input.ts/es2015.1.normal/output.js index b1b1a0f7f1f..60ca174968b 100644 --- a/crates/swc/tests/tsc-references/externalModules/typeOnly/filterNamespace_import/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/externalModules/typeOnly/filterNamespace_import/input.ts/es2015.1.normal/output.js @@ -5,7 +5,7 @@ var ns; } ns1.Class = Class; ns1.Value = ""; - var nested1; + let nested1; (function(nested) { class NestedClass { } diff --git a/crates/swc/tests/tsc-references/externalModules/typeOnly/filterNamespace_import/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/externalModules/typeOnly/filterNamespace_import/input.ts/es2015.2.minified/output.js index 8f0ae374c33..e5efbff8c1e 100644 --- a/crates/swc/tests/tsc-references/externalModules/typeOnly/filterNamespace_import/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/externalModules/typeOnly/filterNamespace_import/input.ts/es2015.2.minified/output.js @@ -1,8 +1,9 @@ var ns; !function(ns1) { - var nested; ns1.Class = class { - }, ns1.Value = "", (nested || (nested = { + }, ns1.Value = ""; + let nested; + (nested || (nested = { })).NestedClass = class { }, ns1.nested = nested; }(ns || (ns = { diff --git a/crates/swc/tests/tsc-references/externalModules/typeOnly/importsNotUsedAsValues_error/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/externalModules/typeOnly/importsNotUsedAsValues_error/input.ts/es2015.1.normal/output.js index ba8dd283d5f..5d48c182d01 100644 --- a/crates/swc/tests/tsc-references/externalModules/typeOnly/importsNotUsedAsValues_error/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/externalModules/typeOnly/importsNotUsedAsValues_error/input.ts/es2015.1.normal/output.js @@ -7,9 +7,9 @@ export { _class as default }; export class A { } export var C; -(function(C1) { - C1[C1["One"] = 0] = "One"; - C1[C1["Two"] = 1] = "Two"; +(function(C) { + C[C["One"] = 0] = "One"; + C[C["Two"] = 1] = "Two"; })(C || (C = { })); let a; @@ -41,9 +41,9 @@ console.log(h); const H = require('./h'); // noUnusedLocals error only var // @Filename: /k.ts K; -(function(K1) { - K1[K1["One"] = 0] = "One"; - K1[K1["Two"] = 1] = "Two"; +(function(K) { + K[K["One"] = 0] = "One"; + K[K["Two"] = 1] = "Two"; })(K || (K = { })); module.exports = K; diff --git a/crates/swc/tests/tsc-references/externalModules/typeOnly/importsNotUsedAsValues_error/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/externalModules/typeOnly/importsNotUsedAsValues_error/input.ts/es2015.2.minified/output.js index 3b3ce62dbe9..3841401dd72 100644 --- a/crates/swc/tests/tsc-references/externalModules/typeOnly/importsNotUsedAsValues_error/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/externalModules/typeOnly/importsNotUsedAsValues_error/input.ts/es2015.2.minified/output.js @@ -1,9 +1,9 @@ -var C, K, C1, K1; +var C, K, C, K; export { _class as default }; export class A { } -(C1 = C || (C = { -}))[C1.One = 0] = "One", C1[C1.Two = 1] = "Two"; +(C = C || (C = { +}))[C.One = 0] = "One", C[C.Two = 1] = "Two"; let a, b; console.log(a, b); let a, b; @@ -22,7 +22,7 @@ const H = require("./h"); console.log({ }); const H = require("./h"); -(K1 = K || (K = { -}))[K1.One = 0] = "One", K1[K1.Two = 1] = "Two", module.exports = K; +(K = K || (K = { +}))[K.One = 0] = "One", K[K.Two = 1] = "Two", module.exports = K; const K = require("./k"); K.One; diff --git a/crates/swc/tests/tsc-references/externalModules/typeOnly/importsNotUsedAsValues_error/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/externalModules/typeOnly/importsNotUsedAsValues_error/input.ts/es5.1.normal/output.js index f43ed2e4244..2eb6516ba9c 100644 --- a/crates/swc/tests/tsc-references/externalModules/typeOnly/importsNotUsedAsValues_error/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/externalModules/typeOnly/importsNotUsedAsValues_error/input.ts/es5.1.normal/output.js @@ -16,9 +16,9 @@ export var A = function A() { _classCallCheck(this, A); }; export var C; -(function(C1) { - C1[C1["One"] = 0] = "One"; - C1[C1["Two"] = 1] = "Two"; +(function(C) { + C[C["One"] = 0] = "One"; + C[C["Two"] = 1] = "Two"; })(C || (C = { })); var a; @@ -51,9 +51,9 @@ console.log(h); var H = require('./h'); // noUnusedLocals error only var // @Filename: /k.ts K; -(function(K1) { - K1[K1["One"] = 0] = "One"; - K1[K1["Two"] = 1] = "Two"; +(function(K) { + K[K["One"] = 0] = "One"; + K[K["Two"] = 1] = "Two"; })(K || (K = { })); module.exports = K; diff --git a/crates/swc/tests/tsc-references/externalModules/typeOnly/importsNotUsedAsValues_error/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/externalModules/typeOnly/importsNotUsedAsValues_error/input.ts/es5.2.minified/output.js index 663d6e627ef..10f65329d5d 100644 --- a/crates/swc/tests/tsc-references/externalModules/typeOnly/importsNotUsedAsValues_error/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/externalModules/typeOnly/importsNotUsedAsValues_error/input.ts/es5.2.minified/output.js @@ -10,8 +10,8 @@ export var A = function() { "use strict"; _classCallCheck(this, A); }; -(C1 = C || (C = { -}))[C1.One = 0] = "One", C1[C1.Two = 1] = "Two", console.log(a, b), console.log(a, b); +(C = C || (C = { +}))[C.One = 0] = "One", C[C.Two = 1] = "Two", console.log(a, b), console.log(a, b); var a = A; console.log(a, b), C.One; var c = C.Two, d = C.Two; @@ -21,11 +21,11 @@ var H = function() { _classCallCheck(this, H); }; module.exports = H; -var C1, H = require("./h"); +var C, H = require("./h"); console.log({ }); -var K1, H = require("./h"); -(K1 = K || (K = { -}))[K1.One = 0] = "One", K1[K1.Two = 1] = "Two", module.exports = K; +var K, H = require("./h"); +(K = K || (K = { +}))[K.One = 0] = "One", K[K.Two = 1] = "Two", module.exports = K; var K = require("./k"); K.One; diff --git a/crates/swc/tests/tsc-references/interfaces/declarationMerging/mergeThreeInterfaces2/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/interfaces/declarationMerging/mergeThreeInterfaces2/input.ts/es2015.1.normal/output.js index 5ffe608ce82..09d5bc3e862 100644 --- a/crates/swc/tests/tsc-references/interfaces/declarationMerging/mergeThreeInterfaces2/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/interfaces/declarationMerging/mergeThreeInterfaces2/input.ts/es2015.1.normal/output.js @@ -15,7 +15,7 @@ var M2; })(M2 || (M2 = { })); (function(M21) { - var M3; + let M3; (function(M3) { var a; var r1 = a.foo; @@ -25,7 +25,8 @@ var M2; M21.M3 = M3; })(M2 || (M2 = { })); -(function(M2) { +(function(M22) { + let M3; (function(M3) { var a; var r1 = a.foo; @@ -33,9 +34,11 @@ var M2; var r3 = a.baz; })(M3 || (M3 = { })); + M22.M3 = M3; })(M2 || (M2 = { })); -(function(M2) { +(function(M23) { + let M3; (function(M3) { var a; var r1 = a.foo; @@ -43,5 +46,6 @@ var M2; var r3 = a.baz; })(M3 || (M3 = { })); + M23.M3 = M3; })(M2 || (M2 = { })); diff --git a/crates/swc/tests/tsc-references/interfaces/declarationMerging/mergeThreeInterfaces2/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/interfaces/declarationMerging/mergeThreeInterfaces2/input.ts/es2015.2.minified/output.js index 91681d4d0b5..1625f2a9567 100644 --- a/crates/swc/tests/tsc-references/interfaces/declarationMerging/mergeThreeInterfaces2/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/interfaces/declarationMerging/mergeThreeInterfaces2/input.ts/es2015.2.minified/output.js @@ -8,18 +8,21 @@ var M2; a.foo, a.bar, a.baz; })(M2 || (M2 = { })), (function(M21) { - var M3, a; + var a; + let M3; M3 || (M3 = { }), a.foo, a.bar, M21.M3 = M3; })(M2 || (M2 = { -})), (function(M2) { +})), (function(M22) { var a; + let M3; M3 || (M3 = { - }), a.foo, a.bar, a.baz; + }), a.foo, a.bar, a.baz, M22.M3 = M3; })(M2 || (M2 = { -})), (function(M2) { +})), (function(M23) { var a; + let M3; M3 || (M3 = { - }), a.foo, a.bar, a.baz; + }), a.foo, a.bar, a.baz, M23.M3 = M3; })(M2 || (M2 = { })); diff --git a/crates/swc/tests/tsc-references/interfaces/declarationMerging/mergeThreeInterfaces2/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/interfaces/declarationMerging/mergeThreeInterfaces2/input.ts/es5.1.normal/output.js index 5ffe608ce82..dcf7975bf88 100644 --- a/crates/swc/tests/tsc-references/interfaces/declarationMerging/mergeThreeInterfaces2/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/interfaces/declarationMerging/mergeThreeInterfaces2/input.ts/es5.1.normal/output.js @@ -25,7 +25,8 @@ var M2; M21.M3 = M3; })(M2 || (M2 = { })); -(function(M2) { +(function(M22) { + var M3; (function(M3) { var a; var r1 = a.foo; @@ -33,9 +34,11 @@ var M2; var r3 = a.baz; })(M3 || (M3 = { })); + M22.M3 = M3; })(M2 || (M2 = { })); -(function(M2) { +(function(M23) { + var M3; (function(M3) { var a; var r1 = a.foo; @@ -43,5 +46,6 @@ var M2; var r3 = a.baz; })(M3 || (M3 = { })); + M23.M3 = M3; })(M2 || (M2 = { })); diff --git a/crates/swc/tests/tsc-references/interfaces/declarationMerging/mergeThreeInterfaces2/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/interfaces/declarationMerging/mergeThreeInterfaces2/input.ts/es5.2.minified/output.js index 91681d4d0b5..b84eb9fe1c8 100644 --- a/crates/swc/tests/tsc-references/interfaces/declarationMerging/mergeThreeInterfaces2/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/interfaces/declarationMerging/mergeThreeInterfaces2/input.ts/es5.2.minified/output.js @@ -12,14 +12,14 @@ var M2; M3 || (M3 = { }), a.foo, a.bar, M21.M3 = M3; })(M2 || (M2 = { -})), (function(M2) { - var a; +})), (function(M22) { + var M3, a; M3 || (M3 = { - }), a.foo, a.bar, a.baz; + }), a.foo, a.bar, a.baz, M22.M3 = M3; })(M2 || (M2 = { -})), (function(M2) { - var a; +})), (function(M23) { + var M3, a; M3 || (M3 = { - }), a.foo, a.bar, a.baz; + }), a.foo, a.bar, a.baz, M23.M3 = M3; })(M2 || (M2 = { })); diff --git a/crates/swc/tests/tsc-references/interfaces/declarationMerging/mergeTwoInterfaces2/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/interfaces/declarationMerging/mergeTwoInterfaces2/input.ts/es2015.1.normal/output.js index 4152156b280..589839ce7e9 100644 --- a/crates/swc/tests/tsc-references/interfaces/declarationMerging/mergeTwoInterfaces2/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/interfaces/declarationMerging/mergeTwoInterfaces2/input.ts/es2015.1.normal/output.js @@ -14,7 +14,7 @@ var M2; })(M2 || (M2 = { })); (function(M21) { - var M3; + let M3; (function(M3) { var a; var r1 = a.foo; @@ -24,12 +24,14 @@ var M2; M21.M3 = M3; })(M2 || (M2 = { })); -(function(M2) { +(function(M22) { + let M3; (function(M3) { var a; var r1 = a.foo; var r2 = a.bar; })(M3 || (M3 = { })); + M22.M3 = M3; })(M2 || (M2 = { })); diff --git a/crates/swc/tests/tsc-references/interfaces/declarationMerging/mergeTwoInterfaces2/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/interfaces/declarationMerging/mergeTwoInterfaces2/input.ts/es2015.2.minified/output.js index 28f7b45defb..79b316d745e 100644 --- a/crates/swc/tests/tsc-references/interfaces/declarationMerging/mergeTwoInterfaces2/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/interfaces/declarationMerging/mergeTwoInterfaces2/input.ts/es2015.2.minified/output.js @@ -8,13 +8,15 @@ var M2; a.foo, a.bar; })(M2 || (M2 = { })), (function(M21) { - var M3, a; + var a; + let M3; M3 || (M3 = { }), a.foo, a.bar, M21.M3 = M3; })(M2 || (M2 = { -})), (function(M2) { +})), (function(M22) { var a; + let M3; M3 || (M3 = { - }), a.foo, a.bar; + }), a.foo, a.bar, M22.M3 = M3; })(M2 || (M2 = { })); diff --git a/crates/swc/tests/tsc-references/interfaces/declarationMerging/mergeTwoInterfaces2/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/interfaces/declarationMerging/mergeTwoInterfaces2/input.ts/es5.1.normal/output.js index 4152156b280..e68af4f6f58 100644 --- a/crates/swc/tests/tsc-references/interfaces/declarationMerging/mergeTwoInterfaces2/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/interfaces/declarationMerging/mergeTwoInterfaces2/input.ts/es5.1.normal/output.js @@ -24,12 +24,14 @@ var M2; M21.M3 = M3; })(M2 || (M2 = { })); -(function(M2) { +(function(M22) { + var M3; (function(M3) { var a; var r1 = a.foo; var r2 = a.bar; })(M3 || (M3 = { })); + M22.M3 = M3; })(M2 || (M2 = { })); diff --git a/crates/swc/tests/tsc-references/interfaces/declarationMerging/mergeTwoInterfaces2/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/interfaces/declarationMerging/mergeTwoInterfaces2/input.ts/es5.2.minified/output.js index 28f7b45defb..b48a145fb08 100644 --- a/crates/swc/tests/tsc-references/interfaces/declarationMerging/mergeTwoInterfaces2/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/interfaces/declarationMerging/mergeTwoInterfaces2/input.ts/es5.2.minified/output.js @@ -12,9 +12,9 @@ var M2; M3 || (M3 = { }), a.foo, a.bar, M21.M3 = M3; })(M2 || (M2 = { -})), (function(M2) { - var a; +})), (function(M22) { + var M3, a; M3 || (M3 = { - }), a.foo, a.bar; + }), a.foo, a.bar, M22.M3 = M3; })(M2 || (M2 = { })); diff --git a/crates/swc/tests/tsc-references/interfaces/declarationMerging/twoInterfacesDifferentRootModule2/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/interfaces/declarationMerging/twoInterfacesDifferentRootModule2/input.ts/es2015.1.normal/output.js index 1032cff08d7..80fa3d19186 100644 --- a/crates/swc/tests/tsc-references/interfaces/declarationMerging/twoInterfacesDifferentRootModule2/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/interfaces/declarationMerging/twoInterfacesDifferentRootModule2/input.ts/es2015.1.normal/output.js @@ -1,7 +1,7 @@ // two interfaces with different root modules should not merge var M; (function(M) { - var M2; + let M2; (function(M2) { var a; var r1 = a.foo; // error diff --git a/crates/swc/tests/tsc-references/interfaces/declarationMerging/twoInterfacesDifferentRootModule2/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/interfaces/declarationMerging/twoInterfacesDifferentRootModule2/input.ts/es2015.2.minified/output.js index ad91e3d6296..d49c0c28c02 100644 --- a/crates/swc/tests/tsc-references/interfaces/declarationMerging/twoInterfacesDifferentRootModule2/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/interfaces/declarationMerging/twoInterfacesDifferentRootModule2/input.ts/es2015.2.minified/output.js @@ -1,6 +1,7 @@ var M; !function(M) { - var a, b, M2, a1, b1; + var a, b, a1, b1; + let M2; M2 || (M2 = { }), a.foo, a.bar, b.foo, b.bar, a1.foo, a1.bar, b1.foo, b1.bar; }(M || (M = { diff --git a/crates/swc/tests/tsc-references/interfaces/interfaceDeclarations/interfaceExtendsObjectIntersection/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/interfaces/interfaceDeclarations/interfaceExtendsObjectIntersection/input.ts/es2015.1.normal/output.js index bef31f87307..7d3b45cbf06 100644 --- a/crates/swc/tests/tsc-references/interfaces/interfaceDeclarations/interfaceExtendsObjectIntersection/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/interfaces/interfaceDeclarations/interfaceExtendsObjectIntersection/input.ts/es2015.1.normal/output.js @@ -13,10 +13,10 @@ class C6 extends Constructor() { class C7 extends Constructor() { } var EX; -(function(EX1) { - EX1[EX1["A"] = 0] = "A"; - EX1[EX1["B"] = 1] = "B"; - EX1[EX1["C"] = 2] = "C"; +(function(EX) { + EX[EX["A"] = 0] = "A"; + EX[EX["B"] = 1] = "B"; + EX[EX["C"] = 2] = "C"; })(EX || (EX = { })); class C20 extends Constructor() { diff --git a/crates/swc/tests/tsc-references/interfaces/interfaceDeclarations/interfaceExtendsObjectIntersection/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/interfaces/interfaceDeclarations/interfaceExtendsObjectIntersection/input.ts/es2015.2.minified/output.js index d7089e0effc..31f4966c71b 100644 --- a/crates/swc/tests/tsc-references/interfaces/interfaceDeclarations/interfaceExtendsObjectIntersection/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/interfaces/interfaceDeclarations/interfaceExtendsObjectIntersection/input.ts/es2015.2.minified/output.js @@ -1,4 +1,4 @@ -var EX, EX1; +var EX, EX; class C1 extends Constructor() { } class C2 extends Constructor() { @@ -13,8 +13,8 @@ class C6 extends Constructor() { } class C7 extends Constructor() { } -(EX1 = EX || (EX = { -}))[EX1.A = 0] = "A", EX1[EX1.B = 1] = "B", EX1[EX1.C = 2] = "C"; +(EX = EX || (EX = { +}))[EX.A = 0] = "A", EX[EX.B = 1] = "B", EX[EX.C = 2] = "C"; class C20 extends Constructor() { } class C21 extends Constructor() { diff --git a/crates/swc/tests/tsc-references/interfaces/interfaceDeclarations/interfaceExtendsObjectIntersection/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/interfaces/interfaceDeclarations/interfaceExtendsObjectIntersection/input.ts/es5.1.normal/output.js index 99f1fc6873b..c79c815eba5 100644 --- a/crates/swc/tests/tsc-references/interfaces/interfaceDeclarations/interfaceExtendsObjectIntersection/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/interfaces/interfaceDeclarations/interfaceExtendsObjectIntersection/input.ts/es5.1.normal/output.js @@ -140,10 +140,10 @@ var C7 = /*#__PURE__*/ function(_super) { return C7; }(Constructor()); var EX; -(function(EX1) { - EX1[EX1["A"] = 0] = "A"; - EX1[EX1["B"] = 1] = "B"; - EX1[EX1["C"] = 2] = "C"; +(function(EX) { + EX[EX["A"] = 0] = "A"; + EX[EX["B"] = 1] = "B"; + EX[EX["C"] = 2] = "C"; })(EX || (EX = { })); var C20 = /*#__PURE__*/ function(_super) { diff --git a/crates/swc/tests/tsc-references/interfaces/interfaceDeclarations/interfaceExtendsObjectIntersection/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/interfaces/interfaceDeclarations/interfaceExtendsObjectIntersection/input.ts/es5.2.minified/output.js index ac863e5db3a..53075c11889 100644 --- a/crates/swc/tests/tsc-references/interfaces/interfaceDeclarations/interfaceExtendsObjectIntersection/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/interfaces/interfaceDeclarations/interfaceExtendsObjectIntersection/input.ts/es5.2.minified/output.js @@ -45,7 +45,7 @@ function _createSuper(Derived) { })(self); }; } -var EX, EX1, C1 = function(_super) { +var EX, EX, C1 = function(_super) { "use strict"; _inherits(C1, _super); var _super1 = _createSuper(C1); @@ -102,8 +102,8 @@ var EX, EX1, C1 = function(_super) { } return C7; }(Constructor()); -(EX1 = EX || (EX = { -}))[EX1.A = 0] = "A", EX1[EX1.B = 1] = "B", EX1[EX1.C = 2] = "C"; +(EX = EX || (EX = { +}))[EX.A = 0] = "A", EX[EX.B = 1] = "B", EX[EX.C = 2] = "C"; var C20 = function(_super) { "use strict"; _inherits(C20, _super); diff --git a/crates/swc/tests/tsc-references/interfaces/interfaceDeclarations/interfaceExtendsObjectIntersectionErrors/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/interfaces/interfaceDeclarations/interfaceExtendsObjectIntersectionErrors/input.ts/es2015.1.normal/output.js index 1f09dd196dc..b5288c9a607 100644 --- a/crates/swc/tests/tsc-references/interfaces/interfaceDeclarations/interfaceExtendsObjectIntersectionErrors/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/interfaces/interfaceDeclarations/interfaceExtendsObjectIntersectionErrors/input.ts/es2015.1.normal/output.js @@ -9,9 +9,9 @@ class C4 extends Constructor() { class C5 extends Constructor() { } var EX; -(function(EX1) { - EX1[EX1["A"] = 0] = "A"; - EX1[EX1["B"] = 1] = "B"; - EX1[EX1["C"] = 2] = "C"; +(function(EX) { + EX[EX["A"] = 0] = "A"; + EX[EX["B"] = 1] = "B"; + EX[EX["C"] = 2] = "C"; })(EX || (EX = { })); diff --git a/crates/swc/tests/tsc-references/interfaces/interfaceDeclarations/interfaceExtendsObjectIntersectionErrors/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/interfaces/interfaceDeclarations/interfaceExtendsObjectIntersectionErrors/input.ts/es2015.2.minified/output.js index a039af0c580..166de463ac1 100644 --- a/crates/swc/tests/tsc-references/interfaces/interfaceDeclarations/interfaceExtendsObjectIntersectionErrors/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/interfaces/interfaceDeclarations/interfaceExtendsObjectIntersectionErrors/input.ts/es2015.2.minified/output.js @@ -1,4 +1,4 @@ -var EX, EX1; +var EX, EX; class C1 extends Constructor() { } class C2 extends Constructor() { @@ -9,5 +9,5 @@ class C4 extends Constructor() { } class C5 extends Constructor() { } -(EX1 = EX || (EX = { -}))[EX1.A = 0] = "A", EX1[EX1.B = 1] = "B", EX1[EX1.C = 2] = "C"; +(EX = EX || (EX = { +}))[EX.A = 0] = "A", EX[EX.B = 1] = "B", EX[EX.C = 2] = "C"; diff --git a/crates/swc/tests/tsc-references/interfaces/interfaceDeclarations/interfaceExtendsObjectIntersectionErrors/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/interfaces/interfaceDeclarations/interfaceExtendsObjectIntersectionErrors/input.ts/es5.1.normal/output.js index b8ced6ab123..abd9100769d 100644 --- a/crates/swc/tests/tsc-references/interfaces/interfaceDeclarations/interfaceExtendsObjectIntersectionErrors/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/interfaces/interfaceDeclarations/interfaceExtendsObjectIntersectionErrors/input.ts/es5.1.normal/output.js @@ -120,9 +120,9 @@ var C5 = /*#__PURE__*/ function(_super) { return C5; }(Constructor()); var EX; -(function(EX1) { - EX1[EX1["A"] = 0] = "A"; - EX1[EX1["B"] = 1] = "B"; - EX1[EX1["C"] = 2] = "C"; +(function(EX) { + EX[EX["A"] = 0] = "A"; + EX[EX["B"] = 1] = "B"; + EX[EX["C"] = 2] = "C"; })(EX || (EX = { })); diff --git a/crates/swc/tests/tsc-references/interfaces/interfaceDeclarations/interfaceExtendsObjectIntersectionErrors/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/interfaces/interfaceDeclarations/interfaceExtendsObjectIntersectionErrors/input.ts/es5.2.minified/output.js index a41cc75e73a..7e6c497b771 100644 --- a/crates/swc/tests/tsc-references/interfaces/interfaceDeclarations/interfaceExtendsObjectIntersectionErrors/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/interfaces/interfaceDeclarations/interfaceExtendsObjectIntersectionErrors/input.ts/es5.2.minified/output.js @@ -45,7 +45,7 @@ function _createSuper(Derived) { })(self); }; } -var EX, EX1, C1 = function(_super) { +var EX, EX, C1 = function(_super) { "use strict"; _inherits(C1, _super); var _super1 = _createSuper(C1); @@ -86,5 +86,5 @@ var EX, EX1, C1 = function(_super) { } return C5; }(Constructor()); -(EX1 = EX || (EX = { -}))[EX1.A = 0] = "A", EX1[EX1.B = 1] = "B", EX1[EX1.C = 2] = "C"; +(EX = EX || (EX = { +}))[EX.A = 0] = "A", EX[EX.B = 1] = "B", EX[EX.C = 2] = "C"; diff --git a/crates/swc/tests/tsc-references/interfaces/interfaceDeclarations/interfaceWithPropertyOfEveryType/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/interfaces/interfaceDeclarations/interfaceWithPropertyOfEveryType/input.ts/es2015.1.normal/output.js index 50e4c5b92ff..5642e8706ef 100644 --- a/crates/swc/tests/tsc-references/interfaces/interfaceDeclarations/interfaceWithPropertyOfEveryType/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/interfaces/interfaceDeclarations/interfaceWithPropertyOfEveryType/input.ts/es2015.1.normal/output.js @@ -8,8 +8,8 @@ var M; })(M || (M = { })); var E; -(function(E1) { - E1[E1["A"] = 0] = "A"; +(function(E) { + E[E["A"] = 0] = "A"; })(E || (E = { })); var a = { diff --git a/crates/swc/tests/tsc-references/interfaces/interfaceDeclarations/interfaceWithPropertyOfEveryType/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/interfaces/interfaceDeclarations/interfaceWithPropertyOfEveryType/input.ts/es2015.2.minified/output.js index 377c1a8b41a..81fb85e7029 100644 --- a/crates/swc/tests/tsc-references/interfaces/interfaceDeclarations/interfaceWithPropertyOfEveryType/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/interfaces/interfaceDeclarations/interfaceWithPropertyOfEveryType/input.ts/es2015.2.minified/output.js @@ -1,5 +1,5 @@ -var E, M, E1; +var E, M, E; (M || (M = { -})).y = 1, (E = E1 || (E1 = { +})).y = 1, (E = E || (E = { }))[E.A = 0] = "A", new class { -}(), E1.A; +}(), E.A; diff --git a/crates/swc/tests/tsc-references/interfaces/interfaceDeclarations/interfaceWithPropertyOfEveryType/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/interfaces/interfaceDeclarations/interfaceWithPropertyOfEveryType/input.ts/es5.1.normal/output.js index 2d950f76574..93583973a44 100644 --- a/crates/swc/tests/tsc-references/interfaces/interfaceDeclarations/interfaceWithPropertyOfEveryType/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/interfaces/interfaceDeclarations/interfaceWithPropertyOfEveryType/input.ts/es5.1.normal/output.js @@ -15,8 +15,8 @@ var M; })(M || (M = { })); var E; -(function(E1) { - E1[E1["A"] = 0] = "A"; +(function(E) { + E[E["A"] = 0] = "A"; })(E || (E = { })); var a = { diff --git a/crates/swc/tests/tsc-references/interfaces/interfaceDeclarations/interfaceWithPropertyOfEveryType/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/interfaces/interfaceDeclarations/interfaceWithPropertyOfEveryType/input.ts/es5.2.minified/output.js index 82836c6f8a5..caf96ad584e 100644 --- a/crates/swc/tests/tsc-references/interfaces/interfaceDeclarations/interfaceWithPropertyOfEveryType/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/interfaces/interfaceDeclarations/interfaceWithPropertyOfEveryType/input.ts/es5.2.minified/output.js @@ -1,9 +1,9 @@ -var E, M, E1, C = function() { +var E, M, E, C = function() { "use strict"; !function(instance, Constructor) { if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function"); }(this, C); }; (M || (M = { -})).y = 1, (E = E1 || (E1 = { -}))[E.A = 0] = "A", new C(), E1.A; +})).y = 1, (E = E || (E = { +}))[E.A = 0] = "A", new C(), E.A; diff --git a/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/EnumAndModuleWithSameNameAndCommonRoot/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/EnumAndModuleWithSameNameAndCommonRoot/input.ts/es2015.1.normal/output.js index 17917c4212a..e9c8d7bff52 100644 --- a/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/EnumAndModuleWithSameNameAndCommonRoot/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/EnumAndModuleWithSameNameAndCommonRoot/input.ts/es2015.1.normal/output.js @@ -1,17 +1,17 @@ var enumdule; -(function(enumdule1) { - enumdule1[enumdule1["Red"] = 0] = "Red"; - enumdule1[enumdule1["Blue"] = 1] = "Blue"; +(function(enumdule) { + enumdule[enumdule["Red"] = 0] = "Red"; + enumdule[enumdule["Blue"] = 1] = "Blue"; })(enumdule || (enumdule = { })); -(function(enumdule2) { +(function(enumdule) { class Point { constructor(x1, y1){ this.x = x1; this.y = y1; } } - enumdule2.Point = Point; + enumdule.Point = Point; })(enumdule || (enumdule = { })); var x; diff --git a/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/EnumAndModuleWithSameNameAndCommonRoot/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/EnumAndModuleWithSameNameAndCommonRoot/input.ts/es2015.2.minified/output.js index 9298fdbd858..e7cd0c3198e 100644 --- a/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/EnumAndModuleWithSameNameAndCommonRoot/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/EnumAndModuleWithSameNameAndCommonRoot/input.ts/es2015.2.minified/output.js @@ -1,8 +1,8 @@ -var enumdule, enumdule1; -(enumdule = enumdule1 || (enumdule1 = { -}))[enumdule.Red = 0] = "Red", enumdule[enumdule.Blue = 1] = "Blue", (enumdule1 || (enumdule1 = { +var enumdule, enumdule; +(enumdule = enumdule || (enumdule = { +}))[enumdule.Red = 0] = "Red", enumdule[enumdule.Blue = 1] = "Blue", (enumdule || (enumdule = { })).Point = class { constructor(x, y){ this.x = x, this.y = y; } -}, enumdule1.Red, new enumdule1.Point(0, 0); +}, enumdule.Red, new enumdule.Point(0, 0); diff --git a/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/EnumAndModuleWithSameNameAndCommonRoot/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/EnumAndModuleWithSameNameAndCommonRoot/input.ts/es5.1.normal/output.js index ee2d0b54dbb..9962a3cf0f0 100644 --- a/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/EnumAndModuleWithSameNameAndCommonRoot/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/EnumAndModuleWithSameNameAndCommonRoot/input.ts/es5.1.normal/output.js @@ -4,19 +4,19 @@ function _classCallCheck(instance, Constructor) { } } var enumdule; -(function(enumdule1) { - enumdule1[enumdule1["Red"] = 0] = "Red"; - enumdule1[enumdule1["Blue"] = 1] = "Blue"; +(function(enumdule) { + enumdule[enumdule["Red"] = 0] = "Red"; + enumdule[enumdule["Blue"] = 1] = "Blue"; })(enumdule || (enumdule = { })); -(function(enumdule2) { +(function(enumdule) { var Point = function Point(x1, y1) { "use strict"; _classCallCheck(this, Point); this.x = x1; this.y = y1; }; - enumdule2.Point = Point; + enumdule.Point = Point; })(enumdule || (enumdule = { })); var x; diff --git a/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/EnumAndModuleWithSameNameAndCommonRoot/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/EnumAndModuleWithSameNameAndCommonRoot/input.ts/es5.2.minified/output.js index 11b3c63c9f1..d6c3787488a 100644 --- a/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/EnumAndModuleWithSameNameAndCommonRoot/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/EnumAndModuleWithSameNameAndCommonRoot/input.ts/es5.2.minified/output.js @@ -1,12 +1,12 @@ -var enumdule, enumdule1; -(enumdule = enumdule1 || (enumdule1 = { -}))[enumdule.Red = 0] = "Red", enumdule[enumdule.Blue = 1] = "Blue", (function(enumdule2) { +var enumdule, enumdule; +(enumdule = enumdule || (enumdule = { +}))[enumdule.Red = 0] = "Red", enumdule[enumdule.Blue = 1] = "Blue", (function(enumdule1) { var Point = function(x, y) { "use strict"; (function(instance, Constructor) { if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function"); })(this, Point), this.x = x, this.y = y; }; - enumdule2.Point = Point; -})(enumdule1 || (enumdule1 = { -})), enumdule1.Red, new enumdule1.Point(0, 0); + enumdule1.Point = Point; +})(enumdule || (enumdule = { +})), enumdule.Red, new enumdule.Point(0, 0); diff --git a/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/FunctionAndModuleWithSameNameAndCommonRoot/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/FunctionAndModuleWithSameNameAndCommonRoot/input.ts/es2015.1.normal/output.js index 05427ac4485..3452dcaf729 100644 --- a/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/FunctionAndModuleWithSameNameAndCommonRoot/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/FunctionAndModuleWithSameNameAndCommonRoot/input.ts/es2015.1.normal/output.js @@ -10,14 +10,16 @@ var A; A1.Point = Point; })(A || (A = { })); -(function(A) { +(function(A2) { + let Point1; (function(Point) { Point.Origin = { x: 0, y: 0 }; - })(Point || (Point = { + })(Point1 || (Point1 = { })); + A2.Point = Point1; })(A || (A = { })); // @filename: test.ts @@ -29,19 +31,19 @@ var cl = A.Point.Origin; // not expected to be an error. // @filename: simple.ts var B; (function(B1) { - function Point1() { + function Point2() { return { x: 0, y: 0 }; } - B1.Point = Point1; + B1.Point = Point2; (function(Point) { Point.Origin = { x: 0, y: 0 }; - })(Point1 || (Point1 = { + })(Point2 || (Point2 = { })); })(B || (B = { })); diff --git a/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/FunctionAndModuleWithSameNameAndCommonRoot/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/FunctionAndModuleWithSameNameAndCommonRoot/input.ts/es2015.2.minified/output.js index e030d31949a..9630c5764c9 100644 --- a/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/FunctionAndModuleWithSameNameAndCommonRoot/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/FunctionAndModuleWithSameNameAndCommonRoot/input.ts/es2015.2.minified/output.js @@ -5,12 +5,15 @@ var A, B; x: 0, y: 0 }; -}, A || (A = { -}), (Point || (Point = { -})).Origin = { - x: 0, - y: 0 -}, A.Point, A.Point(), A.Point.Origin, (function(B1) { +}, (function(A1) { + let Point; + (Point || (Point = { + })).Origin = { + x: 0, + y: 0 + }, A1.Point = Point; +})(A || (A = { +})), A.Point, A.Point(), A.Point.Origin, (function(B1) { function Point() { return { x: 0, diff --git a/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/FunctionAndModuleWithSameNameAndCommonRoot/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/FunctionAndModuleWithSameNameAndCommonRoot/input.ts/es5.1.normal/output.js index 89e33a0adfb..169e002e4d3 100644 --- a/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/FunctionAndModuleWithSameNameAndCommonRoot/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/FunctionAndModuleWithSameNameAndCommonRoot/input.ts/es5.1.normal/output.js @@ -10,14 +10,16 @@ var A; A1.Point = Point; })(A || (A = { })); -(function(A) { +(function(A2) { + var Point1; (function(Point) { Point.Origin = { x: 0, y: 0 }; - })(Point || (Point = { + })(Point1 || (Point1 = { })); + A2.Point = Point1; })(A || (A = { })); // @filename: test.ts diff --git a/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/FunctionAndModuleWithSameNameAndCommonRoot/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/FunctionAndModuleWithSameNameAndCommonRoot/input.ts/es5.2.minified/output.js index 75daf6f3dcb..850c912385b 100644 --- a/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/FunctionAndModuleWithSameNameAndCommonRoot/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/FunctionAndModuleWithSameNameAndCommonRoot/input.ts/es5.2.minified/output.js @@ -5,12 +5,15 @@ var A, B; x: 0, y: 0 }; -}, A || (A = { -}), (Point || (Point = { -})).Origin = { - x: 0, - y: 0 -}, A.Point, A.Point(), A.Point.Origin, (function(B1) { +}, (function(A1) { + var Point; + (Point || (Point = { + })).Origin = { + x: 0, + y: 0 + }, A1.Point = Point; +})(A || (A = { +})), A.Point, A.Point(), A.Point.Origin, (function(B1) { var Point = function() { return { x: 0, diff --git a/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/FunctionAndModuleWithSameNameAndDifferentCommonRoot/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/FunctionAndModuleWithSameNameAndDifferentCommonRoot/input.ts/es2015.1.normal/output.js index f571ae5fbed..ca3c286a0d0 100644 --- a/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/FunctionAndModuleWithSameNameAndDifferentCommonRoot/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/FunctionAndModuleWithSameNameAndDifferentCommonRoot/input.ts/es2015.1.normal/output.js @@ -12,14 +12,16 @@ var A; })); // @filename: module.ts var B; -(function(B) { +(function(B1) { + let Point1; (function(Point) { Point.Origin = { x: 0, y: 0 }; - })(Point || (Point = { + })(Point1 || (Point1 = { })); + B1.Point = Point1; })(B || (B = { })); // @filename: test.ts diff --git a/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/FunctionAndModuleWithSameNameAndDifferentCommonRoot/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/FunctionAndModuleWithSameNameAndDifferentCommonRoot/input.ts/es2015.2.minified/output.js index 288f0d417b4..86b637ce8ed 100644 --- a/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/FunctionAndModuleWithSameNameAndDifferentCommonRoot/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/FunctionAndModuleWithSameNameAndDifferentCommonRoot/input.ts/es2015.2.minified/output.js @@ -5,9 +5,12 @@ var A, B; x: 0, y: 0 }; -}, B || (B = { -}), (Point || (Point = { -})).Origin = { - x: 0, - y: 0 -}, A.Point, B.Point.Origin; +}, (function(B1) { + let Point; + (Point || (Point = { + })).Origin = { + x: 0, + y: 0 + }, B1.Point = Point; +})(B || (B = { +})), A.Point, B.Point.Origin; diff --git a/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/FunctionAndModuleWithSameNameAndDifferentCommonRoot/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/FunctionAndModuleWithSameNameAndDifferentCommonRoot/input.ts/es5.1.normal/output.js index ac2a014a5fe..ac458baaa49 100644 --- a/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/FunctionAndModuleWithSameNameAndDifferentCommonRoot/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/FunctionAndModuleWithSameNameAndDifferentCommonRoot/input.ts/es5.1.normal/output.js @@ -12,14 +12,16 @@ var A; })); // @filename: module.ts var B; -(function(B) { +(function(B1) { + var Point1; (function(Point) { Point.Origin = { x: 0, y: 0 }; - })(Point || (Point = { + })(Point1 || (Point1 = { })); + B1.Point = Point1; })(B || (B = { })); // @filename: test.ts diff --git a/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/FunctionAndModuleWithSameNameAndDifferentCommonRoot/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/FunctionAndModuleWithSameNameAndDifferentCommonRoot/input.ts/es5.2.minified/output.js index 288f0d417b4..f9ace49bc4e 100644 --- a/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/FunctionAndModuleWithSameNameAndDifferentCommonRoot/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/FunctionAndModuleWithSameNameAndDifferentCommonRoot/input.ts/es5.2.minified/output.js @@ -5,9 +5,12 @@ var A, B; x: 0, y: 0 }; -}, B || (B = { -}), (Point || (Point = { -})).Origin = { - x: 0, - y: 0 -}, A.Point, B.Point.Origin; +}, (function(B1) { + var Point; + (Point || (Point = { + })).Origin = { + x: 0, + y: 0 + }, B1.Point = Point; +})(B || (B = { +})), A.Point, B.Point.Origin; diff --git a/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/ModuleAndEnumWithSameNameAndCommonRoot/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/ModuleAndEnumWithSameNameAndCommonRoot/input.ts/es2015.1.normal/output.js index fdc5f47eed2..729f995a910 100644 --- a/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/ModuleAndEnumWithSameNameAndCommonRoot/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/ModuleAndEnumWithSameNameAndCommonRoot/input.ts/es2015.1.normal/output.js @@ -9,9 +9,9 @@ var enumdule; enumdule1.Point = Point; })(enumdule || (enumdule = { })); -(function(enumdule2) { - enumdule2[enumdule2["Red"] = 0] = "Red"; - enumdule2[enumdule2["Blue"] = 1] = "Blue"; +(function(enumdule) { + enumdule[enumdule["Red"] = 0] = "Red"; + enumdule[enumdule["Blue"] = 1] = "Blue"; })(enumdule || (enumdule = { })); var x; diff --git a/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/ModuleAndEnumWithSameNameAndCommonRoot/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/ModuleAndEnumWithSameNameAndCommonRoot/input.ts/es2015.2.minified/output.js index fa0d71f6a24..ab7314b13c4 100644 --- a/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/ModuleAndEnumWithSameNameAndCommonRoot/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/ModuleAndEnumWithSameNameAndCommonRoot/input.ts/es2015.2.minified/output.js @@ -1,8 +1,8 @@ -var enumdule, enumdule1; -(enumdule1 || (enumdule1 = { +var enumdule, enumdule; +(enumdule || (enumdule = { })).Point = class { constructor(x, y){ this.x = x, this.y = y; } -}, (enumdule = enumdule1 || (enumdule1 = { -}))[enumdule.Red = 0] = "Red", enumdule[enumdule.Blue = 1] = "Blue", enumdule1.Red, new enumdule1.Point(0, 0); +}, (enumdule = enumdule || (enumdule = { +}))[enumdule.Red = 0] = "Red", enumdule[enumdule.Blue = 1] = "Blue", enumdule.Red, new enumdule.Point(0, 0); diff --git a/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/ModuleAndEnumWithSameNameAndCommonRoot/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/ModuleAndEnumWithSameNameAndCommonRoot/input.ts/es5.1.normal/output.js index ad2c60ac432..9a372d3448c 100644 --- a/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/ModuleAndEnumWithSameNameAndCommonRoot/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/ModuleAndEnumWithSameNameAndCommonRoot/input.ts/es5.1.normal/output.js @@ -14,9 +14,9 @@ var enumdule; enumdule1.Point = Point; })(enumdule || (enumdule = { })); -(function(enumdule2) { - enumdule2[enumdule2["Red"] = 0] = "Red"; - enumdule2[enumdule2["Blue"] = 1] = "Blue"; +(function(enumdule) { + enumdule[enumdule["Red"] = 0] = "Red"; + enumdule[enumdule["Blue"] = 1] = "Blue"; })(enumdule || (enumdule = { })); var x; diff --git a/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/ModuleAndEnumWithSameNameAndCommonRoot/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/ModuleAndEnumWithSameNameAndCommonRoot/input.ts/es5.2.minified/output.js index b32194c6795..85d655d348d 100644 --- a/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/ModuleAndEnumWithSameNameAndCommonRoot/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/ModuleAndEnumWithSameNameAndCommonRoot/input.ts/es5.2.minified/output.js @@ -1,12 +1,12 @@ -var enumdule, enumdule1; -!function(enumdule2) { +var enumdule, enumdule; +!function(enumdule1) { var Point = function(x, y) { "use strict"; (function(instance, Constructor) { if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function"); })(this, Point), this.x = x, this.y = y; }; - enumdule2.Point = Point; -}(enumdule1 || (enumdule1 = { -})), (enumdule = enumdule1 || (enumdule1 = { -}))[enumdule.Red = 0] = "Red", enumdule[enumdule.Blue = 1] = "Blue", enumdule1.Red, new enumdule1.Point(0, 0); + enumdule1.Point = Point; +}(enumdule || (enumdule = { +})), (enumdule = enumdule || (enumdule = { +}))[enumdule.Red = 0] = "Red", enumdule[enumdule.Blue = 1] = "Blue", enumdule.Red, new enumdule.Point(0, 0); diff --git a/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/ModuleAndFunctionWithSameNameAndCommonRoot/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/ModuleAndFunctionWithSameNameAndCommonRoot/input.ts/es2015.1.normal/output.js index 39990a3abc8..bb43ca86232 100644 --- a/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/ModuleAndFunctionWithSameNameAndCommonRoot/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/ModuleAndFunctionWithSameNameAndCommonRoot/input.ts/es2015.1.normal/output.js @@ -1,23 +1,25 @@ // @filename: module.ts var A; -(function(A) { +(function(A1) { + let Point1; (function(Point) { Point.Origin = { x: 0, y: 0 }; - })(Point || (Point = { + })(Point1 || (Point1 = { })); + A1.Point = Point1; })(A || (A = { })); -(function(A1) { +(function(A2) { function Point() { return { x: 0, y: 0 }; } - A1.Point = Point; + A2.Point = Point; })(A || (A = { })); // @filename: simple.ts @@ -28,14 +30,14 @@ var B; x: 0, y: 0 }; - })(Point1 || (Point1 = { + })(Point2 || (Point2 = { })); - function Point1() { + function Point2() { return { x: 0, y: 0 }; } - B1.Point = Point1; + B1.Point = Point2; })(B || (B = { })); diff --git a/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/ModuleAndFunctionWithSameNameAndCommonRoot/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/ModuleAndFunctionWithSameNameAndCommonRoot/input.ts/es2015.2.minified/output.js index cd927dff3cf..eab6c9d55ba 100644 --- a/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/ModuleAndFunctionWithSameNameAndCommonRoot/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/ModuleAndFunctionWithSameNameAndCommonRoot/input.ts/es2015.2.minified/output.js @@ -1,10 +1,13 @@ var A, B; -A || (A = { -}), (Point || (Point = { -})).Origin = { - x: 0, - y: 0 -}, (A || (A = { +!function(A1) { + let Point; + (Point || (Point = { + })).Origin = { + x: 0, + y: 0 + }, A1.Point = Point; +}(A || (A = { +})), (A || (A = { })).Point = function() { return { x: 0, diff --git a/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/ModuleAndFunctionWithSameNameAndCommonRoot/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/ModuleAndFunctionWithSameNameAndCommonRoot/input.ts/es5.1.normal/output.js index 257734910e8..1a415c56477 100644 --- a/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/ModuleAndFunctionWithSameNameAndCommonRoot/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/ModuleAndFunctionWithSameNameAndCommonRoot/input.ts/es5.1.normal/output.js @@ -1,23 +1,25 @@ // @filename: module.ts var A; -(function(A) { +(function(A1) { + var Point1; (function(Point) { Point.Origin = { x: 0, y: 0 }; - })(Point || (Point = { + })(Point1 || (Point1 = { })); + A1.Point = Point1; })(A || (A = { })); -(function(A1) { +(function(A2) { var Point = function Point() { return { x: 0, y: 0 }; }; - A1.Point = Point; + A2.Point = Point; })(A || (A = { })); // @filename: simple.ts diff --git a/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/ModuleAndFunctionWithSameNameAndCommonRoot/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/ModuleAndFunctionWithSameNameAndCommonRoot/input.ts/es5.2.minified/output.js index 2ef03836b73..b3ee0bd5a08 100644 --- a/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/ModuleAndFunctionWithSameNameAndCommonRoot/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/ModuleAndFunctionWithSameNameAndCommonRoot/input.ts/es5.2.minified/output.js @@ -1,10 +1,13 @@ var A, B; -A || (A = { -}), (Point || (Point = { -})).Origin = { - x: 0, - y: 0 -}, (A || (A = { +!function(A1) { + var Point; + (Point || (Point = { + })).Origin = { + x: 0, + y: 0 + }, A1.Point = Point; +}(A || (A = { +})), (A || (A = { })).Point = function() { return { x: 0, diff --git a/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/TwoInternalModulesThatMergeEachWithExportedAndNonExportedClassesOfTheSameName/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/TwoInternalModulesThatMergeEachWithExportedAndNonExportedClassesOfTheSameName/input.ts/es2015.1.normal/output.js index 71cb129c035..ee44b8a2ed5 100644 --- a/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/TwoInternalModulesThatMergeEachWithExportedAndNonExportedClassesOfTheSameName/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/TwoInternalModulesThatMergeEachWithExportedAndNonExportedClassesOfTheSameName/input.ts/es2015.1.normal/output.js @@ -21,9 +21,9 @@ var p; var p; var X; (function(X1) { - var Y1; + let Y1; (function(Y) { - var Z; + let Z; (function(Z) { class Line { } diff --git a/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/TwoInternalModulesThatMergeEachWithExportedAndNonExportedClassesOfTheSameName/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/TwoInternalModulesThatMergeEachWithExportedAndNonExportedClassesOfTheSameName/input.ts/es2015.2.minified/output.js index 8d91a4cff27..4cd998ab949 100644 --- a/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/TwoInternalModulesThatMergeEachWithExportedAndNonExportedClassesOfTheSameName/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/TwoInternalModulesThatMergeEachWithExportedAndNonExportedClassesOfTheSameName/input.ts/es2015.2.minified/output.js @@ -2,7 +2,7 @@ var A, X; (A || (A = { })).Point = class { }, (function(X1) { - var Y, Z; + let Y, Z; (Y || (Y = { })).Z = Z, X1.Y = Y; })(X || (X = { diff --git a/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/TwoInternalModulesThatMergeEachWithExportedAndNonExportedLocalVarsOfTheSameName/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/TwoInternalModulesThatMergeEachWithExportedAndNonExportedLocalVarsOfTheSameName/input.ts/es2015.1.normal/output.js index 67310a22170..c7da3a990a7 100644 --- a/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/TwoInternalModulesThatMergeEachWithExportedAndNonExportedLocalVarsOfTheSameName/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/TwoInternalModulesThatMergeEachWithExportedAndNonExportedLocalVarsOfTheSameName/input.ts/es2015.1.normal/output.js @@ -1,7 +1,7 @@ //@filename: part1.ts var A; (function(A1) { - var Utils1; + let Utils1; (function(Utils) { function mirror(p1) { return { @@ -19,9 +19,10 @@ var A; A1.Utils = Utils1; })(A || (A = { })); -(function(A) { +(function(A2) { // not a collision, since we don't export var Origin = "0,0"; + let Utils2; (function(Utils) { class Plane { constructor(tl, br){ @@ -30,8 +31,9 @@ var A; } } Utils.Plane = Plane; - })(Utils || (Utils = { + })(Utils2 || (Utils2 = { })); + A2.Utils = Utils2; })(A || (A = { })); //@filename: part3.ts diff --git a/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/TwoInternalModulesThatMergeEachWithExportedAndNonExportedLocalVarsOfTheSameName/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/TwoInternalModulesThatMergeEachWithExportedAndNonExportedLocalVarsOfTheSameName/input.ts/es2015.2.minified/output.js index 47f5ae80b26..bb832f3b1cb 100644 --- a/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/TwoInternalModulesThatMergeEachWithExportedAndNonExportedLocalVarsOfTheSameName/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/TwoInternalModulesThatMergeEachWithExportedAndNonExportedLocalVarsOfTheSameName/input.ts/es2015.2.minified/output.js @@ -1,5 +1,5 @@ !function(A1) { - var Utils; + let Utils; (Utils || (Utils = { })).mirror = function(p) { return { @@ -11,13 +11,16 @@ y: 0 }, A1.Utils = Utils; }(A || (A = { -})), A || (A = { -}), (Utils || (Utils = { -})).Plane = class { - constructor(tl, br){ - this.tl = tl, this.br = br; - } -}; +})), (function(A2) { + let Utils; + (Utils || (Utils = { + })).Plane = class { + constructor(tl, br){ + this.tl = tl, this.br = br; + } + }, A2.Utils = Utils; +})(A || (A = { +})); var A, o, o, o = A.Origin, o = A.Utils.mirror(o); new A.Utils.Plane(o, { x: 1, diff --git a/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/TwoInternalModulesThatMergeEachWithExportedAndNonExportedLocalVarsOfTheSameName/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/TwoInternalModulesThatMergeEachWithExportedAndNonExportedLocalVarsOfTheSameName/input.ts/es5.1.normal/output.js index e8935195d8d..ee1c0ace80b 100644 --- a/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/TwoInternalModulesThatMergeEachWithExportedAndNonExportedLocalVarsOfTheSameName/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/TwoInternalModulesThatMergeEachWithExportedAndNonExportedLocalVarsOfTheSameName/input.ts/es5.1.normal/output.js @@ -24,9 +24,10 @@ var A; A1.Utils = Utils1; })(A || (A = { })); -(function(A) { +(function(A2) { // not a collision, since we don't export var Origin = "0,0"; + var Utils2; (function(Utils) { var Plane = function Plane(tl, br) { "use strict"; @@ -35,8 +36,9 @@ var A; this.br = br; }; Utils.Plane = Plane; - })(Utils || (Utils = { + })(Utils2 || (Utils2 = { })); + A2.Utils = Utils2; })(A || (A = { })); //@filename: part3.ts diff --git a/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/TwoInternalModulesThatMergeEachWithExportedAndNonExportedLocalVarsOfTheSameName/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/TwoInternalModulesThatMergeEachWithExportedAndNonExportedLocalVarsOfTheSameName/input.ts/es5.2.minified/output.js index 4a23ddbfe45..ce598c141c9 100644 --- a/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/TwoInternalModulesThatMergeEachWithExportedAndNonExportedLocalVarsOfTheSameName/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/TwoInternalModulesThatMergeEachWithExportedAndNonExportedLocalVarsOfTheSameName/input.ts/es5.2.minified/output.js @@ -11,15 +11,15 @@ y: 0 }, A1.Utils = Utils; }(A || (A = { -})), (function(A) { - var Utils1, Plane; +})), (function(A2) { + var Utils, Utils1, Plane; Utils1 = Utils || (Utils = { }), Plane = function(tl, br) { "use strict"; (function(instance, Constructor) { if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function"); })(this, Plane), this.tl = tl, this.br = br; - }, Utils1.Plane = Plane; + }, Utils1.Plane = Plane, A2.Utils = Utils; })(A || (A = { })); var A, o, o, o = A.Origin, o = A.Utils.mirror(o); diff --git a/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/TwoInternalModulesThatMergeEachWithExportedClassesOfTheSameName/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/TwoInternalModulesThatMergeEachWithExportedClassesOfTheSameName/input.ts/es2015.1.normal/output.js index 0d1e3519594..0affa693ef0 100644 --- a/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/TwoInternalModulesThatMergeEachWithExportedClassesOfTheSameName/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/TwoInternalModulesThatMergeEachWithExportedClassesOfTheSameName/input.ts/es2015.1.normal/output.js @@ -13,9 +13,9 @@ var A; })); var X; (function(X1) { - var Y1; + let Y1; (function(Y) { - var Z1; + let Z1; (function(Z) { class Line { } diff --git a/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/TwoInternalModulesThatMergeEachWithExportedClassesOfTheSameName/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/TwoInternalModulesThatMergeEachWithExportedClassesOfTheSameName/input.ts/es2015.2.minified/output.js index d667f0a625c..4ded2684026 100644 --- a/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/TwoInternalModulesThatMergeEachWithExportedClassesOfTheSameName/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/TwoInternalModulesThatMergeEachWithExportedClassesOfTheSameName/input.ts/es2015.2.minified/output.js @@ -4,10 +4,11 @@ var A, X; }, (A || (A = { })).Point = class { }, (function(X1) { - var Y, Y1, Z; - Y1 = Y || (Y = { + var Y; + let Y1, Z; + Y = Y1 || (Y1 = { }), (Z || (Z = { })).Line = class { - }, Y1.Z = Z, X1.Y = Y; + }, Y.Z = Z, X1.Y = Y1; })(X || (X = { })); diff --git a/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/TwoInternalModulesThatMergeEachWithExportedLocalVarsOfTheSameName/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/TwoInternalModulesThatMergeEachWithExportedLocalVarsOfTheSameName/input.ts/es2015.1.normal/output.js index 52d0f858f61..b22e24e57ba 100644 --- a/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/TwoInternalModulesThatMergeEachWithExportedLocalVarsOfTheSameName/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/TwoInternalModulesThatMergeEachWithExportedLocalVarsOfTheSameName/input.ts/es2015.1.normal/output.js @@ -1,7 +1,7 @@ //@filename: part1.ts export var A; (function(A1) { - var Utils1; + let Utils1; (function(Utils) { function mirror(p) { return { @@ -24,6 +24,7 @@ export var A; x: 0, y: 0 }; + let Utils2; (function(Utils) { class Plane { constructor(tl, br){ @@ -32,7 +33,8 @@ export var A; } } Utils.Plane = Plane; - })(Utils || (Utils = { + })(Utils2 || (Utils2 = { })); + A2.Utils = Utils2; })(A || (A = { })); diff --git a/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/TwoInternalModulesThatMergeEachWithExportedLocalVarsOfTheSameName/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/TwoInternalModulesThatMergeEachWithExportedLocalVarsOfTheSameName/input.ts/es2015.2.minified/output.js index c75d2966153..eb462295d19 100644 --- a/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/TwoInternalModulesThatMergeEachWithExportedLocalVarsOfTheSameName/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/TwoInternalModulesThatMergeEachWithExportedLocalVarsOfTheSameName/input.ts/es2015.2.minified/output.js @@ -1,6 +1,6 @@ -var A; +export var A; !function(A1) { - var Utils; + let Utils; (Utils || (Utils = { })).mirror = function(p) { return { @@ -12,13 +12,17 @@ var A; y: 0 }, A1.Utils = Utils; }(A || (A = { -})), (A || (A = { -})).Origin = { - x: 0, - y: 0 -}, (Utils || (Utils = { -})).Plane = class { - constructor(tl, br){ - this.tl = tl, this.br = br; - } -}; +})), (function(A2) { + A2.Origin = { + x: 0, + y: 0 + }; + let Utils; + (Utils || (Utils = { + })).Plane = class { + constructor(tl, br){ + this.tl = tl, this.br = br; + } + }, A2.Utils = Utils; +})(A || (A = { +})); diff --git a/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/TwoInternalModulesThatMergeEachWithExportedLocalVarsOfTheSameName/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/TwoInternalModulesThatMergeEachWithExportedLocalVarsOfTheSameName/input.ts/es5.1.normal/output.js index f6ce4815c58..8aa19cde310 100644 --- a/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/TwoInternalModulesThatMergeEachWithExportedLocalVarsOfTheSameName/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/TwoInternalModulesThatMergeEachWithExportedLocalVarsOfTheSameName/input.ts/es5.1.normal/output.js @@ -29,6 +29,7 @@ export var A; x: 0, y: 0 }; + var Utils2; (function(Utils) { var Plane = function Plane(tl, br) { "use strict"; @@ -37,7 +38,8 @@ export var A; this.br = br; }; Utils.Plane = Plane; - })(Utils || (Utils = { + })(Utils2 || (Utils2 = { })); + A2.Utils = Utils2; })(A || (A = { })); diff --git a/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/TwoInternalModulesThatMergeEachWithExportedLocalVarsOfTheSameName/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/TwoInternalModulesThatMergeEachWithExportedLocalVarsOfTheSameName/input.ts/es5.2.minified/output.js index ce6c868152f..7dcef3d5a0a 100644 --- a/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/TwoInternalModulesThatMergeEachWithExportedLocalVarsOfTheSameName/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/TwoInternalModulesThatMergeEachWithExportedLocalVarsOfTheSameName/input.ts/es5.2.minified/output.js @@ -13,7 +13,7 @@ export var A; }, A1.Utils = Utils; }(A || (A = { })), (function(A2) { - var Utils1, Plane; + var Utils, Utils1, Plane; A2.Origin = { x: 0, y: 0 @@ -23,6 +23,6 @@ export var A; (function(instance, Constructor) { if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function"); })(this, Plane), this.tl = tl, this.br = br; - }, Utils1.Plane = Plane; + }, Utils1.Plane = Plane, A2.Utils = Utils; })(A || (A = { })); diff --git a/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/TwoInternalModulesThatMergeEachWithExportedModulesOfTheSameName/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/TwoInternalModulesThatMergeEachWithExportedModulesOfTheSameName/input.ts/es2015.1.normal/output.js index 1f4b4c4fa24..dd79f978ead 100644 --- a/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/TwoInternalModulesThatMergeEachWithExportedModulesOfTheSameName/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/TwoInternalModulesThatMergeEachWithExportedModulesOfTheSameName/input.ts/es2015.1.normal/output.js @@ -1,6 +1,6 @@ var A; (function(A) { - var B1; + let B1; (function(B) { var x1; B.x = x1; @@ -13,9 +13,9 @@ var x; var x = A.B.x; var X; (function(X1) { - var Y; + let Y; (function(Y) { - var Z1; + let Z1; (function(Z) { class Line { } diff --git a/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/TwoInternalModulesThatMergeEachWithExportedModulesOfTheSameName/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/TwoInternalModulesThatMergeEachWithExportedModulesOfTheSameName/input.ts/es2015.2.minified/output.js index 83a7fa3c5d5..05e54c5dd91 100644 --- a/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/TwoInternalModulesThatMergeEachWithExportedModulesOfTheSameName/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/TwoInternalModulesThatMergeEachWithExportedModulesOfTheSameName/input.ts/es2015.2.minified/output.js @@ -1,11 +1,12 @@ var A, X; !function(A) { - var B, x; + var x; + let B; (B || (B = { })).x = x; }(A || (A = { })), A.B.x, (function(X1) { - var Y, Z; + let Y, Z; Y || (Y = { }), (Z || (Z = { })).Line = class { diff --git a/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/TwoInternalModulesWithTheSameNameAndDifferentCommonRoot/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/TwoInternalModulesWithTheSameNameAndDifferentCommonRoot/input.ts/es2015.1.normal/output.js index cd70a4545e8..4768d05a67f 100644 --- a/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/TwoInternalModulesWithTheSameNameAndDifferentCommonRoot/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/TwoInternalModulesWithTheSameNameAndDifferentCommonRoot/input.ts/es2015.1.normal/output.js @@ -1,9 +1,9 @@ //@filename: part1.ts var Root; (function(Root1) { - var A1; + let A1; (function(A) { - var Utils1; + let Utils1; (function(Utils) { function mirror(p) { return { @@ -22,12 +22,14 @@ var Root; })); //@filename: part2.ts var otherRoot; -(function(otherRoot) { +(function(otherRoot1) { + let A2; (function(A) { A.Origin = { x: 0, y: 0 }; + let Utils2; (function(Utils) { class Plane { constructor(tl, br){ @@ -36,9 +38,11 @@ var otherRoot; } } Utils.Plane = Plane; - })(Utils || (Utils = { + })(Utils2 || (Utils2 = { })); - })(A || (A = { + A.Utils = Utils2; + })(A2 || (A2 = { })); + otherRoot1.A = A2; })(otherRoot || (otherRoot = { })); diff --git a/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/TwoInternalModulesWithTheSameNameAndDifferentCommonRoot/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/TwoInternalModulesWithTheSameNameAndDifferentCommonRoot/input.ts/es2015.2.minified/output.js index 418dfcc6298..489499ac635 100644 --- a/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/TwoInternalModulesWithTheSameNameAndDifferentCommonRoot/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/TwoInternalModulesWithTheSameNameAndDifferentCommonRoot/input.ts/es2015.2.minified/output.js @@ -1,23 +1,28 @@ var Root, otherRoot; !function(Root1) { - var A, A1, Utils; - A1 = A || (A = { + var A; + let A1, Utils; + A = A1 || (A1 = { }), (Utils || (Utils = { })).mirror = function(p) { return { x: p.y, y: p.x }; - }, A1.Utils = Utils, Root1.A = A; + }, A.Utils = Utils, Root1.A = A1; }(Root || (Root = { -})), otherRoot || (otherRoot = { -}), (A || (A = { -})).Origin = { - x: 0, - y: 0 -}, (Utils || (Utils = { -})).Plane = class { - constructor(tl, br){ - this.tl = tl, this.br = br; - } -}; +})), (function(otherRoot1) { + var A; + let A2, Utils; + (A = A2 || (A2 = { + })).Origin = { + x: 0, + y: 0 + }, (Utils || (Utils = { + })).Plane = class { + constructor(tl, br){ + this.tl = tl, this.br = br; + } + }, A.Utils = Utils, otherRoot1.A = A2; +})(otherRoot || (otherRoot = { +})); diff --git a/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/TwoInternalModulesWithTheSameNameAndDifferentCommonRoot/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/TwoInternalModulesWithTheSameNameAndDifferentCommonRoot/input.ts/es5.1.normal/output.js index eadd33c8ce1..9099d16a2b0 100644 --- a/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/TwoInternalModulesWithTheSameNameAndDifferentCommonRoot/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/TwoInternalModulesWithTheSameNameAndDifferentCommonRoot/input.ts/es5.1.normal/output.js @@ -27,12 +27,14 @@ var Root; })); //@filename: part2.ts var otherRoot; -(function(otherRoot) { +(function(otherRoot1) { + var A2; (function(A) { A.Origin = { x: 0, y: 0 }; + var Utils2; (function(Utils) { var Plane = function Plane(tl, br) { "use strict"; @@ -41,9 +43,11 @@ var otherRoot; this.br = br; }; Utils.Plane = Plane; - })(Utils || (Utils = { + })(Utils2 || (Utils2 = { })); - })(A || (A = { + A.Utils = Utils2; + })(A2 || (A2 = { })); + otherRoot1.A = A2; })(otherRoot || (otherRoot = { })); diff --git a/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/TwoInternalModulesWithTheSameNameAndDifferentCommonRoot/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/TwoInternalModulesWithTheSameNameAndDifferentCommonRoot/input.ts/es5.2.minified/output.js index ac2905ca8c5..9fdeaaa48ab 100644 --- a/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/TwoInternalModulesWithTheSameNameAndDifferentCommonRoot/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/TwoInternalModulesWithTheSameNameAndDifferentCommonRoot/input.ts/es5.2.minified/output.js @@ -10,9 +10,9 @@ var Root, otherRoot; }; }, A1.Utils = Utils, Root1.A = A; }(Root || (Root = { -})), (function(otherRoot) { - var Utils1, Plane; - (A || (A = { +})), (function(otherRoot1) { + var A, A2, Utils, Utils1, Plane; + (A2 = A || (A = { })).Origin = { x: 0, y: 0 @@ -22,6 +22,6 @@ var Root, otherRoot; (function(instance, Constructor) { if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function"); })(this, Plane), this.tl = tl, this.br = br; - }, Utils1.Plane = Plane; + }, Utils1.Plane = Plane, A2.Utils = Utils, otherRoot1.A = A; })(otherRoot || (otherRoot = { })); diff --git a/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/TwoInternalModulesWithTheSameNameAndSameCommonRoot/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/TwoInternalModulesWithTheSameNameAndSameCommonRoot/input.ts/es2015.1.normal/output.js index 51e5aef7621..73b0cb67f3b 100644 --- a/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/TwoInternalModulesWithTheSameNameAndSameCommonRoot/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/TwoInternalModulesWithTheSameNameAndSameCommonRoot/input.ts/es2015.1.normal/output.js @@ -1,7 +1,7 @@ //@filename: part1.ts var A; (function(A1) { - var Utils1; + let Utils1; (function(Utils) { function mirror(p1) { return { @@ -20,6 +20,7 @@ var A; x: 0, y: 0 }; + let Utils2; (function(Utils) { class Plane { constructor(tl, br){ @@ -28,8 +29,9 @@ var A; } } Utils.Plane = Plane; - })(Utils || (Utils = { + })(Utils2 || (Utils2 = { })); + A2.Utils = Utils2; })(A || (A = { })); //@filename: part3.ts diff --git a/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/TwoInternalModulesWithTheSameNameAndSameCommonRoot/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/TwoInternalModulesWithTheSameNameAndSameCommonRoot/input.ts/es2015.2.minified/output.js index 47df1ff4d9e..95afa6f6cd3 100644 --- a/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/TwoInternalModulesWithTheSameNameAndSameCommonRoot/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/TwoInternalModulesWithTheSameNameAndSameCommonRoot/input.ts/es2015.2.minified/output.js @@ -1,5 +1,5 @@ !function(A1) { - var Utils; + let Utils; (Utils || (Utils = { })).mirror = function(p) { return { @@ -8,16 +8,20 @@ }; }, A1.Utils = Utils; }(A || (A = { -})), (A || (A = { -})).Origin = { - x: 0, - y: 0 -}, (Utils || (Utils = { -})).Plane = class { - constructor(tl, br){ - this.tl = tl, this.br = br; - } -}; +})), (function(A2) { + A2.Origin = { + x: 0, + y: 0 + }; + let Utils; + (Utils || (Utils = { + })).Plane = class { + constructor(tl, br){ + this.tl = tl, this.br = br; + } + }, A2.Utils = Utils; +})(A || (A = { +})); var A, o, o, o = A.Origin, o = A.Utils.mirror(o); new A.Utils.Plane(o, { x: 1, diff --git a/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/TwoInternalModulesWithTheSameNameAndSameCommonRoot/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/TwoInternalModulesWithTheSameNameAndSameCommonRoot/input.ts/es5.1.normal/output.js index 7f8e0b6971c..1d320a1da14 100644 --- a/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/TwoInternalModulesWithTheSameNameAndSameCommonRoot/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/TwoInternalModulesWithTheSameNameAndSameCommonRoot/input.ts/es5.1.normal/output.js @@ -25,6 +25,7 @@ var A; x: 0, y: 0 }; + var Utils2; (function(Utils) { var Plane = function Plane(tl, br) { "use strict"; @@ -33,8 +34,9 @@ var A; this.br = br; }; Utils.Plane = Plane; - })(Utils || (Utils = { + })(Utils2 || (Utils2 = { })); + A2.Utils = Utils2; })(A || (A = { })); //@filename: part3.ts diff --git a/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/TwoInternalModulesWithTheSameNameAndSameCommonRoot/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/TwoInternalModulesWithTheSameNameAndSameCommonRoot/input.ts/es5.2.minified/output.js index 91dbe1731b5..89ca0f8945e 100644 --- a/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/TwoInternalModulesWithTheSameNameAndSameCommonRoot/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/internalModules/DeclarationMerging/TwoInternalModulesWithTheSameNameAndSameCommonRoot/input.ts/es5.2.minified/output.js @@ -9,7 +9,7 @@ }, A1.Utils = Utils; }(A || (A = { })), (function(A2) { - var Utils1, Plane; + var Utils, Utils1, Plane; A2.Origin = { x: 0, y: 0 @@ -19,7 +19,7 @@ (function(instance, Constructor) { if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function"); })(this, Plane), this.tl = tl, this.br = br; - }, Utils1.Plane = Plane; + }, Utils1.Plane = Plane, A2.Utils = Utils; })(A || (A = { })); var A, o, o, o = A.Origin, o = A.Utils.mirror(o); diff --git a/crates/swc/tests/tsc-references/internalModules/codeGeneration/exportCodeGen/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/internalModules/codeGeneration/exportCodeGen/input.ts/es2015.1.normal/output.js index f0fa859142d..7c77987ecce 100644 --- a/crates/swc/tests/tsc-references/internalModules/codeGeneration/exportCodeGen/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/internalModules/codeGeneration/exportCodeGen/input.ts/es2015.1.normal/output.js @@ -17,6 +17,8 @@ var B; } })(B || (B = { })); +// not copied, since not exported +var C; (function(C) { function no() { return false; @@ -35,29 +37,30 @@ var D; // validate all exportable statements var E; (function(E1) { - var Color1; + let Color; (function(Color) { Color[Color["Red"] = 0] = "Red"; - })(Color1 || (Color1 = { + })(Color || (Color = { })); function fn() { } E1.fn = fn; - class C { + class C1 { } - E1.C = C; - var M1; + E1.C = C1; + let M1; (function(M) { M.x = 42; })(M1 || (M1 = { })); - E1.Color = Color1, E1.M = M1; + E1.Color = Color, E1.M = M1; })(E || (E = { })); // validate all exportable statements, // which are not exported var F; (function(F) { + let Color; (function(Color) { Color[Color["Red"] = 0] = "Red"; })(Color || (Color = { @@ -66,6 +69,7 @@ var F; } class C { } + let M; (function(M) { var x = 42; })(M || (M = { diff --git a/crates/swc/tests/tsc-references/internalModules/codeGeneration/exportCodeGen/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/internalModules/codeGeneration/exportCodeGen/input.ts/es2015.2.minified/output.js index 5be6b6c7da6..c7716f1fcce 100644 --- a/crates/swc/tests/tsc-references/internalModules/codeGeneration/exportCodeGen/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/internalModules/codeGeneration/exportCodeGen/input.ts/es2015.2.minified/output.js @@ -4,16 +4,20 @@ var A, D, E, F; })).yes = function() { return !0; }, (function(E1) { - var Color, M, Color1; - (Color1 = Color || (Color = { - }))[Color1.Red = 0] = "Red", E1.fn = function() { + var Color; + let Color; + (Color = Color || (Color = { + }))[Color.Red = 0] = "Red", E1.fn = function() { }, E1.C = class { - }, (M || (M = { + }; + let M; + (M || (M = { })).x = 42, E1.Color = Color, E1.M = M; })(E || (E = { })), (function(F) { - var Color2; - (Color2 = Color || (Color = { - }))[Color2.Red = 0] = "Red"; + var Color; + let Color; + (Color = Color || (Color = { + }))[Color.Red = 0] = "Red"; })(F || (F = { })); diff --git a/crates/swc/tests/tsc-references/internalModules/codeGeneration/exportCodeGen/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/internalModules/codeGeneration/exportCodeGen/input.ts/es5.1.normal/output.js index bf42fa4c9fb..990833b4f67 100644 --- a/crates/swc/tests/tsc-references/internalModules/codeGeneration/exportCodeGen/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/internalModules/codeGeneration/exportCodeGen/input.ts/es5.1.normal/output.js @@ -22,6 +22,8 @@ var B; var x = 12; })(B || (B = { })); +// not copied, since not exported +var C; (function(C) { var no = function no() { return false; @@ -42,23 +44,23 @@ var E; (function(E1) { var fn = function fn() { }; - var Color1; + var Color; (function(Color) { Color[Color["Red"] = 0] = "Red"; - })(Color1 || (Color1 = { + })(Color || (Color = { })); E1.fn = fn; - var C = function C() { + var C1 = function C1() { "use strict"; - _classCallCheck(this, C); + _classCallCheck(this, C1); }; - E1.C = C; + E1.C = C1; var M1; (function(M) { M.x = 42; })(M1 || (M1 = { })); - E1.Color = Color1, E1.M = M1; + E1.Color = Color, E1.M = M1; })(E || (E = { })); // validate all exportable statements, @@ -67,14 +69,16 @@ var F; (function(F) { var fn = function fn() { }; + var Color; (function(Color) { Color[Color["Red"] = 0] = "Red"; })(Color || (Color = { })); - var C = function C() { + var C2 = function C2() { "use strict"; - _classCallCheck(this, C); + _classCallCheck(this, C2); }; + var M; (function(M) { var x = 42; })(M || (M = { diff --git a/crates/swc/tests/tsc-references/internalModules/codeGeneration/exportCodeGen/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/internalModules/codeGeneration/exportCodeGen/input.ts/es5.2.minified/output.js index c8453b23eb6..5c69700ab10 100644 --- a/crates/swc/tests/tsc-references/internalModules/codeGeneration/exportCodeGen/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/internalModules/codeGeneration/exportCodeGen/input.ts/es5.2.minified/output.js @@ -7,10 +7,10 @@ function _classCallCheck(instance, Constructor) { })).yes = function() { return !0; }, (function(E1) { - (Color1 = Color || (Color = { - }))[Color1.Red = 0] = "Red", E1.fn = function() { + (Color = Color || (Color = { + }))[Color.Red = 0] = "Red", E1.fn = function() { }; - var Color, M, Color1, C = function() { + var Color, M, Color, C = function() { "use strict"; _classCallCheck(this, C); }; @@ -18,9 +18,9 @@ function _classCallCheck(instance, Constructor) { })).x = 42, E1.Color = Color, E1.M = M; })(E || (E = { })), (function(F) { - var Color2; - (Color2 = Color || (Color = { - }))[Color2.Red = 0] = "Red"; + var Color, Color; + (Color = Color || (Color = { + }))[Color.Red = 0] = "Red"; var C = function() { "use strict"; _classCallCheck(this, C); diff --git a/crates/swc/tests/tsc-references/internalModules/codeGeneration/importStatements/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/internalModules/codeGeneration/importStatements/input.ts/es2015.1.normal/output.js index 0b3b1fe1f5b..254a64177e4 100644 --- a/crates/swc/tests/tsc-references/internalModules/codeGeneration/importStatements/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/internalModules/codeGeneration/importStatements/input.ts/es2015.1.normal/output.js @@ -11,15 +11,8 @@ var A; })(A || (A = { })); // no code gen expected -var B; -(function(B) { - var a = A; -})(B || (B = { -})); -// no code gen expected var C; (function(C) { - var a = A; var m; var p; var p = { diff --git a/crates/swc/tests/tsc-references/internalModules/codeGeneration/importStatements/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/internalModules/codeGeneration/importStatements/input.ts/es5.1.normal/output.js index c06049323ec..a57abe1e897 100644 --- a/crates/swc/tests/tsc-references/internalModules/codeGeneration/importStatements/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/internalModules/codeGeneration/importStatements/input.ts/es5.1.normal/output.js @@ -16,15 +16,8 @@ var A; })(A || (A = { })); // no code gen expected -var B; -(function(B) { - var a = A; -})(B || (B = { -})); -// no code gen expected var C; (function(C) { - var a = A; var m; var p; var p = { diff --git a/crates/swc/tests/tsc-references/internalModules/codeGeneration/nameCollision/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/internalModules/codeGeneration/nameCollision/input.ts/es2015.1.normal/output.js index 70a5f8fd540..67da3d6bdc7 100644 --- a/crates/swc/tests/tsc-references/internalModules/codeGeneration/nameCollision/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/internalModules/codeGeneration/nameCollision/input.ts/es2015.1.normal/output.js @@ -6,6 +6,7 @@ var A; var _A = ''; })(A || (A = { })); +var B; (function(B) { var A = 12; })(B || (B = { @@ -20,10 +21,10 @@ var A; var X; (function(X2) { var X1 = 13; - var Y2; + let Y2; (function(Y) { var Y1 = 13; - var Z; + let Z; (function(Z) { var X = 12; var Y = 12; diff --git a/crates/swc/tests/tsc-references/internalModules/codeGeneration/nameCollision/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/internalModules/codeGeneration/nameCollision/input.ts/es2015.2.minified/output.js index 5e78a5d0aac..940c26a6cee 100644 --- a/crates/swc/tests/tsc-references/internalModules/codeGeneration/nameCollision/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/internalModules/codeGeneration/nameCollision/input.ts/es2015.2.minified/output.js @@ -1,6 +1,6 @@ var X, D; !function(X1) { - var Y, Z; + let Y, Z; (Y || (Y = { })).Z = Z, X1.Y = Y; }(X || (X = { diff --git a/crates/swc/tests/tsc-references/internalModules/codeGeneration/nameCollision/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/internalModules/codeGeneration/nameCollision/input.ts/es5.1.normal/output.js index b19b7060bde..57740673e21 100644 --- a/crates/swc/tests/tsc-references/internalModules/codeGeneration/nameCollision/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/internalModules/codeGeneration/nameCollision/input.ts/es5.1.normal/output.js @@ -11,6 +11,7 @@ var A; var _A = ''; })(A || (A = { })); +var B; (function(B) { var A = 12; })(B || (B = { diff --git a/crates/swc/tests/tsc-references/internalModules/codeGeneration/nameCollision/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/internalModules/codeGeneration/nameCollision/input.ts/es5.2.minified/output.js index b31ee32adea..08f319e0d4b 100644 --- a/crates/swc/tests/tsc-references/internalModules/codeGeneration/nameCollision/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/internalModules/codeGeneration/nameCollision/input.ts/es5.2.minified/output.js @@ -1,4 +1,4 @@ -var X, D; +var B, X, D; !function(B) { var B1 = function() { "use strict"; diff --git a/crates/swc/tests/tsc-references/internalModules/exportDeclarations/ExportModuleWithAccessibleTypesOnItsExportedMembers/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/internalModules/exportDeclarations/ExportModuleWithAccessibleTypesOnItsExportedMembers/input.ts/es2015.1.normal/output.js index ef72952919c..bd55923694a 100644 --- a/crates/swc/tests/tsc-references/internalModules/exportDeclarations/ExportModuleWithAccessibleTypesOnItsExportedMembers/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/internalModules/exportDeclarations/ExportModuleWithAccessibleTypesOnItsExportedMembers/input.ts/es2015.1.normal/output.js @@ -7,7 +7,7 @@ var A; } } A1.Point = Point; - var B1; + let B1; (function(B) { B.Origin = new Point(0, 0); class Line { diff --git a/crates/swc/tests/tsc-references/internalModules/exportDeclarations/ExportModuleWithAccessibleTypesOnItsExportedMembers/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/internalModules/exportDeclarations/ExportModuleWithAccessibleTypesOnItsExportedMembers/input.ts/es2015.2.minified/output.js index 82f6b6b1d7b..7e4145ba31d 100644 --- a/crates/swc/tests/tsc-references/internalModules/exportDeclarations/ExportModuleWithAccessibleTypesOnItsExportedMembers/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/internalModules/exportDeclarations/ExportModuleWithAccessibleTypesOnItsExportedMembers/input.ts/es2015.2.minified/output.js @@ -1,12 +1,13 @@ var A; !function(A1) { - var B1; class Point { constructor(x, y){ this.x = x, this.y = y; } } - A1.Point = Point, (function(B) { + A1.Point = Point; + let B1; + !function(B) { B.Origin = new Point(0, 0); class Line { static fromOrigin(p) { @@ -19,7 +20,7 @@ var A; } } B.Line = Line; - })(B1 || (B1 = { + }(B1 || (B1 = { })), A1.B = B1; }(A || (A = { })); diff --git a/crates/swc/tests/tsc-references/internalModules/exportDeclarations/ModuleWithExportedAndNonExportedClasses/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/internalModules/exportDeclarations/ModuleWithExportedAndNonExportedClasses/input.ts/es2015.1.normal/output.js index 48996e9527a..0454ae4851e 100644 --- a/crates/swc/tests/tsc-references/internalModules/exportDeclarations/ModuleWithExportedAndNonExportedClasses/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/internalModules/exportDeclarations/ModuleWithExportedAndNonExportedClasses/input.ts/es2015.1.normal/output.js @@ -1,10 +1,11 @@ -(function(A) { +var A; +(function(A3) { class A1 { } - A.A = A1; + A3.A = A1; class AG1 { } - A.AG = AG1; + A3.AG = AG1; class A2 { } class AG2 { diff --git a/crates/swc/tests/tsc-references/internalModules/exportDeclarations/ModuleWithExportedAndNonExportedClasses/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/internalModules/exportDeclarations/ModuleWithExportedAndNonExportedClasses/input.ts/es2015.2.minified/output.js index c0c1ba92151..f39f27b66e3 100644 --- a/crates/swc/tests/tsc-references/internalModules/exportDeclarations/ModuleWithExportedAndNonExportedClasses/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/internalModules/exportDeclarations/ModuleWithExportedAndNonExportedClasses/input.ts/es2015.2.minified/output.js @@ -1,5 +1,5 @@ -var A1; -(A1 = A || (A = { +var A, A1; +(A = A1 || (A1 = { })).A = class { -}, A1.AG = class { -}, new A.A(), new A.AG(), new A.A2(), new A.A2(); +}, A.AG = class { +}, new A1.A(), new A1.AG(), new A1.A2(), new A1.A2(); diff --git a/crates/swc/tests/tsc-references/internalModules/exportDeclarations/ModuleWithExportedAndNonExportedClasses/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/internalModules/exportDeclarations/ModuleWithExportedAndNonExportedClasses/input.ts/es5.1.normal/output.js index 43b7b9ef0db..858965a43d7 100644 --- a/crates/swc/tests/tsc-references/internalModules/exportDeclarations/ModuleWithExportedAndNonExportedClasses/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/internalModules/exportDeclarations/ModuleWithExportedAndNonExportedClasses/input.ts/es5.1.normal/output.js @@ -3,17 +3,18 @@ function _classCallCheck(instance, Constructor) { throw new TypeError("Cannot call a class as a function"); } } -(function(A) { +var A; +(function(A3) { var A1 = function A1() { "use strict"; _classCallCheck(this, A1); }; - A.A = A1; + A3.A = A1; var AG1 = function AG1() { "use strict"; _classCallCheck(this, AG1); }; - A.AG = AG1; + A3.AG = AG1; var A2 = function A2() { "use strict"; _classCallCheck(this, A2); diff --git a/crates/swc/tests/tsc-references/internalModules/exportDeclarations/ModuleWithExportedAndNonExportedClasses/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/internalModules/exportDeclarations/ModuleWithExportedAndNonExportedClasses/input.ts/es5.2.minified/output.js index eec059481cc..c8d8b205c7c 100644 --- a/crates/swc/tests/tsc-references/internalModules/exportDeclarations/ModuleWithExportedAndNonExportedClasses/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/internalModules/exportDeclarations/ModuleWithExportedAndNonExportedClasses/input.ts/es5.2.minified/output.js @@ -1,17 +1,18 @@ +var A; function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function"); } -(function(A) { +(function(A3) { var A1 = function() { "use strict"; _classCallCheck(this, A1); }; - A.A = A1; + A3.A = A1; var AG = function() { "use strict"; _classCallCheck(this, AG); }; - A.AG = AG; + A3.AG = AG; var A2 = function() { "use strict"; _classCallCheck(this, A2); diff --git a/crates/swc/tests/tsc-references/internalModules/exportDeclarations/ModuleWithExportedAndNonExportedEnums/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/internalModules/exportDeclarations/ModuleWithExportedAndNonExportedEnums/input.ts/es2015.1.normal/output.js index 01922982e39..ff6c584a90f 100644 --- a/crates/swc/tests/tsc-references/internalModules/exportDeclarations/ModuleWithExportedAndNonExportedEnums/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/internalModules/exportDeclarations/ModuleWithExportedAndNonExportedEnums/input.ts/es2015.1.normal/output.js @@ -1,18 +1,18 @@ var A; (function(A1) { - var Color1; + let Color; (function(Color) { Color[Color["Red"] = 0] = "Red"; Color[Color["Blue"] = 1] = "Blue"; - })(Color1 || (Color1 = { + })(Color || (Color = { })); - var Day1; + let Day; (function(Day) { Day[Day["Monday"] = 0] = "Monday"; Day[Day["Tuesday"] = 1] = "Tuesday"; - })(Day1 || (Day1 = { + })(Day || (Day = { })); - A1.Color = Color1; + A1.Color = Color; })(A || (A = { })); // not an error since exported diff --git a/crates/swc/tests/tsc-references/internalModules/exportDeclarations/ModuleWithExportedAndNonExportedEnums/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/internalModules/exportDeclarations/ModuleWithExportedAndNonExportedEnums/input.ts/es2015.2.minified/output.js index 755124a0ee4..3f736461c15 100644 --- a/crates/swc/tests/tsc-references/internalModules/exportDeclarations/ModuleWithExportedAndNonExportedEnums/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/internalModules/exportDeclarations/ModuleWithExportedAndNonExportedEnums/input.ts/es2015.2.minified/output.js @@ -1,8 +1,11 @@ var A; (function(A1) { - var Color, Day, Color1, Day1; - (Color1 = Color || (Color = { - }))[Color1.Red = 0] = "Red", Color1[Color1.Blue = 1] = "Blue", (Day1 = Day || (Day = { - }))[Day1.Monday = 0] = "Monday", Day1[Day1.Tuesday = 1] = "Tuesday", A1.Color = Color; + var Color, Day; + let Color; + (Color = Color || (Color = { + }))[Color.Red = 0] = "Red", Color[Color.Blue = 1] = "Blue"; + let Day; + (Day = Day || (Day = { + }))[Day.Monday = 0] = "Monday", Day[Day.Tuesday = 1] = "Tuesday", A1.Color = Color; })(A || (A = { })), A.Color.Red, A.Day.Monday; diff --git a/crates/swc/tests/tsc-references/internalModules/exportDeclarations/ModuleWithExportedAndNonExportedEnums/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/internalModules/exportDeclarations/ModuleWithExportedAndNonExportedEnums/input.ts/es5.1.normal/output.js index 01922982e39..7ca82116c6d 100644 --- a/crates/swc/tests/tsc-references/internalModules/exportDeclarations/ModuleWithExportedAndNonExportedEnums/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/internalModules/exportDeclarations/ModuleWithExportedAndNonExportedEnums/input.ts/es5.1.normal/output.js @@ -1,18 +1,18 @@ var A; (function(A1) { - var Color1; + var Color; (function(Color) { Color[Color["Red"] = 0] = "Red"; Color[Color["Blue"] = 1] = "Blue"; - })(Color1 || (Color1 = { + })(Color || (Color = { })); - var Day1; + var Day; (function(Day) { Day[Day["Monday"] = 0] = "Monday"; Day[Day["Tuesday"] = 1] = "Tuesday"; - })(Day1 || (Day1 = { + })(Day || (Day = { })); - A1.Color = Color1; + A1.Color = Color; })(A || (A = { })); // not an error since exported diff --git a/crates/swc/tests/tsc-references/internalModules/exportDeclarations/ModuleWithExportedAndNonExportedEnums/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/internalModules/exportDeclarations/ModuleWithExportedAndNonExportedEnums/input.ts/es5.2.minified/output.js index 755124a0ee4..260f37c52b0 100644 --- a/crates/swc/tests/tsc-references/internalModules/exportDeclarations/ModuleWithExportedAndNonExportedEnums/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/internalModules/exportDeclarations/ModuleWithExportedAndNonExportedEnums/input.ts/es5.2.minified/output.js @@ -1,8 +1,8 @@ var A; (function(A1) { - var Color, Day, Color1, Day1; - (Color1 = Color || (Color = { - }))[Color1.Red = 0] = "Red", Color1[Color1.Blue = 1] = "Blue", (Day1 = Day || (Day = { - }))[Day1.Monday = 0] = "Monday", Day1[Day1.Tuesday = 1] = "Tuesday", A1.Color = Color; + var Color, Day, Color, Day; + (Color = Color || (Color = { + }))[Color.Red = 0] = "Red", Color[Color.Blue = 1] = "Blue", (Day = Day || (Day = { + }))[Day.Monday = 0] = "Monday", Day[Day.Tuesday = 1] = "Tuesday", A1.Color = Color; })(A || (A = { })), A.Color.Red, A.Day.Monday; diff --git a/crates/swc/tests/tsc-references/internalModules/importDeclarations/invalidImportAliasIdentifiers/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/internalModules/importDeclarations/invalidImportAliasIdentifiers/input.ts/es2015.1.normal/output.js index 105de3fdb19..74aca4469bf 100644 --- a/crates/swc/tests/tsc-references/internalModules/importDeclarations/invalidImportAliasIdentifiers/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/internalModules/importDeclarations/invalidImportAliasIdentifiers/input.ts/es2015.1.normal/output.js @@ -3,9 +3,9 @@ var V = 12; class C { } var E; -(function(E1) { - E1[E1["Red"] = 0] = "Red"; - E1[E1["Blue"] = 1] = "Blue"; +(function(E) { + E[E["Red"] = 0] = "Red"; + E[E["Blue"] = 1] = "Blue"; })(E || (E = { })); export { }; diff --git a/crates/swc/tests/tsc-references/internalModules/importDeclarations/invalidImportAliasIdentifiers/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/internalModules/importDeclarations/invalidImportAliasIdentifiers/input.ts/es2015.2.minified/output.js index 5b80ab0d0e8..07396d54f21 100644 --- a/crates/swc/tests/tsc-references/internalModules/importDeclarations/invalidImportAliasIdentifiers/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/internalModules/importDeclarations/invalidImportAliasIdentifiers/input.ts/es2015.2.minified/output.js @@ -1,4 +1,4 @@ -var E, E1; -(E1 = E || (E = { -}))[E1.Red = 0] = "Red", E1[E1.Blue = 1] = "Blue"; +var E, E; +(E = E || (E = { +}))[E.Red = 0] = "Red", E[E.Blue = 1] = "Blue"; export { }; diff --git a/crates/swc/tests/tsc-references/internalModules/importDeclarations/invalidImportAliasIdentifiers/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/internalModules/importDeclarations/invalidImportAliasIdentifiers/input.ts/es5.1.normal/output.js index dab4a116589..4655b26e229 100644 --- a/crates/swc/tests/tsc-references/internalModules/importDeclarations/invalidImportAliasIdentifiers/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/internalModules/importDeclarations/invalidImportAliasIdentifiers/input.ts/es5.1.normal/output.js @@ -10,9 +10,9 @@ var C = function C() { _classCallCheck(this, C); }; var E; -(function(E1) { - E1[E1["Red"] = 0] = "Red"; - E1[E1["Blue"] = 1] = "Blue"; +(function(E) { + E[E["Red"] = 0] = "Red"; + E[E["Blue"] = 1] = "Blue"; })(E || (E = { })); export { }; diff --git a/crates/swc/tests/tsc-references/internalModules/importDeclarations/invalidImportAliasIdentifiers/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/internalModules/importDeclarations/invalidImportAliasIdentifiers/input.ts/es5.2.minified/output.js index 5539f5ff8a4..3e252890ed2 100644 --- a/crates/swc/tests/tsc-references/internalModules/importDeclarations/invalidImportAliasIdentifiers/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/internalModules/importDeclarations/invalidImportAliasIdentifiers/input.ts/es5.2.minified/output.js @@ -1,9 +1,9 @@ -var E, E1, C = function() { +var E, E, C = function() { "use strict"; !function(instance, Constructor) { if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function"); }(this, C); }; -(E1 = E || (E = { -}))[E1.Red = 0] = "Red", E1[E1.Blue = 1] = "Blue"; +(E = E || (E = { +}))[E.Red = 0] = "Red", E[E.Blue = 1] = "Blue"; export { }; diff --git a/crates/swc/tests/tsc-references/internalModules/moduleBody/moduleWithStatementsOfEveryKind/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/internalModules/moduleBody/moduleWithStatementsOfEveryKind/input.ts/es2015.1.normal/output.js index c5643515860..8a1d3c41cf9 100644 --- a/crates/swc/tests/tsc-references/internalModules/moduleBody/moduleWithStatementsOfEveryKind/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/internalModules/moduleBody/moduleWithStatementsOfEveryKind/input.ts/es2015.1.normal/output.js @@ -1,3 +1,4 @@ +var A; (function(A) { class A1 { } @@ -7,17 +8,17 @@ } class BB extends A1 { } - var Module; + let Module; (function(Module) { class A { } })(Module || (Module = { })); - var Color1; + let Color; (function(Color) { Color[Color["Blue"] = 0] = "Blue"; Color[Color["Red"] = 1] = "Red"; - })(Color1 || (Color1 = { + })(Color || (Color = { })); var x = 12; function F(s) { @@ -36,23 +37,25 @@ })); var Y; (function(Y1) { - class A { + class A2 { } - Y1.A = A; + Y1.A = A2; class AA { } Y1.AA = AA; class B extends AA { } Y1.B = B; - class BB extends A { + class BB extends A2 { } Y1.BB = BB; + let Module; (function(Module) { class A { } })(Module || (Module = { })); + let Color; (function(Color) { Color[Color["Blue"] = 0] = "Blue"; Color[Color["Red"] = 1] = "Red"; @@ -72,5 +75,6 @@ var Y; id: 2, isvalid: true }; + Y1.Module = Module, Y1.Color = Color; })(Y || (Y = { })); diff --git a/crates/swc/tests/tsc-references/internalModules/moduleBody/moduleWithStatementsOfEveryKind/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/internalModules/moduleBody/moduleWithStatementsOfEveryKind/input.ts/es2015.2.minified/output.js index c5f347eeeea..1bc68982b3b 100644 --- a/crates/swc/tests/tsc-references/internalModules/moduleBody/moduleWithStatementsOfEveryKind/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/internalModules/moduleBody/moduleWithStatementsOfEveryKind/input.ts/es2015.2.minified/output.js @@ -1,26 +1,29 @@ -var Y; +var A, Y; !function(A) { - var Color, Color1; - (Color = Color1 || (Color1 = { + var Color; + let Color; + (Color = Color || (Color = { }))[Color.Blue = 0] = "Blue", Color[Color.Red = 1] = "Red"; }(A || (A = { })), (function(Y1) { - var Color2; - class A { + var Color; + class A1 { } - Y1.A = A; + Y1.A = A1; class AA { } Y1.AA = AA, Y1.B = class extends AA { - }, Y1.BB = class extends A { - }, (Color2 = Color || (Color = { - }))[Color2.Blue = 0] = "Blue", Color2[Color2.Red = 1] = "Red", Y1.x = 12, Y1.F = function(s) { + }, Y1.BB = class extends A1 { + }; + let Module, Color; + (Color = Color || (Color = { + }))[Color.Blue = 0] = "Blue", Color[Color.Red = 1] = "Red", Y1.x = 12, Y1.F = function(s) { return 2; }, Y1.array = null, Y1.fn = (s)=>"hello " + s , Y1.ol = { s: "hello", id: 2, isvalid: !0 - }; + }, Y1.Module = Module, Y1.Color = Color; })(Y || (Y = { })); diff --git a/crates/swc/tests/tsc-references/internalModules/moduleBody/moduleWithStatementsOfEveryKind/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/internalModules/moduleBody/moduleWithStatementsOfEveryKind/input.ts/es5.1.normal/output.js index fa137d6e344..b01dd9606d3 100644 --- a/crates/swc/tests/tsc-references/internalModules/moduleBody/moduleWithStatementsOfEveryKind/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/internalModules/moduleBody/moduleWithStatementsOfEveryKind/input.ts/es5.1.normal/output.js @@ -69,6 +69,7 @@ function _createSuper(Derived) { return _possibleConstructorReturn(this, result); }; } +var A; (function(A2) { var F = function F(s) { return 2; @@ -91,9 +92,9 @@ function _createSuper(Derived) { } return B; }(AA); - var BB = /*#__PURE__*/ function(A) { + var BB = /*#__PURE__*/ function(A3) { "use strict"; - _inherits(BB, A); + _inherits(BB, A3); var _super = _createSuper(BB); function BB() { _classCallCheck(this, BB); @@ -103,17 +104,17 @@ function _createSuper(Derived) { }(A1); var Module; (function(Module) { - var A = function A() { + var A4 = function A4() { "use strict"; - _classCallCheck(this, A); + _classCallCheck(this, A4); }; })(Module || (Module = { })); - var Color1; + var Color; (function(Color) { Color[Color["Blue"] = 0] = "Blue"; Color[Color["Red"] = 1] = "Red"; - })(Color1 || (Color1 = { + })(Color || (Color = { })); var x = 12; var array = null; @@ -132,11 +133,11 @@ var Y; var F = function F(s) { return 2; }; - var A = function A() { + var A5 = function A5() { "use strict"; - _classCallCheck(this, A); + _classCallCheck(this, A5); }; - Y1.A = A; + Y1.A = A5; var AA = function AA() { "use strict"; _classCallCheck(this, AA); @@ -153,24 +154,26 @@ var Y; return B; }(AA); Y1.B = B; - var BB = /*#__PURE__*/ function(A) { + var BB = /*#__PURE__*/ function(A6) { "use strict"; - _inherits(BB, A); + _inherits(BB, A6); var _super = _createSuper(BB); function BB() { _classCallCheck(this, BB); return _super.apply(this, arguments); } return BB; - }(A); + }(A5); Y1.BB = BB; + var Module; (function(Module) { - var A = function A() { + var A7 = function A7() { "use strict"; - _classCallCheck(this, A); + _classCallCheck(this, A7); }; })(Module || (Module = { })); + var Color; (function(Color) { Color[Color["Blue"] = 0] = "Blue"; Color[Color["Red"] = 1] = "Red"; @@ -187,5 +190,6 @@ var Y; id: 2, isvalid: true }; + Y1.Module = Module, Y1.Color = Color; })(Y || (Y = { })); diff --git a/crates/swc/tests/tsc-references/internalModules/moduleBody/moduleWithStatementsOfEveryKind/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/internalModules/moduleBody/moduleWithStatementsOfEveryKind/input.ts/es5.2.minified/output.js index 28c108722dd..f2cdaf02366 100644 --- a/crates/swc/tests/tsc-references/internalModules/moduleBody/moduleWithStatementsOfEveryKind/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/internalModules/moduleBody/moduleWithStatementsOfEveryKind/input.ts/es5.2.minified/output.js @@ -1,4 +1,4 @@ -var Y; +var A, Y; function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function"); } @@ -47,7 +47,7 @@ function _createSuper(Derived) { }; } !function(A3) { - var Module, Color, A1, Color1, A2 = function() { + var Module, Color, A1, Color, A2 = function() { "use strict"; _classCallCheck(this, A2); }, AA1 = function() { @@ -61,9 +61,9 @@ function _createSuper(Derived) { return _classCallCheck(this, B), _super.apply(this, arguments); } return B; - }(AA1), BB = function(A) { + }(AA1), BB = function(A4) { "use strict"; - _inherits(BB, A); + _inherits(BB, A4); var _super = _createSuper(BB); function BB() { return _classCallCheck(this, BB), _super.apply(this, arguments); @@ -74,15 +74,15 @@ function _createSuper(Derived) { }), A1 = function() { "use strict"; _classCallCheck(this, A1); - }, (Color1 = Color || (Color = { - }))[Color1.Blue = 0] = "Blue", Color1[Color1.Red = 1] = "Red"; + }, (Color = Color || (Color = { + }))[Color.Blue = 0] = "Blue", Color[Color.Red = 1] = "Red"; }(A || (A = { })), (function(Y1) { - var A5 = function() { + var Module, Color, A6 = function() { "use strict"; - _classCallCheck(this, A5); + _classCallCheck(this, A6); }; - Y1.A = A5; + Y1.A = A6; var AA2 = function() { "use strict"; _classCallCheck(this, AA2); @@ -98,21 +98,21 @@ function _createSuper(Derived) { return B; }(AA2); Y1.B = B; - var A4, Color2, BB = function(A) { + var A5, Color, BB = function(A7) { "use strict"; - _inherits(BB, A); + _inherits(BB, A7); var _super = _createSuper(BB); function BB() { return _classCallCheck(this, BB), _super.apply(this, arguments); } return BB; - }(A5); + }(A6); Y1.BB = BB, Module || (Module = { - }), A4 = function() { + }), A5 = function() { "use strict"; - _classCallCheck(this, A4); - }, (Color2 = Color || (Color = { - }))[Color2.Blue = 0] = "Blue", Color2[Color2.Red = 1] = "Red", Y1.x = 12, Y1.F = function(s) { + _classCallCheck(this, A5); + }, (Color = Color || (Color = { + }))[Color.Blue = 0] = "Blue", Color[Color.Red = 1] = "Red", Y1.x = 12, Y1.F = function(s) { return 2; }, Y1.array = null, Y1.fn = function(s) { return "hello " + s; @@ -120,6 +120,6 @@ function _createSuper(Derived) { s: "hello", id: 2, isvalid: !0 - }; + }, Y1.Module = Module, Y1.Color = Color; })(Y || (Y = { })); diff --git a/crates/swc/tests/tsc-references/internalModules/moduleDeclarations/instantiatedModule/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/internalModules/moduleDeclarations/instantiatedModule/input.ts/es2015.1.normal/output.js index ac632653d50..d11b77ff5ba 100644 --- a/crates/swc/tests/tsc-references/internalModules/moduleDeclarations/instantiatedModule/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/internalModules/moduleDeclarations/instantiatedModule/input.ts/es2015.1.normal/output.js @@ -40,13 +40,13 @@ var p2 = new m2.Point(); var p2 = new M2.Point(); var M3; (function(M31) { - var Color1; + let Color; (function(Color) { Color[Color["Blue"] = 0] = "Blue"; Color[Color["Red"] = 1] = "Red"; - })(Color1 || (Color1 = { + })(Color || (Color = { })); - M31.Color = Color1; + M31.Color = Color; })(M3 || (M3 = { })); var m3; diff --git a/crates/swc/tests/tsc-references/internalModules/moduleDeclarations/instantiatedModule/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/internalModules/moduleDeclarations/instantiatedModule/input.ts/es2015.2.minified/output.js index 817864941de..bd906ad4324 100644 --- a/crates/swc/tests/tsc-references/internalModules/moduleDeclarations/instantiatedModule/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/internalModules/moduleDeclarations/instantiatedModule/input.ts/es2015.2.minified/output.js @@ -12,9 +12,10 @@ m.Point, (M2 || (M2 = { }; var m2 = M2, a2 = m2.Point, a2 = M2.Point; a2.Origin(), new m2.Point(), new M2.Point(), (function(M31) { - var Color, Color1; - (Color1 = Color || (Color = { - }))[Color1.Blue = 0] = "Blue", Color1[Color1.Red = 1] = "Red", M31.Color = Color; + var Color; + let Color; + (Color = Color || (Color = { + }))[Color.Blue = 0] = "Blue", Color[Color.Red = 1] = "Red", M31.Color = Color; })(M3 || (M3 = { })); var m3 = M3, a3 = m3.Color, a3 = M3.Color; diff --git a/crates/swc/tests/tsc-references/internalModules/moduleDeclarations/instantiatedModule/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/internalModules/moduleDeclarations/instantiatedModule/input.ts/es5.1.normal/output.js index 4af9d6ae80a..1f8ecac7cc8 100644 --- a/crates/swc/tests/tsc-references/internalModules/moduleDeclarations/instantiatedModule/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/internalModules/moduleDeclarations/instantiatedModule/input.ts/es5.1.normal/output.js @@ -69,13 +69,13 @@ var p2 = new m2.Point(); var p2 = new M2.Point(); var M3; (function(M31) { - var Color1; + var Color; (function(Color) { Color[Color["Blue"] = 0] = "Blue"; Color[Color["Red"] = 1] = "Red"; - })(Color1 || (Color1 = { + })(Color || (Color = { })); - M31.Color = Color1; + M31.Color = Color; })(M3 || (M3 = { })); var m3; diff --git a/crates/swc/tests/tsc-references/internalModules/moduleDeclarations/instantiatedModule/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/internalModules/moduleDeclarations/instantiatedModule/input.ts/es5.2.minified/output.js index 731ccfa9bb2..94ca223c3e8 100644 --- a/crates/swc/tests/tsc-references/internalModules/moduleDeclarations/instantiatedModule/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/internalModules/moduleDeclarations/instantiatedModule/input.ts/es5.2.minified/output.js @@ -32,9 +32,9 @@ m.Point, (function(M21) { })); var m2 = M2, a2 = m2.Point, a2 = M2.Point; a2.Origin(), new m2.Point(), new M2.Point(), (function(M31) { - var Color, Color1; - (Color1 = Color || (Color = { - }))[Color1.Blue = 0] = "Blue", Color1[Color1.Red = 1] = "Red", M31.Color = Color; + var Color, Color; + (Color = Color || (Color = { + }))[Color.Blue = 0] = "Blue", Color[Color.Red = 1] = "Red", M31.Color = Color; })(M3 || (M3 = { })); var m3 = M3, a3 = m3.Color, a3 = M3.Color; diff --git a/crates/swc/tests/tsc-references/internalModules/moduleDeclarations/invalidNestedModules/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/internalModules/moduleDeclarations/invalidNestedModules/input.ts/es2015.1.normal/output.js index 9288aa84fe8..c261712afff 100644 --- a/crates/swc/tests/tsc-references/internalModules/moduleDeclarations/invalidNestedModules/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/internalModules/moduleDeclarations/invalidNestedModules/input.ts/es2015.1.normal/output.js @@ -1,6 +1,6 @@ var A; (function(A1) { - var B1; + let B1; (function(B) { class C { } @@ -12,7 +12,7 @@ var A; })); var M2; (function(M21) { - var X1; + let X1; (function(X) { var Point; X.Point = Point; diff --git a/crates/swc/tests/tsc-references/internalModules/moduleDeclarations/invalidNestedModules/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/internalModules/moduleDeclarations/invalidNestedModules/input.ts/es2015.2.minified/output.js index 5bd1605f713..796f06105e0 100644 --- a/crates/swc/tests/tsc-references/internalModules/moduleDeclarations/invalidNestedModules/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/internalModules/moduleDeclarations/invalidNestedModules/input.ts/es2015.2.minified/output.js @@ -1,12 +1,13 @@ var A, M2; !function(A1) { - var B; + let B; (B || (B = { })).C = class { }, A1.B = B; }(A || (A = { })), (function(M21) { - var X, Point; + var Point; + let X; (X || (X = { })).Point = Point, M21.X = X; })(M2 || (M2 = { diff --git a/crates/swc/tests/tsc-references/internalModules/moduleDeclarations/nestedModules/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/internalModules/moduleDeclarations/nestedModules/input.ts/es2015.1.normal/output.js index 1c735e9a9bc..2545d73af7e 100644 --- a/crates/swc/tests/tsc-references/internalModules/moduleDeclarations/nestedModules/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/internalModules/moduleDeclarations/nestedModules/input.ts/es2015.1.normal/output.js @@ -1,6 +1,6 @@ var A; (function(A1) { - var B; + let B; (function(B) { var Point = { x: 0, @@ -13,7 +13,7 @@ var A; })); var M2; (function(M21) { - var X1; + let X1; (function(X) { var Point; X.Point = Point; diff --git a/crates/swc/tests/tsc-references/internalModules/moduleDeclarations/nestedModules/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/internalModules/moduleDeclarations/nestedModules/input.ts/es2015.2.minified/output.js index dfc89e2167e..a5b2d28a881 100644 --- a/crates/swc/tests/tsc-references/internalModules/moduleDeclarations/nestedModules/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/internalModules/moduleDeclarations/nestedModules/input.ts/es2015.2.minified/output.js @@ -1,10 +1,11 @@ var A, M2; !function(A1) { - var B; + let B; A1.B = B; }(A || (A = { })), (function(M21) { - var X, Point; + var Point; + let X; (X || (X = { })).Point = Point, M21.X = X; })(M2 || (M2 = { diff --git a/crates/swc/tests/tsc-references/internalModules/moduleDeclarations/nonInstantiatedModule/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/internalModules/moduleDeclarations/nonInstantiatedModule/input.ts/es2015.1.normal/output.js index 846d6b3f783..21c04adfa12 100644 --- a/crates/swc/tests/tsc-references/internalModules/moduleDeclarations/nonInstantiatedModule/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/internalModules/moduleDeclarations/nonInstantiatedModule/input.ts/es2015.1.normal/output.js @@ -12,7 +12,7 @@ var a2; var a2 = m.a; var M2; (function(M21) { - var Point1; + let Point1; (function(Point) { function Origin() { return { diff --git a/crates/swc/tests/tsc-references/internalModules/moduleDeclarations/nonInstantiatedModule/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/internalModules/moduleDeclarations/nonInstantiatedModule/input.ts/es2015.2.minified/output.js index 4aa8f34df90..ec0e7cf18f3 100644 --- a/crates/swc/tests/tsc-references/internalModules/moduleDeclarations/nonInstantiatedModule/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/internalModules/moduleDeclarations/nonInstantiatedModule/input.ts/es2015.2.minified/output.js @@ -2,7 +2,7 @@ })).a = 1; var M, m, M2, M3, m = M; m.a, (function(M21) { - var Point; + let Point; (Point || (Point = { })).Origin = function() { return { diff --git a/crates/swc/tests/tsc-references/jsx/tsxEmit3x/input.tsx/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/jsx/tsxEmit3x/input.tsx/es2015.1.normal/output.js index fd42447af82..46e8c38f7fb 100644 --- a/crates/swc/tests/tsc-references/jsx/tsxEmit3x/input.tsx/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/jsx/tsxEmit3x/input.tsx/es2015.1.normal/output.js @@ -5,7 +5,7 @@ var M; } } M1.Foo = Foo; - var S1; + let S1; (function(S) { class Bar { } @@ -15,9 +15,10 @@ var M; M1.S = S1; })(M || (M = { })); -(function(M) { +(function(M2) { // Emit M.Foo Foo, /*#__PURE__*/ React.createElement(Foo, null); + let S; (function(S) { // Emit M.Foo Foo, /*#__PURE__*/ React.createElement(Foo, null); @@ -25,6 +26,7 @@ var M; Bar, /*#__PURE__*/ React.createElement(Bar, null); })(S || (S = { })); + M2.S = S; })(M || (M = { })); (function(M) { @@ -33,7 +35,7 @@ var M; })(M || (M = { })); (function(M) { - var M2 = 100; + var M3 = 100; // Emit M_1.Foo Foo, /*#__PURE__*/ React.createElement(Foo, null); })(M || (M = { diff --git a/crates/swc/tests/tsc-references/jsx/tsxEmit3x/input.tsx/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/jsx/tsxEmit3x/input.tsx/es2015.2.minified/output.js index 98c7f658dcd..8580422f5ae 100644 --- a/crates/swc/tests/tsc-references/jsx/tsxEmit3x/input.tsx/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/jsx/tsxEmit3x/input.tsx/es2015.2.minified/output.js @@ -1,15 +1,20 @@ var M; !function(M1) { - var S; M1.Foo = class { constructor(){ } - }, (S || (S = { + }; + let S; + (S || (S = { })).Bar = class { }, M1.S = S; }(M || (M = { +})), (function(M2) { + React.createElement(Foo, null); + let S; + S || (S = { + }), React.createElement(Foo, null), React.createElement(Bar, null), M2.S = S; +})(M || (M = { })), M || (M = { -}), React.createElement(Foo, null), S || (S = { -}), React.createElement(Foo, null), React.createElement(Bar, null), M || (M = { }), React.createElement(S.Bar, null), M || (M = { }), React.createElement(Foo, null); diff --git a/crates/swc/tests/tsc-references/jsx/tsxEmit3x/input.tsx/es5.1.normal/output.js b/crates/swc/tests/tsc-references/jsx/tsxEmit3x/input.tsx/es5.1.normal/output.js index a6fc01ecd7e..3a3020f8372 100644 --- a/crates/swc/tests/tsc-references/jsx/tsxEmit3x/input.tsx/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/jsx/tsxEmit3x/input.tsx/es5.1.normal/output.js @@ -22,9 +22,10 @@ var M; M1.S = S1; })(M || (M = { })); -(function(M) { +(function(M2) { // Emit M.Foo Foo, /*#__PURE__*/ React.createElement(Foo, null); + var S; (function(S) { // Emit M.Foo Foo, /*#__PURE__*/ React.createElement(Foo, null); @@ -32,6 +33,7 @@ var M; Bar, /*#__PURE__*/ React.createElement(Bar, null); })(S || (S = { })); + M2.S = S; })(M || (M = { })); (function(M) { @@ -40,7 +42,7 @@ var M; })(M || (M = { })); (function(M) { - var M2 = 100; + var M3 = 100; // Emit M_1.Foo Foo, /*#__PURE__*/ React.createElement(Foo, null); })(M || (M = { diff --git a/crates/swc/tests/tsc-references/jsx/tsxEmit3x/input.tsx/es5.2.minified/output.js b/crates/swc/tests/tsc-references/jsx/tsxEmit3x/input.tsx/es5.2.minified/output.js index 726ffb9e82f..1bd44c77652 100644 --- a/crates/swc/tests/tsc-references/jsx/tsxEmit3x/input.tsx/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/jsx/tsxEmit3x/input.tsx/es5.2.minified/output.js @@ -13,8 +13,11 @@ function _classCallCheck(instance, Constructor) { _classCallCheck(this, Bar); }, S1.Bar = Bar, M1.S = S; }(M || (M = { +})), (function(M2) { + var S; + React.createElement(Foo, null), S || (S = { + }), React.createElement(Foo, null), React.createElement(Bar, null), M2.S = S; +})(M || (M = { })), M || (M = { -}), React.createElement(Foo, null), S || (S = { -}), React.createElement(Foo, null), React.createElement(Bar, null), M || (M = { }), React.createElement(S.Bar, null), M || (M = { }), React.createElement(Foo, null); diff --git a/crates/swc/tests/tsc-references/jsx/tsxGenericAttributesType9x/input.tsx/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/jsx/tsxGenericAttributesType9x/input.tsx/es2015.1.normal/output.js index 1dcf6e5cf8d..333499b5967 100644 --- a/crates/swc/tests/tsc-references/jsx/tsxGenericAttributesType9x/input.tsx/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/jsx/tsxGenericAttributesType9x/input.tsx/es2015.1.normal/output.js @@ -17,9 +17,9 @@ function _extends() { // @noLib: true // @skipLibCheck: true // @libFiles: react.d.ts,lib.d.ts -const React1 = require('react'); +const React = require('react'); export function makeP(Ctor) { - return class _class extends React1.PureComponent { + return class _class extends React.PureComponent { render() { return(/*#__PURE__*/ React.createElement(Ctor, _extends({ }, this.props))); diff --git a/crates/swc/tests/tsc-references/jsx/tsxGenericAttributesType9x/input.tsx/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/jsx/tsxGenericAttributesType9x/input.tsx/es2015.2.minified/output.js index 6286a34f9e2..6333fc60a0d 100644 --- a/crates/swc/tests/tsc-references/jsx/tsxGenericAttributesType9x/input.tsx/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/jsx/tsxGenericAttributesType9x/input.tsx/es2015.2.minified/output.js @@ -7,9 +7,9 @@ function _extends() { return target; }).apply(this, arguments); } -const React1 = require("react"); +const React = require("react"); export function makeP(Ctor) { - return class extends React1.PureComponent { + return class extends React.PureComponent { render() { return React.createElement(Ctor, _extends({ }, this.props)); diff --git a/crates/swc/tests/tsc-references/jsx/tsxGenericAttributesType9x/input.tsx/es5.1.normal/output.js b/crates/swc/tests/tsc-references/jsx/tsxGenericAttributesType9x/input.tsx/es5.1.normal/output.js index d6653370cd5..9ab762b110b 100644 --- a/crates/swc/tests/tsc-references/jsx/tsxGenericAttributesType9x/input.tsx/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/jsx/tsxGenericAttributesType9x/input.tsx/es5.1.normal/output.js @@ -102,7 +102,7 @@ function _createSuper(Derived) { // @noLib: true // @skipLibCheck: true // @libFiles: react.d.ts,lib.d.ts -var React1 = require('react'); +var React = require('react'); export function makeP(Ctor) { return /*#__PURE__*/ (function(_PureComponent) { "use strict"; @@ -122,5 +122,5 @@ export function makeP(Ctor) { } ]); return _class; - })(React1.PureComponent); + })(React.PureComponent); } diff --git a/crates/swc/tests/tsc-references/jsx/tsxGenericAttributesType9x/input.tsx/es5.2.minified/output.js b/crates/swc/tests/tsc-references/jsx/tsxGenericAttributesType9x/input.tsx/es5.2.minified/output.js index e162b6e1e81..b6a762b55c2 100644 --- a/crates/swc/tests/tsc-references/jsx/tsxGenericAttributesType9x/input.tsx/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/jsx/tsxGenericAttributesType9x/input.tsx/es5.2.minified/output.js @@ -23,7 +23,7 @@ function _setPrototypeOf(o, p) { return o.__proto__ = p, o; }, _setPrototypeOf(o, p); } -var React1 = require("react"); +var React = require("react"); export function makeP(Ctor) { return (function(_PureComponent) { "use strict"; @@ -75,5 +75,5 @@ export function makeP(Ctor) { } } ], _defineProperties(Constructor.prototype, protoProps), staticProps && _defineProperties(Constructor, staticProps), _class; - })(React1.PureComponent); + })(React.PureComponent); } diff --git a/crates/swc/tests/tsc-references/jsx/tsxPreserveEmit1x/input.tsx/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/jsx/tsxPreserveEmit1x/input.tsx/es2015.1.normal/output.js index 86bda07d206..ce2aa925570 100644 --- a/crates/swc/tests/tsc-references/jsx/tsxPreserveEmit1x/input.tsx/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/jsx/tsxPreserveEmit1x/input.tsx/es2015.1.normal/output.js @@ -1,6 +1,6 @@ //@Filename: test.tsx // Should emit 'react-router' in the AMD dependency list -const React1 = require('react'); +const React = require('react'); const ReactRouter = require('react-router'); var Route = ReactRouter.Route; var routes1 = /*#__PURE__*/ React.createElement(Route, null); diff --git a/crates/swc/tests/tsc-references/jsx/tsxPreserveEmit1x/input.tsx/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/jsx/tsxPreserveEmit1x/input.tsx/es2015.2.minified/output.js index a73ffe8a70e..ea62710c6a8 100644 --- a/crates/swc/tests/tsc-references/jsx/tsxPreserveEmit1x/input.tsx/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/jsx/tsxPreserveEmit1x/input.tsx/es2015.2.minified/output.js @@ -1,5 +1,4 @@ -require("react"); -const ReactRouter = require("react-router"); +const React = require("react"), ReactRouter = require("react-router"); var M, Route = ReactRouter.Route; React.createElement(Route, null), (function(M1) { var X; diff --git a/crates/swc/tests/tsc-references/jsx/tsxPreserveEmit1x/input.tsx/es5.1.normal/output.js b/crates/swc/tests/tsc-references/jsx/tsxPreserveEmit1x/input.tsx/es5.1.normal/output.js index 3b917a0668c..11575c44cfb 100644 --- a/crates/swc/tests/tsc-references/jsx/tsxPreserveEmit1x/input.tsx/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/jsx/tsxPreserveEmit1x/input.tsx/es5.1.normal/output.js @@ -1,6 +1,6 @@ //@Filename: test.tsx // Should emit 'react-router' in the AMD dependency list -var React1 = require('react'); +var React = require('react'); var ReactRouter = require('react-router'); var Route = ReactRouter.Route; var routes1 = /*#__PURE__*/ React.createElement(Route, null); diff --git a/crates/swc/tests/tsc-references/jsx/tsxPreserveEmit1x/input.tsx/es5.2.minified/output.js b/crates/swc/tests/tsc-references/jsx/tsxPreserveEmit1x/input.tsx/es5.2.minified/output.js index 88976cfc6c9..2f7dceb3639 100644 --- a/crates/swc/tests/tsc-references/jsx/tsxPreserveEmit1x/input.tsx/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/jsx/tsxPreserveEmit1x/input.tsx/es5.2.minified/output.js @@ -1,5 +1,4 @@ -require("react"); -var M, Route = require("react-router").Route; +var M, React = require("react"), Route = require("react-router").Route; React.createElement(Route, null), (function(M1) { var X; M1.X = X; diff --git a/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserEnum1/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserEnum1/input.ts/es2015.1.normal/output.js index 16c60115327..402ed63ac7a 100644 --- a/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserEnum1/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserEnum1/input.ts/es2015.1.normal/output.js @@ -1,8 +1,8 @@ export var SignatureFlags; -(function(SignatureFlags1) { - SignatureFlags1[SignatureFlags1["None"] = 0] = "None"; - SignatureFlags1[SignatureFlags1["IsIndexer"] = 1] = "IsIndexer"; - SignatureFlags1[SignatureFlags1["IsStringIndexer"] = 2] = "IsStringIndexer"; - SignatureFlags1[SignatureFlags1["IsNumberIndexer"] = 4] = "IsNumberIndexer"; +(function(SignatureFlags) { + SignatureFlags[SignatureFlags["None"] = 0] = "None"; + SignatureFlags[SignatureFlags["IsIndexer"] = 1] = "IsIndexer"; + SignatureFlags[SignatureFlags["IsStringIndexer"] = 2] = "IsStringIndexer"; + SignatureFlags[SignatureFlags["IsNumberIndexer"] = 4] = "IsNumberIndexer"; })(SignatureFlags || (SignatureFlags = { })); diff --git a/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserEnum1/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserEnum1/input.ts/es2015.2.minified/output.js index 1b892aa7eee..7fdb7ee7645 100644 --- a/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserEnum1/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserEnum1/input.ts/es2015.2.minified/output.js @@ -1,3 +1,3 @@ -var SignatureFlags, SignatureFlags1; -(SignatureFlags1 = SignatureFlags || (SignatureFlags = { -}))[SignatureFlags1.None = 0] = "None", SignatureFlags1[SignatureFlags1.IsIndexer = 1] = "IsIndexer", SignatureFlags1[SignatureFlags1.IsStringIndexer = 2] = "IsStringIndexer", SignatureFlags1[SignatureFlags1.IsNumberIndexer = 4] = "IsNumberIndexer"; +var SignatureFlags, SignatureFlags; +(SignatureFlags = SignatureFlags || (SignatureFlags = { +}))[SignatureFlags.None = 0] = "None", SignatureFlags[SignatureFlags.IsIndexer = 1] = "IsIndexer", SignatureFlags[SignatureFlags.IsStringIndexer = 2] = "IsStringIndexer", SignatureFlags[SignatureFlags.IsNumberIndexer = 4] = "IsNumberIndexer"; diff --git a/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserEnum1/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserEnum1/input.ts/es5.1.normal/output.js index 16c60115327..402ed63ac7a 100644 --- a/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserEnum1/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserEnum1/input.ts/es5.1.normal/output.js @@ -1,8 +1,8 @@ export var SignatureFlags; -(function(SignatureFlags1) { - SignatureFlags1[SignatureFlags1["None"] = 0] = "None"; - SignatureFlags1[SignatureFlags1["IsIndexer"] = 1] = "IsIndexer"; - SignatureFlags1[SignatureFlags1["IsStringIndexer"] = 2] = "IsStringIndexer"; - SignatureFlags1[SignatureFlags1["IsNumberIndexer"] = 4] = "IsNumberIndexer"; +(function(SignatureFlags) { + SignatureFlags[SignatureFlags["None"] = 0] = "None"; + SignatureFlags[SignatureFlags["IsIndexer"] = 1] = "IsIndexer"; + SignatureFlags[SignatureFlags["IsStringIndexer"] = 2] = "IsStringIndexer"; + SignatureFlags[SignatureFlags["IsNumberIndexer"] = 4] = "IsNumberIndexer"; })(SignatureFlags || (SignatureFlags = { })); diff --git a/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserEnum1/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserEnum1/input.ts/es5.2.minified/output.js index 1b892aa7eee..7fdb7ee7645 100644 --- a/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserEnum1/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserEnum1/input.ts/es5.2.minified/output.js @@ -1,3 +1,3 @@ -var SignatureFlags, SignatureFlags1; -(SignatureFlags1 = SignatureFlags || (SignatureFlags = { -}))[SignatureFlags1.None = 0] = "None", SignatureFlags1[SignatureFlags1.IsIndexer = 1] = "IsIndexer", SignatureFlags1[SignatureFlags1.IsStringIndexer = 2] = "IsStringIndexer", SignatureFlags1[SignatureFlags1.IsNumberIndexer = 4] = "IsNumberIndexer"; +var SignatureFlags, SignatureFlags; +(SignatureFlags = SignatureFlags || (SignatureFlags = { +}))[SignatureFlags.None = 0] = "None", SignatureFlags[SignatureFlags.IsIndexer = 1] = "IsIndexer", SignatureFlags[SignatureFlags.IsStringIndexer = 2] = "IsStringIndexer", SignatureFlags[SignatureFlags.IsNumberIndexer = 4] = "IsNumberIndexer"; diff --git a/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserEnum2/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserEnum2/input.ts/es2015.1.normal/output.js index 16c60115327..402ed63ac7a 100644 --- a/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserEnum2/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserEnum2/input.ts/es2015.1.normal/output.js @@ -1,8 +1,8 @@ export var SignatureFlags; -(function(SignatureFlags1) { - SignatureFlags1[SignatureFlags1["None"] = 0] = "None"; - SignatureFlags1[SignatureFlags1["IsIndexer"] = 1] = "IsIndexer"; - SignatureFlags1[SignatureFlags1["IsStringIndexer"] = 2] = "IsStringIndexer"; - SignatureFlags1[SignatureFlags1["IsNumberIndexer"] = 4] = "IsNumberIndexer"; +(function(SignatureFlags) { + SignatureFlags[SignatureFlags["None"] = 0] = "None"; + SignatureFlags[SignatureFlags["IsIndexer"] = 1] = "IsIndexer"; + SignatureFlags[SignatureFlags["IsStringIndexer"] = 2] = "IsStringIndexer"; + SignatureFlags[SignatureFlags["IsNumberIndexer"] = 4] = "IsNumberIndexer"; })(SignatureFlags || (SignatureFlags = { })); diff --git a/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserEnum2/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserEnum2/input.ts/es2015.2.minified/output.js index 1b892aa7eee..7fdb7ee7645 100644 --- a/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserEnum2/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserEnum2/input.ts/es2015.2.minified/output.js @@ -1,3 +1,3 @@ -var SignatureFlags, SignatureFlags1; -(SignatureFlags1 = SignatureFlags || (SignatureFlags = { -}))[SignatureFlags1.None = 0] = "None", SignatureFlags1[SignatureFlags1.IsIndexer = 1] = "IsIndexer", SignatureFlags1[SignatureFlags1.IsStringIndexer = 2] = "IsStringIndexer", SignatureFlags1[SignatureFlags1.IsNumberIndexer = 4] = "IsNumberIndexer"; +var SignatureFlags, SignatureFlags; +(SignatureFlags = SignatureFlags || (SignatureFlags = { +}))[SignatureFlags.None = 0] = "None", SignatureFlags[SignatureFlags.IsIndexer = 1] = "IsIndexer", SignatureFlags[SignatureFlags.IsStringIndexer = 2] = "IsStringIndexer", SignatureFlags[SignatureFlags.IsNumberIndexer = 4] = "IsNumberIndexer"; diff --git a/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserEnum2/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserEnum2/input.ts/es5.1.normal/output.js index 16c60115327..402ed63ac7a 100644 --- a/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserEnum2/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserEnum2/input.ts/es5.1.normal/output.js @@ -1,8 +1,8 @@ export var SignatureFlags; -(function(SignatureFlags1) { - SignatureFlags1[SignatureFlags1["None"] = 0] = "None"; - SignatureFlags1[SignatureFlags1["IsIndexer"] = 1] = "IsIndexer"; - SignatureFlags1[SignatureFlags1["IsStringIndexer"] = 2] = "IsStringIndexer"; - SignatureFlags1[SignatureFlags1["IsNumberIndexer"] = 4] = "IsNumberIndexer"; +(function(SignatureFlags) { + SignatureFlags[SignatureFlags["None"] = 0] = "None"; + SignatureFlags[SignatureFlags["IsIndexer"] = 1] = "IsIndexer"; + SignatureFlags[SignatureFlags["IsStringIndexer"] = 2] = "IsStringIndexer"; + SignatureFlags[SignatureFlags["IsNumberIndexer"] = 4] = "IsNumberIndexer"; })(SignatureFlags || (SignatureFlags = { })); diff --git a/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserEnum2/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserEnum2/input.ts/es5.2.minified/output.js index 1b892aa7eee..7fdb7ee7645 100644 --- a/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserEnum2/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserEnum2/input.ts/es5.2.minified/output.js @@ -1,3 +1,3 @@ -var SignatureFlags, SignatureFlags1; -(SignatureFlags1 = SignatureFlags || (SignatureFlags = { -}))[SignatureFlags1.None = 0] = "None", SignatureFlags1[SignatureFlags1.IsIndexer = 1] = "IsIndexer", SignatureFlags1[SignatureFlags1.IsStringIndexer = 2] = "IsStringIndexer", SignatureFlags1[SignatureFlags1.IsNumberIndexer = 4] = "IsNumberIndexer"; +var SignatureFlags, SignatureFlags; +(SignatureFlags = SignatureFlags || (SignatureFlags = { +}))[SignatureFlags.None = 0] = "None", SignatureFlags[SignatureFlags.IsIndexer = 1] = "IsIndexer", SignatureFlags[SignatureFlags.IsStringIndexer = 2] = "IsStringIndexer", SignatureFlags[SignatureFlags.IsNumberIndexer = 4] = "IsNumberIndexer"; diff --git a/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserEnum6/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserEnum6/input.ts/es2015.1.normal/output.js index 97af782366c..857c3340038 100644 --- a/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserEnum6/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserEnum6/input.ts/es2015.1.normal/output.js @@ -1,7 +1,7 @@ var E; -(function(E1) { - E1[E1["A"] = 0] = "A"; - E1[E1["B"] = 1] = "B"; - E1[E1["C"] = 2] = "C"; +(function(E) { + E[E["A"] = 0] = "A"; + E[E["B"] = 1] = "B"; + E[E["C"] = 2] = "C"; })(E || (E = { })); diff --git a/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserEnum6/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserEnum6/input.ts/es2015.2.minified/output.js index 07aa7d9a2f5..bc1aac8379a 100644 --- a/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserEnum6/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserEnum6/input.ts/es2015.2.minified/output.js @@ -1,3 +1,3 @@ -var E, E1; -(E1 = E || (E = { -}))[E1.A = 0] = "A", E1[E1.B = 1] = "B", E1[E1.C = 2] = "C"; +var E, E; +(E = E || (E = { +}))[E.A = 0] = "A", E[E.B = 1] = "B", E[E.C = 2] = "C"; diff --git a/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserEnum6/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserEnum6/input.ts/es5.1.normal/output.js index 97af782366c..857c3340038 100644 --- a/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserEnum6/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserEnum6/input.ts/es5.1.normal/output.js @@ -1,7 +1,7 @@ var E; -(function(E1) { - E1[E1["A"] = 0] = "A"; - E1[E1["B"] = 1] = "B"; - E1[E1["C"] = 2] = "C"; +(function(E) { + E[E["A"] = 0] = "A"; + E[E["B"] = 1] = "B"; + E[E["C"] = 2] = "C"; })(E || (E = { })); diff --git a/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserEnum6/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserEnum6/input.ts/es5.2.minified/output.js index 07aa7d9a2f5..bc1aac8379a 100644 --- a/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserEnum6/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserEnum6/input.ts/es5.2.minified/output.js @@ -1,3 +1,3 @@ -var E, E1; -(E1 = E || (E = { -}))[E1.A = 0] = "A", E1[E1.B = 1] = "B", E1[E1.C = 2] = "C"; +var E, E; +(E = E || (E = { +}))[E.A = 0] = "A", E[E.B = 1] = "B", E[E.C = 2] = "C"; diff --git a/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserEnumDeclaration1/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserEnumDeclaration1/input.ts/es2015.1.normal/output.js index 580e01d9fd6..59b2ce1ca0a 100644 --- a/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserEnumDeclaration1/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserEnumDeclaration1/input.ts/es2015.1.normal/output.js @@ -1,6 +1,6 @@ var E; -(function(E1) { - E1[E1["Foo"] = 1] = "Foo"; - E1[E1["Bar"] = 2] = "Bar"; +(function(E) { + E[E["Foo"] = 1] = "Foo"; + E[E["Bar"] = 2] = "Bar"; })(E || (E = { })); diff --git a/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserEnumDeclaration1/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserEnumDeclaration1/input.ts/es2015.2.minified/output.js index 9f1447846c3..665d2e372e0 100644 --- a/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserEnumDeclaration1/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserEnumDeclaration1/input.ts/es2015.2.minified/output.js @@ -1,3 +1,3 @@ -var E, E1; -(E1 = E || (E = { -}))[E1.Foo = 1] = "Foo", E1[E1.Bar = 2] = "Bar"; +var E, E; +(E = E || (E = { +}))[E.Foo = 1] = "Foo", E[E.Bar = 2] = "Bar"; diff --git a/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserEnumDeclaration1/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserEnumDeclaration1/input.ts/es5.1.normal/output.js index 580e01d9fd6..59b2ce1ca0a 100644 --- a/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserEnumDeclaration1/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserEnumDeclaration1/input.ts/es5.1.normal/output.js @@ -1,6 +1,6 @@ var E; -(function(E1) { - E1[E1["Foo"] = 1] = "Foo"; - E1[E1["Bar"] = 2] = "Bar"; +(function(E) { + E[E["Foo"] = 1] = "Foo"; + E[E["Bar"] = 2] = "Bar"; })(E || (E = { })); diff --git a/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserEnumDeclaration1/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserEnumDeclaration1/input.ts/es5.2.minified/output.js index 9f1447846c3..665d2e372e0 100644 --- a/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserEnumDeclaration1/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserEnumDeclaration1/input.ts/es5.2.minified/output.js @@ -1,3 +1,3 @@ -var E, E1; -(E1 = E || (E = { -}))[E1.Foo = 1] = "Foo", E1[E1.Bar = 2] = "Bar"; +var E, E; +(E = E || (E = { +}))[E.Foo = 1] = "Foo", E[E.Bar = 2] = "Bar"; diff --git a/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserEnumDeclaration3/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserEnumDeclaration3/input.ts/es2015.1.normal/output.js index c20a0da99a2..ffae698b70b 100644 --- a/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserEnumDeclaration3/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserEnumDeclaration3/input.ts/es2015.1.normal/output.js @@ -1,5 +1,5 @@ var E; -(function(E1) { - E1[E1["A"] = 1] = "A"; +(function(E) { + E[E["A"] = 1] = "A"; })(E || (E = { })); diff --git a/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserEnumDeclaration3/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserEnumDeclaration3/input.ts/es2015.2.minified/output.js index abf273d0515..6004f0a16a1 100644 --- a/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserEnumDeclaration3/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserEnumDeclaration3/input.ts/es2015.2.minified/output.js @@ -1,3 +1,3 @@ -var E, E1; -(E1 = E || (E = { -}))[E1.A = 1] = "A"; +var E, E; +(E = E || (E = { +}))[E.A = 1] = "A"; diff --git a/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserEnumDeclaration3/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserEnumDeclaration3/input.ts/es5.1.normal/output.js index c20a0da99a2..ffae698b70b 100644 --- a/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserEnumDeclaration3/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserEnumDeclaration3/input.ts/es5.1.normal/output.js @@ -1,5 +1,5 @@ var E; -(function(E1) { - E1[E1["A"] = 1] = "A"; +(function(E) { + E[E["A"] = 1] = "A"; })(E || (E = { })); diff --git a/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserEnumDeclaration3/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserEnumDeclaration3/input.ts/es5.2.minified/output.js index abf273d0515..6004f0a16a1 100644 --- a/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserEnumDeclaration3/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserEnumDeclaration3/input.ts/es5.2.minified/output.js @@ -1,3 +1,3 @@ -var E, E1; -(E1 = E || (E = { -}))[E1.A = 1] = "A"; +var E, E; +(E = E || (E = { +}))[E.A = 1] = "A"; diff --git a/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserEnumDeclaration5/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserEnumDeclaration5/input.ts/es2015.1.normal/output.js index f4aeb2b57e1..1891926cb24 100644 --- a/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserEnumDeclaration5/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserEnumDeclaration5/input.ts/es2015.1.normal/output.js @@ -1,8 +1,8 @@ var E; -(function(E1) { - E1[E1["A"] = 1] = "A"; - E1[E1["B"] = 2] = "B"; - E1[E1["C"] = 2] = "C"; - E1[E1["D"] = 3] = "D"; +(function(E) { + E[E["A"] = 1] = "A"; + E[E["B"] = 2] = "B"; + E[E["C"] = 2] = "C"; + E[E["D"] = 3] = "D"; })(E || (E = { })); diff --git a/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserEnumDeclaration5/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserEnumDeclaration5/input.ts/es2015.2.minified/output.js index 62d2ea08f84..10cd5d20bdd 100644 --- a/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserEnumDeclaration5/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserEnumDeclaration5/input.ts/es2015.2.minified/output.js @@ -1,3 +1,3 @@ -var E, E1; -(E1 = E || (E = { -}))[E1.A = 1] = "A", E1[E1.B = 2] = "B", E1[E1.C = 2] = "C", E1[E1.D = 3] = "D"; +var E, E; +(E = E || (E = { +}))[E.A = 1] = "A", E[E.B = 2] = "B", E[E.C = 2] = "C", E[E.D = 3] = "D"; diff --git a/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserEnumDeclaration5/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserEnumDeclaration5/input.ts/es5.1.normal/output.js index f4aeb2b57e1..1891926cb24 100644 --- a/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserEnumDeclaration5/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserEnumDeclaration5/input.ts/es5.1.normal/output.js @@ -1,8 +1,8 @@ var E; -(function(E1) { - E1[E1["A"] = 1] = "A"; - E1[E1["B"] = 2] = "B"; - E1[E1["C"] = 2] = "C"; - E1[E1["D"] = 3] = "D"; +(function(E) { + E[E["A"] = 1] = "A"; + E[E["B"] = 2] = "B"; + E[E["C"] = 2] = "C"; + E[E["D"] = 3] = "D"; })(E || (E = { })); diff --git a/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserEnumDeclaration5/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserEnumDeclaration5/input.ts/es5.2.minified/output.js index 62d2ea08f84..10cd5d20bdd 100644 --- a/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserEnumDeclaration5/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserEnumDeclaration5/input.ts/es5.2.minified/output.js @@ -1,3 +1,3 @@ -var E, E1; -(E1 = E || (E = { -}))[E1.A = 1] = "A", E1[E1.B = 2] = "B", E1[E1.C = 2] = "C", E1[E1.D = 3] = "D"; +var E, E; +(E = E || (E = { +}))[E.A = 1] = "A", E[E.B = 2] = "B", E[E.C = 2] = "C", E[E.D = 3] = "D"; diff --git a/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserEnumDeclaration6/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserEnumDeclaration6/input.ts/es2015.1.normal/output.js index f4aeb2b57e1..1891926cb24 100644 --- a/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserEnumDeclaration6/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserEnumDeclaration6/input.ts/es2015.1.normal/output.js @@ -1,8 +1,8 @@ var E; -(function(E1) { - E1[E1["A"] = 1] = "A"; - E1[E1["B"] = 2] = "B"; - E1[E1["C"] = 2] = "C"; - E1[E1["D"] = 3] = "D"; +(function(E) { + E[E["A"] = 1] = "A"; + E[E["B"] = 2] = "B"; + E[E["C"] = 2] = "C"; + E[E["D"] = 3] = "D"; })(E || (E = { })); diff --git a/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserEnumDeclaration6/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserEnumDeclaration6/input.ts/es2015.2.minified/output.js index 62d2ea08f84..10cd5d20bdd 100644 --- a/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserEnumDeclaration6/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserEnumDeclaration6/input.ts/es2015.2.minified/output.js @@ -1,3 +1,3 @@ -var E, E1; -(E1 = E || (E = { -}))[E1.A = 1] = "A", E1[E1.B = 2] = "B", E1[E1.C = 2] = "C", E1[E1.D = 3] = "D"; +var E, E; +(E = E || (E = { +}))[E.A = 1] = "A", E[E.B = 2] = "B", E[E.C = 2] = "C", E[E.D = 3] = "D"; diff --git a/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserEnumDeclaration6/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserEnumDeclaration6/input.ts/es5.1.normal/output.js index f4aeb2b57e1..1891926cb24 100644 --- a/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserEnumDeclaration6/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserEnumDeclaration6/input.ts/es5.1.normal/output.js @@ -1,8 +1,8 @@ var E; -(function(E1) { - E1[E1["A"] = 1] = "A"; - E1[E1["B"] = 2] = "B"; - E1[E1["C"] = 2] = "C"; - E1[E1["D"] = 3] = "D"; +(function(E) { + E[E["A"] = 1] = "A"; + E[E["B"] = 2] = "B"; + E[E["C"] = 2] = "C"; + E[E["D"] = 3] = "D"; })(E || (E = { })); diff --git a/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserEnumDeclaration6/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserEnumDeclaration6/input.ts/es5.2.minified/output.js index 62d2ea08f84..10cd5d20bdd 100644 --- a/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserEnumDeclaration6/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserEnumDeclaration6/input.ts/es5.2.minified/output.js @@ -1,3 +1,3 @@ -var E, E1; -(E1 = E || (E = { -}))[E1.A = 1] = "A", E1[E1.B = 2] = "B", E1[E1.C = 2] = "C", E1[E1.D = 3] = "D"; +var E, E; +(E = E || (E = { +}))[E.A = 1] = "A", E[E.B = 2] = "B", E[E.C = 2] = "C", E[E.D = 3] = "D"; diff --git a/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserInterfaceKeywordInEnum/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserInterfaceKeywordInEnum/input.ts/es2015.1.normal/output.js index bac314f6c94..9b2f1b678c4 100644 --- a/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserInterfaceKeywordInEnum/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserInterfaceKeywordInEnum/input.ts/es2015.1.normal/output.js @@ -1,5 +1,5 @@ var Bar; -(function(Bar1) { - Bar1[Bar1["interface"] = 0] = "interface"; +(function(Bar) { + Bar[Bar["interface"] = 0] = "interface"; })(Bar || (Bar = { })); diff --git a/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserInterfaceKeywordInEnum/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserInterfaceKeywordInEnum/input.ts/es2015.2.minified/output.js index e176d2ae7f2..27fde13f748 100644 --- a/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserInterfaceKeywordInEnum/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserInterfaceKeywordInEnum/input.ts/es2015.2.minified/output.js @@ -1,3 +1,3 @@ -var Bar, Bar1; -(Bar1 = Bar || (Bar = { -}))[Bar1.interface = 0] = "interface"; +var Bar, Bar; +(Bar = Bar || (Bar = { +}))[Bar.interface = 0] = "interface"; diff --git a/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserInterfaceKeywordInEnum/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserInterfaceKeywordInEnum/input.ts/es5.1.normal/output.js index bac314f6c94..9b2f1b678c4 100644 --- a/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserInterfaceKeywordInEnum/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserInterfaceKeywordInEnum/input.ts/es5.1.normal/output.js @@ -1,5 +1,5 @@ var Bar; -(function(Bar1) { - Bar1[Bar1["interface"] = 0] = "interface"; +(function(Bar) { + Bar[Bar["interface"] = 0] = "interface"; })(Bar || (Bar = { })); diff --git a/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserInterfaceKeywordInEnum/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserInterfaceKeywordInEnum/input.ts/es5.2.minified/output.js index e176d2ae7f2..27fde13f748 100644 --- a/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserInterfaceKeywordInEnum/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserInterfaceKeywordInEnum/input.ts/es5.2.minified/output.js @@ -1,3 +1,3 @@ -var Bar, Bar1; -(Bar1 = Bar || (Bar = { -}))[Bar1.interface = 0] = "interface"; +var Bar, Bar; +(Bar = Bar || (Bar = { +}))[Bar.interface = 0] = "interface"; diff --git a/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserInterfaceKeywordInEnum1/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserInterfaceKeywordInEnum1/input.ts/es2015.1.normal/output.js index 074ac6f6a08..bd2bebdf439 100644 --- a/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserInterfaceKeywordInEnum1/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserInterfaceKeywordInEnum1/input.ts/es2015.1.normal/output.js @@ -1,6 +1,6 @@ "use strict"; var Bar; -(function(Bar1) { - Bar1[Bar1["interface"] = 0] = "interface"; +(function(Bar) { + Bar[Bar["interface"] = 0] = "interface"; })(Bar || (Bar = { })); diff --git a/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserInterfaceKeywordInEnum1/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserInterfaceKeywordInEnum1/input.ts/es2015.2.minified/output.js index 7e550922d47..df32fdf02de 100644 --- a/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserInterfaceKeywordInEnum1/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserInterfaceKeywordInEnum1/input.ts/es2015.2.minified/output.js @@ -1,4 +1,4 @@ "use strict"; -var Bar, Bar1; -(Bar1 = Bar || (Bar = { -}))[Bar1.interface = 0] = "interface"; +var Bar, Bar; +(Bar = Bar || (Bar = { +}))[Bar.interface = 0] = "interface"; diff --git a/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserInterfaceKeywordInEnum1/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserInterfaceKeywordInEnum1/input.ts/es5.1.normal/output.js index 074ac6f6a08..bd2bebdf439 100644 --- a/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserInterfaceKeywordInEnum1/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserInterfaceKeywordInEnum1/input.ts/es5.1.normal/output.js @@ -1,6 +1,6 @@ "use strict"; var Bar; -(function(Bar1) { - Bar1[Bar1["interface"] = 0] = "interface"; +(function(Bar) { + Bar[Bar["interface"] = 0] = "interface"; })(Bar || (Bar = { })); diff --git a/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserInterfaceKeywordInEnum1/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserInterfaceKeywordInEnum1/input.ts/es5.2.minified/output.js index 7e550922d47..df32fdf02de 100644 --- a/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserInterfaceKeywordInEnum1/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/parser/ecmascript5/EnumDeclarations/parserInterfaceKeywordInEnum1/input.ts/es5.2.minified/output.js @@ -1,4 +1,4 @@ "use strict"; -var Bar, Bar1; -(Bar1 = Bar || (Bar = { -}))[Bar1.interface = 0] = "interface"; +var Bar, Bar; +(Bar = Bar || (Bar = { +}))[Bar.interface = 0] = "interface"; diff --git a/crates/swc/tests/tsc-references/parser/ecmascript5/parserRealSource1/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/parser/ecmascript5/parserRealSource1/input.ts/es2015.1.normal/output.js index fe03ac14098..8efa840746d 100644 --- a/crates/swc/tests/tsc-references/parser/ecmascript5/parserRealSource1/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/parser/ecmascript5/parserRealSource1/input.ts/es2015.1.normal/output.js @@ -3,7 +3,7 @@ /// var TypeScript; (function(TypeScript1) { - var CompilerDiagnostics1; + let CompilerDiagnostics1; (function(CompilerDiagnostics) { CompilerDiagnostics.debug = false; CompilerDiagnostics.diagnosticWriter = null; diff --git a/crates/swc/tests/tsc-references/parser/ecmascript5/parserRealSource1/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/parser/ecmascript5/parserRealSource1/input.ts/es2015.2.minified/output.js index 167ac36c692..1ddd104860d 100644 --- a/crates/swc/tests/tsc-references/parser/ecmascript5/parserRealSource1/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/parser/ecmascript5/parserRealSource1/input.ts/es2015.2.minified/output.js @@ -1,6 +1,6 @@ var TypeScript; !function(TypeScript1) { - var CompilerDiagnostics1; + let CompilerDiagnostics1; !function(CompilerDiagnostics) { function Alert(output) { diagnosticWriter && diagnosticWriter.Alert(output); diff --git a/crates/swc/tests/tsc-references/parser/ecmascript5/parserRealSource12/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/parser/ecmascript5/parserRealSource12/input.ts/es2015.1.normal/output.js index 3e537052034..3a20bd9ae13 100644 --- a/crates/swc/tests/tsc-references/parser/ecmascript5/parserRealSource12/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/parser/ecmascript5/parserRealSource12/input.ts/es2015.1.normal/output.js @@ -64,113 +64,113 @@ var TypeScript; return new AstWalker(this.childrenWalkers, pre, post, options, state); } initChildrenWalkers() { - this.childrenWalkers[NodeType.None] = ChildrenWalkers1.walkNone; - this.childrenWalkers[NodeType.Empty] = ChildrenWalkers1.walkNone; - this.childrenWalkers[NodeType.EmptyExpr] = ChildrenWalkers1.walkNone; - this.childrenWalkers[NodeType.True] = ChildrenWalkers1.walkNone; - this.childrenWalkers[NodeType.False] = ChildrenWalkers1.walkNone; - this.childrenWalkers[NodeType.This] = ChildrenWalkers1.walkNone; - this.childrenWalkers[NodeType.Super] = ChildrenWalkers1.walkNone; - this.childrenWalkers[NodeType.QString] = ChildrenWalkers1.walkNone; - this.childrenWalkers[NodeType.Regex] = ChildrenWalkers1.walkNone; - this.childrenWalkers[NodeType.Null] = ChildrenWalkers1.walkNone; - this.childrenWalkers[NodeType.ArrayLit] = ChildrenWalkers1.walkUnaryExpressionChildren; - this.childrenWalkers[NodeType.ObjectLit] = ChildrenWalkers1.walkUnaryExpressionChildren; - this.childrenWalkers[NodeType.Void] = ChildrenWalkers1.walkUnaryExpressionChildren; - this.childrenWalkers[NodeType.Comma] = ChildrenWalkers1.walkBinaryExpressionChildren; - this.childrenWalkers[NodeType.Pos] = ChildrenWalkers1.walkUnaryExpressionChildren; - this.childrenWalkers[NodeType.Neg] = ChildrenWalkers1.walkUnaryExpressionChildren; - this.childrenWalkers[NodeType.Delete] = ChildrenWalkers1.walkUnaryExpressionChildren; - this.childrenWalkers[NodeType.Await] = ChildrenWalkers1.walkUnaryExpressionChildren; - this.childrenWalkers[NodeType.In] = ChildrenWalkers1.walkBinaryExpressionChildren; - this.childrenWalkers[NodeType.Dot] = ChildrenWalkers1.walkBinaryExpressionChildren; - this.childrenWalkers[NodeType.From] = ChildrenWalkers1.walkBinaryExpressionChildren; - this.childrenWalkers[NodeType.Is] = ChildrenWalkers1.walkBinaryExpressionChildren; - this.childrenWalkers[NodeType.InstOf] = ChildrenWalkers1.walkBinaryExpressionChildren; - this.childrenWalkers[NodeType.Typeof] = ChildrenWalkers1.walkUnaryExpressionChildren; - this.childrenWalkers[NodeType.NumberLit] = ChildrenWalkers1.walkNone; - this.childrenWalkers[NodeType.Name] = ChildrenWalkers1.walkNone; - this.childrenWalkers[NodeType.TypeRef] = ChildrenWalkers1.walkTypeReferenceChildren; - this.childrenWalkers[NodeType.Index] = ChildrenWalkers1.walkBinaryExpressionChildren; - this.childrenWalkers[NodeType.Call] = ChildrenWalkers1.walkCallExpressionChildren; - this.childrenWalkers[NodeType.New] = ChildrenWalkers1.walkCallExpressionChildren; - this.childrenWalkers[NodeType.Asg] = ChildrenWalkers1.walkBinaryExpressionChildren; - this.childrenWalkers[NodeType.AsgAdd] = ChildrenWalkers1.walkBinaryExpressionChildren; - this.childrenWalkers[NodeType.AsgSub] = ChildrenWalkers1.walkBinaryExpressionChildren; - this.childrenWalkers[NodeType.AsgDiv] = ChildrenWalkers1.walkBinaryExpressionChildren; - this.childrenWalkers[NodeType.AsgMul] = ChildrenWalkers1.walkBinaryExpressionChildren; - this.childrenWalkers[NodeType.AsgMod] = ChildrenWalkers1.walkBinaryExpressionChildren; - this.childrenWalkers[NodeType.AsgAnd] = ChildrenWalkers1.walkBinaryExpressionChildren; - this.childrenWalkers[NodeType.AsgXor] = ChildrenWalkers1.walkBinaryExpressionChildren; - this.childrenWalkers[NodeType.AsgOr] = ChildrenWalkers1.walkBinaryExpressionChildren; - this.childrenWalkers[NodeType.AsgLsh] = ChildrenWalkers1.walkBinaryExpressionChildren; - this.childrenWalkers[NodeType.AsgRsh] = ChildrenWalkers1.walkBinaryExpressionChildren; - this.childrenWalkers[NodeType.AsgRs2] = ChildrenWalkers1.walkBinaryExpressionChildren; - this.childrenWalkers[NodeType.ConditionalExpression] = ChildrenWalkers1.walkTrinaryExpressionChildren; - this.childrenWalkers[NodeType.LogOr] = ChildrenWalkers1.walkBinaryExpressionChildren; - this.childrenWalkers[NodeType.LogAnd] = ChildrenWalkers1.walkBinaryExpressionChildren; - this.childrenWalkers[NodeType.Or] = ChildrenWalkers1.walkBinaryExpressionChildren; - this.childrenWalkers[NodeType.Xor] = ChildrenWalkers1.walkBinaryExpressionChildren; - this.childrenWalkers[NodeType.And] = ChildrenWalkers1.walkBinaryExpressionChildren; - this.childrenWalkers[NodeType.Eq] = ChildrenWalkers1.walkBinaryExpressionChildren; - this.childrenWalkers[NodeType.Ne] = ChildrenWalkers1.walkBinaryExpressionChildren; - this.childrenWalkers[NodeType.Eqv] = ChildrenWalkers1.walkBinaryExpressionChildren; - this.childrenWalkers[NodeType.NEqv] = ChildrenWalkers1.walkBinaryExpressionChildren; - this.childrenWalkers[NodeType.Lt] = ChildrenWalkers1.walkBinaryExpressionChildren; - this.childrenWalkers[NodeType.Le] = ChildrenWalkers1.walkBinaryExpressionChildren; - this.childrenWalkers[NodeType.Gt] = ChildrenWalkers1.walkBinaryExpressionChildren; - this.childrenWalkers[NodeType.Ge] = ChildrenWalkers1.walkBinaryExpressionChildren; - this.childrenWalkers[NodeType.Add] = ChildrenWalkers1.walkBinaryExpressionChildren; - this.childrenWalkers[NodeType.Sub] = ChildrenWalkers1.walkBinaryExpressionChildren; - this.childrenWalkers[NodeType.Mul] = ChildrenWalkers1.walkBinaryExpressionChildren; - this.childrenWalkers[NodeType.Div] = ChildrenWalkers1.walkBinaryExpressionChildren; - this.childrenWalkers[NodeType.Mod] = ChildrenWalkers1.walkBinaryExpressionChildren; - this.childrenWalkers[NodeType.Lsh] = ChildrenWalkers1.walkBinaryExpressionChildren; - this.childrenWalkers[NodeType.Rsh] = ChildrenWalkers1.walkBinaryExpressionChildren; - this.childrenWalkers[NodeType.Rs2] = ChildrenWalkers1.walkBinaryExpressionChildren; - this.childrenWalkers[NodeType.Not] = ChildrenWalkers1.walkUnaryExpressionChildren; - this.childrenWalkers[NodeType.LogNot] = ChildrenWalkers1.walkUnaryExpressionChildren; - this.childrenWalkers[NodeType.IncPre] = ChildrenWalkers1.walkUnaryExpressionChildren; - this.childrenWalkers[NodeType.DecPre] = ChildrenWalkers1.walkUnaryExpressionChildren; - this.childrenWalkers[NodeType.IncPost] = ChildrenWalkers1.walkUnaryExpressionChildren; - this.childrenWalkers[NodeType.DecPost] = ChildrenWalkers1.walkUnaryExpressionChildren; - this.childrenWalkers[NodeType.TypeAssertion] = ChildrenWalkers1.walkUnaryExpressionChildren; - this.childrenWalkers[NodeType.FuncDecl] = ChildrenWalkers1.walkFuncDeclChildren; - this.childrenWalkers[NodeType.Member] = ChildrenWalkers1.walkBinaryExpressionChildren; - this.childrenWalkers[NodeType.VarDecl] = ChildrenWalkers1.walkBoundDeclChildren; - this.childrenWalkers[NodeType.ArgDecl] = ChildrenWalkers1.walkBoundDeclChildren; - this.childrenWalkers[NodeType.Return] = ChildrenWalkers1.walkReturnStatementChildren; - this.childrenWalkers[NodeType.Break] = ChildrenWalkers1.walkNone; - this.childrenWalkers[NodeType.Continue] = ChildrenWalkers1.walkNone; - this.childrenWalkers[NodeType.Throw] = ChildrenWalkers1.walkUnaryExpressionChildren; - this.childrenWalkers[NodeType.For] = ChildrenWalkers1.walkForStatementChildren; - this.childrenWalkers[NodeType.ForIn] = ChildrenWalkers1.walkForInStatementChildren; - this.childrenWalkers[NodeType.If] = ChildrenWalkers1.walkIfStatementChildren; - this.childrenWalkers[NodeType.While] = ChildrenWalkers1.walkWhileStatementChildren; - this.childrenWalkers[NodeType.DoWhile] = ChildrenWalkers1.walkDoWhileStatementChildren; - this.childrenWalkers[NodeType.Block] = ChildrenWalkers1.walkBlockChildren; - this.childrenWalkers[NodeType.Case] = ChildrenWalkers1.walkCaseStatementChildren; - this.childrenWalkers[NodeType.Switch] = ChildrenWalkers1.walkSwitchStatementChildren; - this.childrenWalkers[NodeType.Try] = ChildrenWalkers1.walkTryChildren; - this.childrenWalkers[NodeType.TryCatch] = ChildrenWalkers1.walkTryCatchChildren; - this.childrenWalkers[NodeType.TryFinally] = ChildrenWalkers1.walkTryFinallyChildren; - this.childrenWalkers[NodeType.Finally] = ChildrenWalkers1.walkFinallyChildren; - this.childrenWalkers[NodeType.Catch] = ChildrenWalkers1.walkCatchChildren; - this.childrenWalkers[NodeType.List] = ChildrenWalkers1.walkListChildren; - this.childrenWalkers[NodeType.Script] = ChildrenWalkers1.walkScriptChildren; - this.childrenWalkers[NodeType.ClassDeclaration] = ChildrenWalkers1.walkClassDeclChildren; - this.childrenWalkers[NodeType.InterfaceDeclaration] = ChildrenWalkers1.walkTypeDeclChildren; - this.childrenWalkers[NodeType.ModuleDeclaration] = ChildrenWalkers1.walkModuleDeclChildren; - this.childrenWalkers[NodeType.ImportDeclaration] = ChildrenWalkers1.walkImportDeclChildren; - this.childrenWalkers[NodeType.With] = ChildrenWalkers1.walkWithStatementChildren; - this.childrenWalkers[NodeType.Label] = ChildrenWalkers1.walkLabelChildren; - this.childrenWalkers[NodeType.LabeledStatement] = ChildrenWalkers1.walkLabeledStatementChildren; - this.childrenWalkers[NodeType.EBStart] = ChildrenWalkers1.walkNone; - this.childrenWalkers[NodeType.GotoEB] = ChildrenWalkers1.walkNone; - this.childrenWalkers[NodeType.EndCode] = ChildrenWalkers1.walkNone; - this.childrenWalkers[NodeType.Error] = ChildrenWalkers1.walkNone; - this.childrenWalkers[NodeType.Comment] = ChildrenWalkers1.walkNone; - this.childrenWalkers[NodeType.Debugger] = ChildrenWalkers1.walkNone; + this.childrenWalkers[NodeType.None] = ChildrenWalkers.walkNone; + this.childrenWalkers[NodeType.Empty] = ChildrenWalkers.walkNone; + this.childrenWalkers[NodeType.EmptyExpr] = ChildrenWalkers.walkNone; + this.childrenWalkers[NodeType.True] = ChildrenWalkers.walkNone; + this.childrenWalkers[NodeType.False] = ChildrenWalkers.walkNone; + this.childrenWalkers[NodeType.This] = ChildrenWalkers.walkNone; + this.childrenWalkers[NodeType.Super] = ChildrenWalkers.walkNone; + this.childrenWalkers[NodeType.QString] = ChildrenWalkers.walkNone; + this.childrenWalkers[NodeType.Regex] = ChildrenWalkers.walkNone; + this.childrenWalkers[NodeType.Null] = ChildrenWalkers.walkNone; + this.childrenWalkers[NodeType.ArrayLit] = ChildrenWalkers.walkUnaryExpressionChildren; + this.childrenWalkers[NodeType.ObjectLit] = ChildrenWalkers.walkUnaryExpressionChildren; + this.childrenWalkers[NodeType.Void] = ChildrenWalkers.walkUnaryExpressionChildren; + this.childrenWalkers[NodeType.Comma] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.Pos] = ChildrenWalkers.walkUnaryExpressionChildren; + this.childrenWalkers[NodeType.Neg] = ChildrenWalkers.walkUnaryExpressionChildren; + this.childrenWalkers[NodeType.Delete] = ChildrenWalkers.walkUnaryExpressionChildren; + this.childrenWalkers[NodeType.Await] = ChildrenWalkers.walkUnaryExpressionChildren; + this.childrenWalkers[NodeType.In] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.Dot] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.From] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.Is] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.InstOf] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.Typeof] = ChildrenWalkers.walkUnaryExpressionChildren; + this.childrenWalkers[NodeType.NumberLit] = ChildrenWalkers.walkNone; + this.childrenWalkers[NodeType.Name] = ChildrenWalkers.walkNone; + this.childrenWalkers[NodeType.TypeRef] = ChildrenWalkers.walkTypeReferenceChildren; + this.childrenWalkers[NodeType.Index] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.Call] = ChildrenWalkers.walkCallExpressionChildren; + this.childrenWalkers[NodeType.New] = ChildrenWalkers.walkCallExpressionChildren; + this.childrenWalkers[NodeType.Asg] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.AsgAdd] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.AsgSub] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.AsgDiv] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.AsgMul] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.AsgMod] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.AsgAnd] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.AsgXor] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.AsgOr] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.AsgLsh] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.AsgRsh] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.AsgRs2] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.ConditionalExpression] = ChildrenWalkers.walkTrinaryExpressionChildren; + this.childrenWalkers[NodeType.LogOr] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.LogAnd] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.Or] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.Xor] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.And] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.Eq] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.Ne] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.Eqv] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.NEqv] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.Lt] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.Le] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.Gt] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.Ge] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.Add] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.Sub] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.Mul] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.Div] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.Mod] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.Lsh] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.Rsh] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.Rs2] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.Not] = ChildrenWalkers.walkUnaryExpressionChildren; + this.childrenWalkers[NodeType.LogNot] = ChildrenWalkers.walkUnaryExpressionChildren; + this.childrenWalkers[NodeType.IncPre] = ChildrenWalkers.walkUnaryExpressionChildren; + this.childrenWalkers[NodeType.DecPre] = ChildrenWalkers.walkUnaryExpressionChildren; + this.childrenWalkers[NodeType.IncPost] = ChildrenWalkers.walkUnaryExpressionChildren; + this.childrenWalkers[NodeType.DecPost] = ChildrenWalkers.walkUnaryExpressionChildren; + this.childrenWalkers[NodeType.TypeAssertion] = ChildrenWalkers.walkUnaryExpressionChildren; + this.childrenWalkers[NodeType.FuncDecl] = ChildrenWalkers.walkFuncDeclChildren; + this.childrenWalkers[NodeType.Member] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.VarDecl] = ChildrenWalkers.walkBoundDeclChildren; + this.childrenWalkers[NodeType.ArgDecl] = ChildrenWalkers.walkBoundDeclChildren; + this.childrenWalkers[NodeType.Return] = ChildrenWalkers.walkReturnStatementChildren; + this.childrenWalkers[NodeType.Break] = ChildrenWalkers.walkNone; + this.childrenWalkers[NodeType.Continue] = ChildrenWalkers.walkNone; + this.childrenWalkers[NodeType.Throw] = ChildrenWalkers.walkUnaryExpressionChildren; + this.childrenWalkers[NodeType.For] = ChildrenWalkers.walkForStatementChildren; + this.childrenWalkers[NodeType.ForIn] = ChildrenWalkers.walkForInStatementChildren; + this.childrenWalkers[NodeType.If] = ChildrenWalkers.walkIfStatementChildren; + this.childrenWalkers[NodeType.While] = ChildrenWalkers.walkWhileStatementChildren; + this.childrenWalkers[NodeType.DoWhile] = ChildrenWalkers.walkDoWhileStatementChildren; + this.childrenWalkers[NodeType.Block] = ChildrenWalkers.walkBlockChildren; + this.childrenWalkers[NodeType.Case] = ChildrenWalkers.walkCaseStatementChildren; + this.childrenWalkers[NodeType.Switch] = ChildrenWalkers.walkSwitchStatementChildren; + this.childrenWalkers[NodeType.Try] = ChildrenWalkers.walkTryChildren; + this.childrenWalkers[NodeType.TryCatch] = ChildrenWalkers.walkTryCatchChildren; + this.childrenWalkers[NodeType.TryFinally] = ChildrenWalkers.walkTryFinallyChildren; + this.childrenWalkers[NodeType.Finally] = ChildrenWalkers.walkFinallyChildren; + this.childrenWalkers[NodeType.Catch] = ChildrenWalkers.walkCatchChildren; + this.childrenWalkers[NodeType.List] = ChildrenWalkers.walkListChildren; + this.childrenWalkers[NodeType.Script] = ChildrenWalkers.walkScriptChildren; + this.childrenWalkers[NodeType.ClassDeclaration] = ChildrenWalkers.walkClassDeclChildren; + this.childrenWalkers[NodeType.InterfaceDeclaration] = ChildrenWalkers.walkTypeDeclChildren; + this.childrenWalkers[NodeType.ModuleDeclaration] = ChildrenWalkers.walkModuleDeclChildren; + this.childrenWalkers[NodeType.ImportDeclaration] = ChildrenWalkers.walkImportDeclChildren; + this.childrenWalkers[NodeType.With] = ChildrenWalkers.walkWithStatementChildren; + this.childrenWalkers[NodeType.Label] = ChildrenWalkers.walkLabelChildren; + this.childrenWalkers[NodeType.LabeledStatement] = ChildrenWalkers.walkLabeledStatementChildren; + this.childrenWalkers[NodeType.EBStart] = ChildrenWalkers.walkNone; + this.childrenWalkers[NodeType.GotoEB] = ChildrenWalkers.walkNone; + this.childrenWalkers[NodeType.EndCode] = ChildrenWalkers.walkNone; + this.childrenWalkers[NodeType.Error] = ChildrenWalkers.walkNone; + this.childrenWalkers[NodeType.Comment] = ChildrenWalkers.walkNone; + this.childrenWalkers[NodeType.Debugger] = ChildrenWalkers.walkNone; // Verify the code is up to date with the enum for(var e in NodeType._map){ if (this.childrenWalkers[e] === undefined) { @@ -192,7 +192,7 @@ var TypeScript; return globalAstWalkerFactory; } TypeScript1.getAstWalkerFactory = getAstWalkerFactory; - var ChildrenWalkers1; + let ChildrenWalkers1; (function(ChildrenWalkers) { function walkNone(preAst, parent, walker) { // Nothing to do diff --git a/crates/swc/tests/tsc-references/parser/ecmascript5/parserRealSource12/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/parser/ecmascript5/parserRealSource12/input.ts/es2015.2.minified/output.js index 290ef28f0a7..4f00a397818 100644 --- a/crates/swc/tests/tsc-references/parser/ecmascript5/parserRealSource12/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/parser/ecmascript5/parserRealSource12/input.ts/es2015.2.minified/output.js @@ -1,6 +1,6 @@ var TypeScript; !function(TypeScript1) { - var globalAstWalkerFactory, ChildrenWalkers1; + var globalAstWalkerFactory; class AstWalkOptions { stopWalk(stop = !0) { this.goChildren = !stop, this.goNextSibling = !stop; @@ -36,7 +36,7 @@ var TypeScript; return options || (options = new AstWalkOptions()), new AstWalker(this.childrenWalkers, pre, post, options, state); } initChildrenWalkers() { - for(var e in this.childrenWalkers[NodeType.None] = ChildrenWalkers1.walkNone, this.childrenWalkers[NodeType.Empty] = ChildrenWalkers1.walkNone, this.childrenWalkers[NodeType.EmptyExpr] = ChildrenWalkers1.walkNone, this.childrenWalkers[NodeType.True] = ChildrenWalkers1.walkNone, this.childrenWalkers[NodeType.False] = ChildrenWalkers1.walkNone, this.childrenWalkers[NodeType.This] = ChildrenWalkers1.walkNone, this.childrenWalkers[NodeType.Super] = ChildrenWalkers1.walkNone, this.childrenWalkers[NodeType.QString] = ChildrenWalkers1.walkNone, this.childrenWalkers[NodeType.Regex] = ChildrenWalkers1.walkNone, this.childrenWalkers[NodeType.Null] = ChildrenWalkers1.walkNone, this.childrenWalkers[NodeType.ArrayLit] = ChildrenWalkers1.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.ObjectLit] = ChildrenWalkers1.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.Void] = ChildrenWalkers1.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.Comma] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Pos] = ChildrenWalkers1.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.Neg] = ChildrenWalkers1.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.Delete] = ChildrenWalkers1.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.Await] = ChildrenWalkers1.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.In] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Dot] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.From] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Is] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.InstOf] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Typeof] = ChildrenWalkers1.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.NumberLit] = ChildrenWalkers1.walkNone, this.childrenWalkers[NodeType.Name] = ChildrenWalkers1.walkNone, this.childrenWalkers[NodeType.TypeRef] = ChildrenWalkers1.walkTypeReferenceChildren, this.childrenWalkers[NodeType.Index] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Call] = ChildrenWalkers1.walkCallExpressionChildren, this.childrenWalkers[NodeType.New] = ChildrenWalkers1.walkCallExpressionChildren, this.childrenWalkers[NodeType.Asg] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.AsgAdd] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.AsgSub] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.AsgDiv] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.AsgMul] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.AsgMod] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.AsgAnd] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.AsgXor] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.AsgOr] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.AsgLsh] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.AsgRsh] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.AsgRs2] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.ConditionalExpression] = ChildrenWalkers1.walkTrinaryExpressionChildren, this.childrenWalkers[NodeType.LogOr] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.LogAnd] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Or] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Xor] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.And] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Eq] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Ne] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Eqv] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.NEqv] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Lt] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Le] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Gt] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Ge] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Add] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Sub] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Mul] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Div] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Mod] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Lsh] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Rsh] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Rs2] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Not] = ChildrenWalkers1.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.LogNot] = ChildrenWalkers1.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.IncPre] = ChildrenWalkers1.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.DecPre] = ChildrenWalkers1.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.IncPost] = ChildrenWalkers1.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.DecPost] = ChildrenWalkers1.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.TypeAssertion] = ChildrenWalkers1.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.FuncDecl] = ChildrenWalkers1.walkFuncDeclChildren, this.childrenWalkers[NodeType.Member] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.VarDecl] = ChildrenWalkers1.walkBoundDeclChildren, this.childrenWalkers[NodeType.ArgDecl] = ChildrenWalkers1.walkBoundDeclChildren, this.childrenWalkers[NodeType.Return] = ChildrenWalkers1.walkReturnStatementChildren, this.childrenWalkers[NodeType.Break] = ChildrenWalkers1.walkNone, this.childrenWalkers[NodeType.Continue] = ChildrenWalkers1.walkNone, this.childrenWalkers[NodeType.Throw] = ChildrenWalkers1.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.For] = ChildrenWalkers1.walkForStatementChildren, this.childrenWalkers[NodeType.ForIn] = ChildrenWalkers1.walkForInStatementChildren, this.childrenWalkers[NodeType.If] = ChildrenWalkers1.walkIfStatementChildren, this.childrenWalkers[NodeType.While] = ChildrenWalkers1.walkWhileStatementChildren, this.childrenWalkers[NodeType.DoWhile] = ChildrenWalkers1.walkDoWhileStatementChildren, this.childrenWalkers[NodeType.Block] = ChildrenWalkers1.walkBlockChildren, this.childrenWalkers[NodeType.Case] = ChildrenWalkers1.walkCaseStatementChildren, this.childrenWalkers[NodeType.Switch] = ChildrenWalkers1.walkSwitchStatementChildren, this.childrenWalkers[NodeType.Try] = ChildrenWalkers1.walkTryChildren, this.childrenWalkers[NodeType.TryCatch] = ChildrenWalkers1.walkTryCatchChildren, this.childrenWalkers[NodeType.TryFinally] = ChildrenWalkers1.walkTryFinallyChildren, this.childrenWalkers[NodeType.Finally] = ChildrenWalkers1.walkFinallyChildren, this.childrenWalkers[NodeType.Catch] = ChildrenWalkers1.walkCatchChildren, this.childrenWalkers[NodeType.List] = ChildrenWalkers1.walkListChildren, this.childrenWalkers[NodeType.Script] = ChildrenWalkers1.walkScriptChildren, this.childrenWalkers[NodeType.ClassDeclaration] = ChildrenWalkers1.walkClassDeclChildren, this.childrenWalkers[NodeType.InterfaceDeclaration] = ChildrenWalkers1.walkTypeDeclChildren, this.childrenWalkers[NodeType.ModuleDeclaration] = ChildrenWalkers1.walkModuleDeclChildren, this.childrenWalkers[NodeType.ImportDeclaration] = ChildrenWalkers1.walkImportDeclChildren, this.childrenWalkers[NodeType.With] = ChildrenWalkers1.walkWithStatementChildren, this.childrenWalkers[NodeType.Label] = ChildrenWalkers1.walkLabelChildren, this.childrenWalkers[NodeType.LabeledStatement] = ChildrenWalkers1.walkLabeledStatementChildren, this.childrenWalkers[NodeType.EBStart] = ChildrenWalkers1.walkNone, this.childrenWalkers[NodeType.GotoEB] = ChildrenWalkers1.walkNone, this.childrenWalkers[NodeType.EndCode] = ChildrenWalkers1.walkNone, this.childrenWalkers[NodeType.Error] = ChildrenWalkers1.walkNone, this.childrenWalkers[NodeType.Comment] = ChildrenWalkers1.walkNone, this.childrenWalkers[NodeType.Debugger] = ChildrenWalkers1.walkNone, NodeType._map)if (void 0 === this.childrenWalkers[e]) throw new Error("initWalkers function is not up to date with enum content!"); + for(var e in this.childrenWalkers[NodeType.None] = ChildrenWalkers.walkNone, this.childrenWalkers[NodeType.Empty] = ChildrenWalkers.walkNone, this.childrenWalkers[NodeType.EmptyExpr] = ChildrenWalkers.walkNone, this.childrenWalkers[NodeType.True] = ChildrenWalkers.walkNone, this.childrenWalkers[NodeType.False] = ChildrenWalkers.walkNone, this.childrenWalkers[NodeType.This] = ChildrenWalkers.walkNone, this.childrenWalkers[NodeType.Super] = ChildrenWalkers.walkNone, this.childrenWalkers[NodeType.QString] = ChildrenWalkers.walkNone, this.childrenWalkers[NodeType.Regex] = ChildrenWalkers.walkNone, this.childrenWalkers[NodeType.Null] = ChildrenWalkers.walkNone, this.childrenWalkers[NodeType.ArrayLit] = ChildrenWalkers.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.ObjectLit] = ChildrenWalkers.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.Void] = ChildrenWalkers.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.Comma] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Pos] = ChildrenWalkers.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.Neg] = ChildrenWalkers.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.Delete] = ChildrenWalkers.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.Await] = ChildrenWalkers.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.In] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Dot] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.From] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Is] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.InstOf] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Typeof] = ChildrenWalkers.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.NumberLit] = ChildrenWalkers.walkNone, this.childrenWalkers[NodeType.Name] = ChildrenWalkers.walkNone, this.childrenWalkers[NodeType.TypeRef] = ChildrenWalkers.walkTypeReferenceChildren, this.childrenWalkers[NodeType.Index] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Call] = ChildrenWalkers.walkCallExpressionChildren, this.childrenWalkers[NodeType.New] = ChildrenWalkers.walkCallExpressionChildren, this.childrenWalkers[NodeType.Asg] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.AsgAdd] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.AsgSub] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.AsgDiv] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.AsgMul] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.AsgMod] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.AsgAnd] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.AsgXor] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.AsgOr] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.AsgLsh] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.AsgRsh] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.AsgRs2] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.ConditionalExpression] = ChildrenWalkers.walkTrinaryExpressionChildren, this.childrenWalkers[NodeType.LogOr] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.LogAnd] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Or] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Xor] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.And] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Eq] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Ne] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Eqv] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.NEqv] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Lt] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Le] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Gt] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Ge] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Add] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Sub] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Mul] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Div] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Mod] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Lsh] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Rsh] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Rs2] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Not] = ChildrenWalkers.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.LogNot] = ChildrenWalkers.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.IncPre] = ChildrenWalkers.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.DecPre] = ChildrenWalkers.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.IncPost] = ChildrenWalkers.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.DecPost] = ChildrenWalkers.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.TypeAssertion] = ChildrenWalkers.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.FuncDecl] = ChildrenWalkers.walkFuncDeclChildren, this.childrenWalkers[NodeType.Member] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.VarDecl] = ChildrenWalkers.walkBoundDeclChildren, this.childrenWalkers[NodeType.ArgDecl] = ChildrenWalkers.walkBoundDeclChildren, this.childrenWalkers[NodeType.Return] = ChildrenWalkers.walkReturnStatementChildren, this.childrenWalkers[NodeType.Break] = ChildrenWalkers.walkNone, this.childrenWalkers[NodeType.Continue] = ChildrenWalkers.walkNone, this.childrenWalkers[NodeType.Throw] = ChildrenWalkers.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.For] = ChildrenWalkers.walkForStatementChildren, this.childrenWalkers[NodeType.ForIn] = ChildrenWalkers.walkForInStatementChildren, this.childrenWalkers[NodeType.If] = ChildrenWalkers.walkIfStatementChildren, this.childrenWalkers[NodeType.While] = ChildrenWalkers.walkWhileStatementChildren, this.childrenWalkers[NodeType.DoWhile] = ChildrenWalkers.walkDoWhileStatementChildren, this.childrenWalkers[NodeType.Block] = ChildrenWalkers.walkBlockChildren, this.childrenWalkers[NodeType.Case] = ChildrenWalkers.walkCaseStatementChildren, this.childrenWalkers[NodeType.Switch] = ChildrenWalkers.walkSwitchStatementChildren, this.childrenWalkers[NodeType.Try] = ChildrenWalkers.walkTryChildren, this.childrenWalkers[NodeType.TryCatch] = ChildrenWalkers.walkTryCatchChildren, this.childrenWalkers[NodeType.TryFinally] = ChildrenWalkers.walkTryFinallyChildren, this.childrenWalkers[NodeType.Finally] = ChildrenWalkers.walkFinallyChildren, this.childrenWalkers[NodeType.Catch] = ChildrenWalkers.walkCatchChildren, this.childrenWalkers[NodeType.List] = ChildrenWalkers.walkListChildren, this.childrenWalkers[NodeType.Script] = ChildrenWalkers.walkScriptChildren, this.childrenWalkers[NodeType.ClassDeclaration] = ChildrenWalkers.walkClassDeclChildren, this.childrenWalkers[NodeType.InterfaceDeclaration] = ChildrenWalkers.walkTypeDeclChildren, this.childrenWalkers[NodeType.ModuleDeclaration] = ChildrenWalkers.walkModuleDeclChildren, this.childrenWalkers[NodeType.ImportDeclaration] = ChildrenWalkers.walkImportDeclChildren, this.childrenWalkers[NodeType.With] = ChildrenWalkers.walkWithStatementChildren, this.childrenWalkers[NodeType.Label] = ChildrenWalkers.walkLabelChildren, this.childrenWalkers[NodeType.LabeledStatement] = ChildrenWalkers.walkLabeledStatementChildren, this.childrenWalkers[NodeType.EBStart] = ChildrenWalkers.walkNone, this.childrenWalkers[NodeType.GotoEB] = ChildrenWalkers.walkNone, this.childrenWalkers[NodeType.EndCode] = ChildrenWalkers.walkNone, this.childrenWalkers[NodeType.Error] = ChildrenWalkers.walkNone, this.childrenWalkers[NodeType.Comment] = ChildrenWalkers.walkNone, this.childrenWalkers[NodeType.Debugger] = ChildrenWalkers.walkNone, NodeType._map)if (void 0 === this.childrenWalkers[e]) throw new Error("initWalkers function is not up to date with enum content!"); } constructor(){ this.childrenWalkers = [], this.initChildrenWalkers(); @@ -44,7 +44,9 @@ var TypeScript; } TypeScript1.AstWalkerFactory = AstWalkerFactory, TypeScript1.getAstWalkerFactory = function() { return globalAstWalkerFactory || (globalAstWalkerFactory = new AstWalkerFactory()), globalAstWalkerFactory; - }, (function(ChildrenWalkers) { + }; + let ChildrenWalkers1; + !function(ChildrenWalkers) { function walkRecordChildren(preAst, parent, walker) { preAst.name = walker.walk(preAst.name, preAst), walker.options.goNextSibling && preAst.members && (preAst.members = walker.walk(preAst.members, preAst)); } @@ -114,7 +116,7 @@ var TypeScript; }, ChildrenWalkers.walkLabeledStatementChildren = function(preAst, parent, walker) { preAst.labels = walker.walk(preAst.labels, preAst), walker.options.goNextSibling && (preAst.stmt = walker.walk(preAst.stmt, preAst)); }; - })(ChildrenWalkers1 || (ChildrenWalkers1 = { + }(ChildrenWalkers1 || (ChildrenWalkers1 = { })); }(TypeScript || (TypeScript = { })); diff --git a/crates/swc/tests/tsc-references/parser/ecmascript5/parserRealSource12/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/parser/ecmascript5/parserRealSource12/input.ts/es5.1.normal/output.js index 93b47a9cdab..6f1e4150c5b 100644 --- a/crates/swc/tests/tsc-references/parser/ecmascript5/parserRealSource12/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/parser/ecmascript5/parserRealSource12/input.ts/es5.1.normal/output.js @@ -124,113 +124,113 @@ var TypeScript; { key: "initChildrenWalkers", value: function initChildrenWalkers() { - this.childrenWalkers[NodeType.None] = ChildrenWalkers1.walkNone; - this.childrenWalkers[NodeType.Empty] = ChildrenWalkers1.walkNone; - this.childrenWalkers[NodeType.EmptyExpr] = ChildrenWalkers1.walkNone; - this.childrenWalkers[NodeType.True] = ChildrenWalkers1.walkNone; - this.childrenWalkers[NodeType.False] = ChildrenWalkers1.walkNone; - this.childrenWalkers[NodeType.This] = ChildrenWalkers1.walkNone; - this.childrenWalkers[NodeType.Super] = ChildrenWalkers1.walkNone; - this.childrenWalkers[NodeType.QString] = ChildrenWalkers1.walkNone; - this.childrenWalkers[NodeType.Regex] = ChildrenWalkers1.walkNone; - this.childrenWalkers[NodeType.Null] = ChildrenWalkers1.walkNone; - this.childrenWalkers[NodeType.ArrayLit] = ChildrenWalkers1.walkUnaryExpressionChildren; - this.childrenWalkers[NodeType.ObjectLit] = ChildrenWalkers1.walkUnaryExpressionChildren; - this.childrenWalkers[NodeType.Void] = ChildrenWalkers1.walkUnaryExpressionChildren; - this.childrenWalkers[NodeType.Comma] = ChildrenWalkers1.walkBinaryExpressionChildren; - this.childrenWalkers[NodeType.Pos] = ChildrenWalkers1.walkUnaryExpressionChildren; - this.childrenWalkers[NodeType.Neg] = ChildrenWalkers1.walkUnaryExpressionChildren; - this.childrenWalkers[NodeType.Delete] = ChildrenWalkers1.walkUnaryExpressionChildren; - this.childrenWalkers[NodeType.Await] = ChildrenWalkers1.walkUnaryExpressionChildren; - this.childrenWalkers[NodeType.In] = ChildrenWalkers1.walkBinaryExpressionChildren; - this.childrenWalkers[NodeType.Dot] = ChildrenWalkers1.walkBinaryExpressionChildren; - this.childrenWalkers[NodeType.From] = ChildrenWalkers1.walkBinaryExpressionChildren; - this.childrenWalkers[NodeType.Is] = ChildrenWalkers1.walkBinaryExpressionChildren; - this.childrenWalkers[NodeType.InstOf] = ChildrenWalkers1.walkBinaryExpressionChildren; - this.childrenWalkers[NodeType.Typeof] = ChildrenWalkers1.walkUnaryExpressionChildren; - this.childrenWalkers[NodeType.NumberLit] = ChildrenWalkers1.walkNone; - this.childrenWalkers[NodeType.Name] = ChildrenWalkers1.walkNone; - this.childrenWalkers[NodeType.TypeRef] = ChildrenWalkers1.walkTypeReferenceChildren; - this.childrenWalkers[NodeType.Index] = ChildrenWalkers1.walkBinaryExpressionChildren; - this.childrenWalkers[NodeType.Call] = ChildrenWalkers1.walkCallExpressionChildren; - this.childrenWalkers[NodeType.New] = ChildrenWalkers1.walkCallExpressionChildren; - this.childrenWalkers[NodeType.Asg] = ChildrenWalkers1.walkBinaryExpressionChildren; - this.childrenWalkers[NodeType.AsgAdd] = ChildrenWalkers1.walkBinaryExpressionChildren; - this.childrenWalkers[NodeType.AsgSub] = ChildrenWalkers1.walkBinaryExpressionChildren; - this.childrenWalkers[NodeType.AsgDiv] = ChildrenWalkers1.walkBinaryExpressionChildren; - this.childrenWalkers[NodeType.AsgMul] = ChildrenWalkers1.walkBinaryExpressionChildren; - this.childrenWalkers[NodeType.AsgMod] = ChildrenWalkers1.walkBinaryExpressionChildren; - this.childrenWalkers[NodeType.AsgAnd] = ChildrenWalkers1.walkBinaryExpressionChildren; - this.childrenWalkers[NodeType.AsgXor] = ChildrenWalkers1.walkBinaryExpressionChildren; - this.childrenWalkers[NodeType.AsgOr] = ChildrenWalkers1.walkBinaryExpressionChildren; - this.childrenWalkers[NodeType.AsgLsh] = ChildrenWalkers1.walkBinaryExpressionChildren; - this.childrenWalkers[NodeType.AsgRsh] = ChildrenWalkers1.walkBinaryExpressionChildren; - this.childrenWalkers[NodeType.AsgRs2] = ChildrenWalkers1.walkBinaryExpressionChildren; - this.childrenWalkers[NodeType.ConditionalExpression] = ChildrenWalkers1.walkTrinaryExpressionChildren; - this.childrenWalkers[NodeType.LogOr] = ChildrenWalkers1.walkBinaryExpressionChildren; - this.childrenWalkers[NodeType.LogAnd] = ChildrenWalkers1.walkBinaryExpressionChildren; - this.childrenWalkers[NodeType.Or] = ChildrenWalkers1.walkBinaryExpressionChildren; - this.childrenWalkers[NodeType.Xor] = ChildrenWalkers1.walkBinaryExpressionChildren; - this.childrenWalkers[NodeType.And] = ChildrenWalkers1.walkBinaryExpressionChildren; - this.childrenWalkers[NodeType.Eq] = ChildrenWalkers1.walkBinaryExpressionChildren; - this.childrenWalkers[NodeType.Ne] = ChildrenWalkers1.walkBinaryExpressionChildren; - this.childrenWalkers[NodeType.Eqv] = ChildrenWalkers1.walkBinaryExpressionChildren; - this.childrenWalkers[NodeType.NEqv] = ChildrenWalkers1.walkBinaryExpressionChildren; - this.childrenWalkers[NodeType.Lt] = ChildrenWalkers1.walkBinaryExpressionChildren; - this.childrenWalkers[NodeType.Le] = ChildrenWalkers1.walkBinaryExpressionChildren; - this.childrenWalkers[NodeType.Gt] = ChildrenWalkers1.walkBinaryExpressionChildren; - this.childrenWalkers[NodeType.Ge] = ChildrenWalkers1.walkBinaryExpressionChildren; - this.childrenWalkers[NodeType.Add] = ChildrenWalkers1.walkBinaryExpressionChildren; - this.childrenWalkers[NodeType.Sub] = ChildrenWalkers1.walkBinaryExpressionChildren; - this.childrenWalkers[NodeType.Mul] = ChildrenWalkers1.walkBinaryExpressionChildren; - this.childrenWalkers[NodeType.Div] = ChildrenWalkers1.walkBinaryExpressionChildren; - this.childrenWalkers[NodeType.Mod] = ChildrenWalkers1.walkBinaryExpressionChildren; - this.childrenWalkers[NodeType.Lsh] = ChildrenWalkers1.walkBinaryExpressionChildren; - this.childrenWalkers[NodeType.Rsh] = ChildrenWalkers1.walkBinaryExpressionChildren; - this.childrenWalkers[NodeType.Rs2] = ChildrenWalkers1.walkBinaryExpressionChildren; - this.childrenWalkers[NodeType.Not] = ChildrenWalkers1.walkUnaryExpressionChildren; - this.childrenWalkers[NodeType.LogNot] = ChildrenWalkers1.walkUnaryExpressionChildren; - this.childrenWalkers[NodeType.IncPre] = ChildrenWalkers1.walkUnaryExpressionChildren; - this.childrenWalkers[NodeType.DecPre] = ChildrenWalkers1.walkUnaryExpressionChildren; - this.childrenWalkers[NodeType.IncPost] = ChildrenWalkers1.walkUnaryExpressionChildren; - this.childrenWalkers[NodeType.DecPost] = ChildrenWalkers1.walkUnaryExpressionChildren; - this.childrenWalkers[NodeType.TypeAssertion] = ChildrenWalkers1.walkUnaryExpressionChildren; - this.childrenWalkers[NodeType.FuncDecl] = ChildrenWalkers1.walkFuncDeclChildren; - this.childrenWalkers[NodeType.Member] = ChildrenWalkers1.walkBinaryExpressionChildren; - this.childrenWalkers[NodeType.VarDecl] = ChildrenWalkers1.walkBoundDeclChildren; - this.childrenWalkers[NodeType.ArgDecl] = ChildrenWalkers1.walkBoundDeclChildren; - this.childrenWalkers[NodeType.Return] = ChildrenWalkers1.walkReturnStatementChildren; - this.childrenWalkers[NodeType.Break] = ChildrenWalkers1.walkNone; - this.childrenWalkers[NodeType.Continue] = ChildrenWalkers1.walkNone; - this.childrenWalkers[NodeType.Throw] = ChildrenWalkers1.walkUnaryExpressionChildren; - this.childrenWalkers[NodeType.For] = ChildrenWalkers1.walkForStatementChildren; - this.childrenWalkers[NodeType.ForIn] = ChildrenWalkers1.walkForInStatementChildren; - this.childrenWalkers[NodeType.If] = ChildrenWalkers1.walkIfStatementChildren; - this.childrenWalkers[NodeType.While] = ChildrenWalkers1.walkWhileStatementChildren; - this.childrenWalkers[NodeType.DoWhile] = ChildrenWalkers1.walkDoWhileStatementChildren; - this.childrenWalkers[NodeType.Block] = ChildrenWalkers1.walkBlockChildren; - this.childrenWalkers[NodeType.Case] = ChildrenWalkers1.walkCaseStatementChildren; - this.childrenWalkers[NodeType.Switch] = ChildrenWalkers1.walkSwitchStatementChildren; - this.childrenWalkers[NodeType.Try] = ChildrenWalkers1.walkTryChildren; - this.childrenWalkers[NodeType.TryCatch] = ChildrenWalkers1.walkTryCatchChildren; - this.childrenWalkers[NodeType.TryFinally] = ChildrenWalkers1.walkTryFinallyChildren; - this.childrenWalkers[NodeType.Finally] = ChildrenWalkers1.walkFinallyChildren; - this.childrenWalkers[NodeType.Catch] = ChildrenWalkers1.walkCatchChildren; - this.childrenWalkers[NodeType.List] = ChildrenWalkers1.walkListChildren; - this.childrenWalkers[NodeType.Script] = ChildrenWalkers1.walkScriptChildren; - this.childrenWalkers[NodeType.ClassDeclaration] = ChildrenWalkers1.walkClassDeclChildren; - this.childrenWalkers[NodeType.InterfaceDeclaration] = ChildrenWalkers1.walkTypeDeclChildren; - this.childrenWalkers[NodeType.ModuleDeclaration] = ChildrenWalkers1.walkModuleDeclChildren; - this.childrenWalkers[NodeType.ImportDeclaration] = ChildrenWalkers1.walkImportDeclChildren; - this.childrenWalkers[NodeType.With] = ChildrenWalkers1.walkWithStatementChildren; - this.childrenWalkers[NodeType.Label] = ChildrenWalkers1.walkLabelChildren; - this.childrenWalkers[NodeType.LabeledStatement] = ChildrenWalkers1.walkLabeledStatementChildren; - this.childrenWalkers[NodeType.EBStart] = ChildrenWalkers1.walkNone; - this.childrenWalkers[NodeType.GotoEB] = ChildrenWalkers1.walkNone; - this.childrenWalkers[NodeType.EndCode] = ChildrenWalkers1.walkNone; - this.childrenWalkers[NodeType.Error] = ChildrenWalkers1.walkNone; - this.childrenWalkers[NodeType.Comment] = ChildrenWalkers1.walkNone; - this.childrenWalkers[NodeType.Debugger] = ChildrenWalkers1.walkNone; + this.childrenWalkers[NodeType.None] = ChildrenWalkers.walkNone; + this.childrenWalkers[NodeType.Empty] = ChildrenWalkers.walkNone; + this.childrenWalkers[NodeType.EmptyExpr] = ChildrenWalkers.walkNone; + this.childrenWalkers[NodeType.True] = ChildrenWalkers.walkNone; + this.childrenWalkers[NodeType.False] = ChildrenWalkers.walkNone; + this.childrenWalkers[NodeType.This] = ChildrenWalkers.walkNone; + this.childrenWalkers[NodeType.Super] = ChildrenWalkers.walkNone; + this.childrenWalkers[NodeType.QString] = ChildrenWalkers.walkNone; + this.childrenWalkers[NodeType.Regex] = ChildrenWalkers.walkNone; + this.childrenWalkers[NodeType.Null] = ChildrenWalkers.walkNone; + this.childrenWalkers[NodeType.ArrayLit] = ChildrenWalkers.walkUnaryExpressionChildren; + this.childrenWalkers[NodeType.ObjectLit] = ChildrenWalkers.walkUnaryExpressionChildren; + this.childrenWalkers[NodeType.Void] = ChildrenWalkers.walkUnaryExpressionChildren; + this.childrenWalkers[NodeType.Comma] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.Pos] = ChildrenWalkers.walkUnaryExpressionChildren; + this.childrenWalkers[NodeType.Neg] = ChildrenWalkers.walkUnaryExpressionChildren; + this.childrenWalkers[NodeType.Delete] = ChildrenWalkers.walkUnaryExpressionChildren; + this.childrenWalkers[NodeType.Await] = ChildrenWalkers.walkUnaryExpressionChildren; + this.childrenWalkers[NodeType.In] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.Dot] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.From] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.Is] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.InstOf] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.Typeof] = ChildrenWalkers.walkUnaryExpressionChildren; + this.childrenWalkers[NodeType.NumberLit] = ChildrenWalkers.walkNone; + this.childrenWalkers[NodeType.Name] = ChildrenWalkers.walkNone; + this.childrenWalkers[NodeType.TypeRef] = ChildrenWalkers.walkTypeReferenceChildren; + this.childrenWalkers[NodeType.Index] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.Call] = ChildrenWalkers.walkCallExpressionChildren; + this.childrenWalkers[NodeType.New] = ChildrenWalkers.walkCallExpressionChildren; + this.childrenWalkers[NodeType.Asg] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.AsgAdd] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.AsgSub] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.AsgDiv] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.AsgMul] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.AsgMod] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.AsgAnd] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.AsgXor] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.AsgOr] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.AsgLsh] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.AsgRsh] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.AsgRs2] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.ConditionalExpression] = ChildrenWalkers.walkTrinaryExpressionChildren; + this.childrenWalkers[NodeType.LogOr] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.LogAnd] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.Or] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.Xor] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.And] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.Eq] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.Ne] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.Eqv] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.NEqv] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.Lt] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.Le] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.Gt] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.Ge] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.Add] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.Sub] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.Mul] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.Div] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.Mod] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.Lsh] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.Rsh] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.Rs2] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.Not] = ChildrenWalkers.walkUnaryExpressionChildren; + this.childrenWalkers[NodeType.LogNot] = ChildrenWalkers.walkUnaryExpressionChildren; + this.childrenWalkers[NodeType.IncPre] = ChildrenWalkers.walkUnaryExpressionChildren; + this.childrenWalkers[NodeType.DecPre] = ChildrenWalkers.walkUnaryExpressionChildren; + this.childrenWalkers[NodeType.IncPost] = ChildrenWalkers.walkUnaryExpressionChildren; + this.childrenWalkers[NodeType.DecPost] = ChildrenWalkers.walkUnaryExpressionChildren; + this.childrenWalkers[NodeType.TypeAssertion] = ChildrenWalkers.walkUnaryExpressionChildren; + this.childrenWalkers[NodeType.FuncDecl] = ChildrenWalkers.walkFuncDeclChildren; + this.childrenWalkers[NodeType.Member] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.VarDecl] = ChildrenWalkers.walkBoundDeclChildren; + this.childrenWalkers[NodeType.ArgDecl] = ChildrenWalkers.walkBoundDeclChildren; + this.childrenWalkers[NodeType.Return] = ChildrenWalkers.walkReturnStatementChildren; + this.childrenWalkers[NodeType.Break] = ChildrenWalkers.walkNone; + this.childrenWalkers[NodeType.Continue] = ChildrenWalkers.walkNone; + this.childrenWalkers[NodeType.Throw] = ChildrenWalkers.walkUnaryExpressionChildren; + this.childrenWalkers[NodeType.For] = ChildrenWalkers.walkForStatementChildren; + this.childrenWalkers[NodeType.ForIn] = ChildrenWalkers.walkForInStatementChildren; + this.childrenWalkers[NodeType.If] = ChildrenWalkers.walkIfStatementChildren; + this.childrenWalkers[NodeType.While] = ChildrenWalkers.walkWhileStatementChildren; + this.childrenWalkers[NodeType.DoWhile] = ChildrenWalkers.walkDoWhileStatementChildren; + this.childrenWalkers[NodeType.Block] = ChildrenWalkers.walkBlockChildren; + this.childrenWalkers[NodeType.Case] = ChildrenWalkers.walkCaseStatementChildren; + this.childrenWalkers[NodeType.Switch] = ChildrenWalkers.walkSwitchStatementChildren; + this.childrenWalkers[NodeType.Try] = ChildrenWalkers.walkTryChildren; + this.childrenWalkers[NodeType.TryCatch] = ChildrenWalkers.walkTryCatchChildren; + this.childrenWalkers[NodeType.TryFinally] = ChildrenWalkers.walkTryFinallyChildren; + this.childrenWalkers[NodeType.Finally] = ChildrenWalkers.walkFinallyChildren; + this.childrenWalkers[NodeType.Catch] = ChildrenWalkers.walkCatchChildren; + this.childrenWalkers[NodeType.List] = ChildrenWalkers.walkListChildren; + this.childrenWalkers[NodeType.Script] = ChildrenWalkers.walkScriptChildren; + this.childrenWalkers[NodeType.ClassDeclaration] = ChildrenWalkers.walkClassDeclChildren; + this.childrenWalkers[NodeType.InterfaceDeclaration] = ChildrenWalkers.walkTypeDeclChildren; + this.childrenWalkers[NodeType.ModuleDeclaration] = ChildrenWalkers.walkModuleDeclChildren; + this.childrenWalkers[NodeType.ImportDeclaration] = ChildrenWalkers.walkImportDeclChildren; + this.childrenWalkers[NodeType.With] = ChildrenWalkers.walkWithStatementChildren; + this.childrenWalkers[NodeType.Label] = ChildrenWalkers.walkLabelChildren; + this.childrenWalkers[NodeType.LabeledStatement] = ChildrenWalkers.walkLabeledStatementChildren; + this.childrenWalkers[NodeType.EBStart] = ChildrenWalkers.walkNone; + this.childrenWalkers[NodeType.GotoEB] = ChildrenWalkers.walkNone; + this.childrenWalkers[NodeType.EndCode] = ChildrenWalkers.walkNone; + this.childrenWalkers[NodeType.Error] = ChildrenWalkers.walkNone; + this.childrenWalkers[NodeType.Comment] = ChildrenWalkers.walkNone; + this.childrenWalkers[NodeType.Debugger] = ChildrenWalkers.walkNone; // Verify the code is up to date with the enum for(var e in NodeType._map){ if (this.childrenWalkers[e] === undefined) { diff --git a/crates/swc/tests/tsc-references/parser/ecmascript5/parserRealSource12/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/parser/ecmascript5/parserRealSource12/input.ts/es5.2.minified/output.js index da91b7badd3..225331d3a8d 100644 --- a/crates/swc/tests/tsc-references/parser/ecmascript5/parserRealSource12/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/parser/ecmascript5/parserRealSource12/input.ts/es5.2.minified/output.js @@ -12,9 +12,7 @@ function _createClass(Constructor, protoProps, staticProps) { return protoProps && _defineProperties(Constructor.prototype, protoProps), staticProps && _defineProperties(Constructor, staticProps), Constructor; } !function(TypeScript1) { - var globalAstWalkerFactory, ChildrenWalkers1, getAstWalkerFactory = function() { - return globalAstWalkerFactory || (globalAstWalkerFactory = new AstWalkerFactory()), globalAstWalkerFactory; - }, AstWalkOptions = function() { + var globalAstWalkerFactory, ChildrenWalkers1, AstWalkOptions = function() { "use strict"; function AstWalkOptions() { _classCallCheck(this, AstWalkOptions), this.goChildren = !0, this.goNextSibling = !0, this.reverseSiblings = !1; @@ -77,12 +75,14 @@ function _createClass(Constructor, protoProps, staticProps) { { key: "initChildrenWalkers", value: function() { - for(var e in this.childrenWalkers[NodeType.None] = ChildrenWalkers1.walkNone, this.childrenWalkers[NodeType.Empty] = ChildrenWalkers1.walkNone, this.childrenWalkers[NodeType.EmptyExpr] = ChildrenWalkers1.walkNone, this.childrenWalkers[NodeType.True] = ChildrenWalkers1.walkNone, this.childrenWalkers[NodeType.False] = ChildrenWalkers1.walkNone, this.childrenWalkers[NodeType.This] = ChildrenWalkers1.walkNone, this.childrenWalkers[NodeType.Super] = ChildrenWalkers1.walkNone, this.childrenWalkers[NodeType.QString] = ChildrenWalkers1.walkNone, this.childrenWalkers[NodeType.Regex] = ChildrenWalkers1.walkNone, this.childrenWalkers[NodeType.Null] = ChildrenWalkers1.walkNone, this.childrenWalkers[NodeType.ArrayLit] = ChildrenWalkers1.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.ObjectLit] = ChildrenWalkers1.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.Void] = ChildrenWalkers1.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.Comma] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Pos] = ChildrenWalkers1.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.Neg] = ChildrenWalkers1.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.Delete] = ChildrenWalkers1.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.Await] = ChildrenWalkers1.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.In] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Dot] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.From] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Is] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.InstOf] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Typeof] = ChildrenWalkers1.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.NumberLit] = ChildrenWalkers1.walkNone, this.childrenWalkers[NodeType.Name] = ChildrenWalkers1.walkNone, this.childrenWalkers[NodeType.TypeRef] = ChildrenWalkers1.walkTypeReferenceChildren, this.childrenWalkers[NodeType.Index] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Call] = ChildrenWalkers1.walkCallExpressionChildren, this.childrenWalkers[NodeType.New] = ChildrenWalkers1.walkCallExpressionChildren, this.childrenWalkers[NodeType.Asg] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.AsgAdd] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.AsgSub] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.AsgDiv] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.AsgMul] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.AsgMod] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.AsgAnd] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.AsgXor] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.AsgOr] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.AsgLsh] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.AsgRsh] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.AsgRs2] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.ConditionalExpression] = ChildrenWalkers1.walkTrinaryExpressionChildren, this.childrenWalkers[NodeType.LogOr] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.LogAnd] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Or] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Xor] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.And] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Eq] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Ne] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Eqv] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.NEqv] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Lt] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Le] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Gt] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Ge] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Add] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Sub] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Mul] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Div] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Mod] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Lsh] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Rsh] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Rs2] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Not] = ChildrenWalkers1.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.LogNot] = ChildrenWalkers1.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.IncPre] = ChildrenWalkers1.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.DecPre] = ChildrenWalkers1.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.IncPost] = ChildrenWalkers1.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.DecPost] = ChildrenWalkers1.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.TypeAssertion] = ChildrenWalkers1.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.FuncDecl] = ChildrenWalkers1.walkFuncDeclChildren, this.childrenWalkers[NodeType.Member] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.VarDecl] = ChildrenWalkers1.walkBoundDeclChildren, this.childrenWalkers[NodeType.ArgDecl] = ChildrenWalkers1.walkBoundDeclChildren, this.childrenWalkers[NodeType.Return] = ChildrenWalkers1.walkReturnStatementChildren, this.childrenWalkers[NodeType.Break] = ChildrenWalkers1.walkNone, this.childrenWalkers[NodeType.Continue] = ChildrenWalkers1.walkNone, this.childrenWalkers[NodeType.Throw] = ChildrenWalkers1.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.For] = ChildrenWalkers1.walkForStatementChildren, this.childrenWalkers[NodeType.ForIn] = ChildrenWalkers1.walkForInStatementChildren, this.childrenWalkers[NodeType.If] = ChildrenWalkers1.walkIfStatementChildren, this.childrenWalkers[NodeType.While] = ChildrenWalkers1.walkWhileStatementChildren, this.childrenWalkers[NodeType.DoWhile] = ChildrenWalkers1.walkDoWhileStatementChildren, this.childrenWalkers[NodeType.Block] = ChildrenWalkers1.walkBlockChildren, this.childrenWalkers[NodeType.Case] = ChildrenWalkers1.walkCaseStatementChildren, this.childrenWalkers[NodeType.Switch] = ChildrenWalkers1.walkSwitchStatementChildren, this.childrenWalkers[NodeType.Try] = ChildrenWalkers1.walkTryChildren, this.childrenWalkers[NodeType.TryCatch] = ChildrenWalkers1.walkTryCatchChildren, this.childrenWalkers[NodeType.TryFinally] = ChildrenWalkers1.walkTryFinallyChildren, this.childrenWalkers[NodeType.Finally] = ChildrenWalkers1.walkFinallyChildren, this.childrenWalkers[NodeType.Catch] = ChildrenWalkers1.walkCatchChildren, this.childrenWalkers[NodeType.List] = ChildrenWalkers1.walkListChildren, this.childrenWalkers[NodeType.Script] = ChildrenWalkers1.walkScriptChildren, this.childrenWalkers[NodeType.ClassDeclaration] = ChildrenWalkers1.walkClassDeclChildren, this.childrenWalkers[NodeType.InterfaceDeclaration] = ChildrenWalkers1.walkTypeDeclChildren, this.childrenWalkers[NodeType.ModuleDeclaration] = ChildrenWalkers1.walkModuleDeclChildren, this.childrenWalkers[NodeType.ImportDeclaration] = ChildrenWalkers1.walkImportDeclChildren, this.childrenWalkers[NodeType.With] = ChildrenWalkers1.walkWithStatementChildren, this.childrenWalkers[NodeType.Label] = ChildrenWalkers1.walkLabelChildren, this.childrenWalkers[NodeType.LabeledStatement] = ChildrenWalkers1.walkLabeledStatementChildren, this.childrenWalkers[NodeType.EBStart] = ChildrenWalkers1.walkNone, this.childrenWalkers[NodeType.GotoEB] = ChildrenWalkers1.walkNone, this.childrenWalkers[NodeType.EndCode] = ChildrenWalkers1.walkNone, this.childrenWalkers[NodeType.Error] = ChildrenWalkers1.walkNone, this.childrenWalkers[NodeType.Comment] = ChildrenWalkers1.walkNone, this.childrenWalkers[NodeType.Debugger] = ChildrenWalkers1.walkNone, NodeType._map)if (void 0 === this.childrenWalkers[e]) throw new Error("initWalkers function is not up to date with enum content!"); + for(var e in this.childrenWalkers[NodeType.None] = ChildrenWalkers.walkNone, this.childrenWalkers[NodeType.Empty] = ChildrenWalkers.walkNone, this.childrenWalkers[NodeType.EmptyExpr] = ChildrenWalkers.walkNone, this.childrenWalkers[NodeType.True] = ChildrenWalkers.walkNone, this.childrenWalkers[NodeType.False] = ChildrenWalkers.walkNone, this.childrenWalkers[NodeType.This] = ChildrenWalkers.walkNone, this.childrenWalkers[NodeType.Super] = ChildrenWalkers.walkNone, this.childrenWalkers[NodeType.QString] = ChildrenWalkers.walkNone, this.childrenWalkers[NodeType.Regex] = ChildrenWalkers.walkNone, this.childrenWalkers[NodeType.Null] = ChildrenWalkers.walkNone, this.childrenWalkers[NodeType.ArrayLit] = ChildrenWalkers.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.ObjectLit] = ChildrenWalkers.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.Void] = ChildrenWalkers.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.Comma] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Pos] = ChildrenWalkers.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.Neg] = ChildrenWalkers.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.Delete] = ChildrenWalkers.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.Await] = ChildrenWalkers.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.In] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Dot] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.From] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Is] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.InstOf] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Typeof] = ChildrenWalkers.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.NumberLit] = ChildrenWalkers.walkNone, this.childrenWalkers[NodeType.Name] = ChildrenWalkers.walkNone, this.childrenWalkers[NodeType.TypeRef] = ChildrenWalkers.walkTypeReferenceChildren, this.childrenWalkers[NodeType.Index] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Call] = ChildrenWalkers.walkCallExpressionChildren, this.childrenWalkers[NodeType.New] = ChildrenWalkers.walkCallExpressionChildren, this.childrenWalkers[NodeType.Asg] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.AsgAdd] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.AsgSub] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.AsgDiv] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.AsgMul] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.AsgMod] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.AsgAnd] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.AsgXor] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.AsgOr] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.AsgLsh] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.AsgRsh] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.AsgRs2] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.ConditionalExpression] = ChildrenWalkers.walkTrinaryExpressionChildren, this.childrenWalkers[NodeType.LogOr] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.LogAnd] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Or] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Xor] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.And] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Eq] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Ne] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Eqv] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.NEqv] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Lt] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Le] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Gt] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Ge] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Add] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Sub] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Mul] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Div] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Mod] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Lsh] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Rsh] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Rs2] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Not] = ChildrenWalkers.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.LogNot] = ChildrenWalkers.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.IncPre] = ChildrenWalkers.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.DecPre] = ChildrenWalkers.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.IncPost] = ChildrenWalkers.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.DecPost] = ChildrenWalkers.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.TypeAssertion] = ChildrenWalkers.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.FuncDecl] = ChildrenWalkers.walkFuncDeclChildren, this.childrenWalkers[NodeType.Member] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.VarDecl] = ChildrenWalkers.walkBoundDeclChildren, this.childrenWalkers[NodeType.ArgDecl] = ChildrenWalkers.walkBoundDeclChildren, this.childrenWalkers[NodeType.Return] = ChildrenWalkers.walkReturnStatementChildren, this.childrenWalkers[NodeType.Break] = ChildrenWalkers.walkNone, this.childrenWalkers[NodeType.Continue] = ChildrenWalkers.walkNone, this.childrenWalkers[NodeType.Throw] = ChildrenWalkers.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.For] = ChildrenWalkers.walkForStatementChildren, this.childrenWalkers[NodeType.ForIn] = ChildrenWalkers.walkForInStatementChildren, this.childrenWalkers[NodeType.If] = ChildrenWalkers.walkIfStatementChildren, this.childrenWalkers[NodeType.While] = ChildrenWalkers.walkWhileStatementChildren, this.childrenWalkers[NodeType.DoWhile] = ChildrenWalkers.walkDoWhileStatementChildren, this.childrenWalkers[NodeType.Block] = ChildrenWalkers.walkBlockChildren, this.childrenWalkers[NodeType.Case] = ChildrenWalkers.walkCaseStatementChildren, this.childrenWalkers[NodeType.Switch] = ChildrenWalkers.walkSwitchStatementChildren, this.childrenWalkers[NodeType.Try] = ChildrenWalkers.walkTryChildren, this.childrenWalkers[NodeType.TryCatch] = ChildrenWalkers.walkTryCatchChildren, this.childrenWalkers[NodeType.TryFinally] = ChildrenWalkers.walkTryFinallyChildren, this.childrenWalkers[NodeType.Finally] = ChildrenWalkers.walkFinallyChildren, this.childrenWalkers[NodeType.Catch] = ChildrenWalkers.walkCatchChildren, this.childrenWalkers[NodeType.List] = ChildrenWalkers.walkListChildren, this.childrenWalkers[NodeType.Script] = ChildrenWalkers.walkScriptChildren, this.childrenWalkers[NodeType.ClassDeclaration] = ChildrenWalkers.walkClassDeclChildren, this.childrenWalkers[NodeType.InterfaceDeclaration] = ChildrenWalkers.walkTypeDeclChildren, this.childrenWalkers[NodeType.ModuleDeclaration] = ChildrenWalkers.walkModuleDeclChildren, this.childrenWalkers[NodeType.ImportDeclaration] = ChildrenWalkers.walkImportDeclChildren, this.childrenWalkers[NodeType.With] = ChildrenWalkers.walkWithStatementChildren, this.childrenWalkers[NodeType.Label] = ChildrenWalkers.walkLabelChildren, this.childrenWalkers[NodeType.LabeledStatement] = ChildrenWalkers.walkLabeledStatementChildren, this.childrenWalkers[NodeType.EBStart] = ChildrenWalkers.walkNone, this.childrenWalkers[NodeType.GotoEB] = ChildrenWalkers.walkNone, this.childrenWalkers[NodeType.EndCode] = ChildrenWalkers.walkNone, this.childrenWalkers[NodeType.Error] = ChildrenWalkers.walkNone, this.childrenWalkers[NodeType.Comment] = ChildrenWalkers.walkNone, this.childrenWalkers[NodeType.Debugger] = ChildrenWalkers.walkNone, NodeType._map)if (void 0 === this.childrenWalkers[e]) throw new Error("initWalkers function is not up to date with enum content!"); } } ]), AstWalkerFactory; }(); - TypeScript1.AstWalkerFactory = AstWalkerFactory, TypeScript1.getAstWalkerFactory = getAstWalkerFactory, (function(ChildrenWalkers) { + TypeScript1.AstWalkerFactory = AstWalkerFactory, TypeScript1.getAstWalkerFactory = function() { + return globalAstWalkerFactory || (globalAstWalkerFactory = new AstWalkerFactory()), globalAstWalkerFactory; + }, (function(ChildrenWalkers) { function walkRecordChildren(preAst, parent, walker) { preAst.name = walker.walk(preAst.name, preAst), walker.options.goNextSibling && preAst.members && (preAst.members = walker.walk(preAst.members, preAst)); } diff --git a/crates/swc/tests/tsc-references/parser/ecmascript5/parserRealSource14/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/parser/ecmascript5/parserRealSource14/input.ts/es2015.1.normal/output.js index 0136952a8a6..b5dcef84f74 100644 --- a/crates/swc/tests/tsc-references/parser/ecmascript5/parserRealSource14/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/parser/ecmascript5/parserRealSource14/input.ts/es2015.1.normal/output.js @@ -243,7 +243,7 @@ var TypeScript; } } TypeScript1.AstPathContext = AstPathContext; - var GetAstPathOptions1; + let GetAstPathOptions; (function(GetAstPathOptions) { GetAstPathOptions[GetAstPathOptions["Default"] = 0] = "Default"; GetAstPathOptions[GetAstPathOptions["EdgeInclusive"] = 1] = "EdgeInclusive"; @@ -255,9 +255,9 @@ var TypeScript; // we don't find the "precomment" attached to the errorneous empty stmt. //TODO: It would be nice to be able to get rid of this. "DontPruneSearchBasedOnPosition"] = 2] = "DontPruneSearchBasedOnPosition"; - })(GetAstPathOptions1 || (GetAstPathOptions1 = { + })(GetAstPathOptions || (GetAstPathOptions = { })); - function getAstPathToPosition(script, pos, options = GetAstPathOptions1.Default) { + function getAstPathToPosition(script, pos, options = GetAstPathOptions.Default) { var lookInComments = (comments)=>{ if (comments && comments.length > 0) { for(var i = 0; i < comments.length; i++){ @@ -281,7 +281,7 @@ var TypeScript; // bar // 0123 // If "position == 3", the caret is at the "right" of the "r" character, which should be considered valid - var inclusive = hasFlag(options, GetAstPathOptions1.EdgeInclusive) || cur.nodeType === TypeScript.NodeType.Name || pos === script.limChar; // Special "EOF" case + var inclusive = hasFlag(options, GetAstPathOptions.EdgeInclusive) || cur.nodeType === TypeScript.NodeType.Name || pos === script.limChar; // Special "EOF" case var minChar = cur.minChar; var limChar = cur.limChar + (inclusive ? 1 : 0); if (pos >= minChar && pos < limChar) { @@ -301,7 +301,7 @@ var TypeScript; if (pos >= minChar) { lookInComments(cur.postComments); } - if (!hasFlag(options, GetAstPathOptions1.DontPruneSearchBasedOnPosition)) { + if (!hasFlag(options, GetAstPathOptions.DontPruneSearchBasedOnPosition)) { // Don't go further down the tree if pos is outside of [minChar, limChar] walker.options.goChildren = minChar <= pos && pos <= limChar; } @@ -348,6 +348,6 @@ var TypeScript; TypeScript.getAstWalkerFactory().walk(ast, pre, post, null, path1); } TypeScript1.walkAST = walkAST; - TypeScript1.GetAstPathOptions = GetAstPathOptions1; + TypeScript1.GetAstPathOptions = GetAstPathOptions; })(TypeScript || (TypeScript = { })); diff --git a/crates/swc/tests/tsc-references/parser/ecmascript5/parserRealSource14/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/parser/ecmascript5/parserRealSource14/input.ts/es2015.2.minified/output.js index e297bd84618..31d7f0a5437 100644 --- a/crates/swc/tests/tsc-references/parser/ecmascript5/parserRealSource14/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/parser/ecmascript5/parserRealSource14/input.ts/es2015.2.minified/output.js @@ -1,6 +1,6 @@ var TypeScript; !function(TypeScript1) { - var GetAstPathOptions, GetAstPathOptions1; + var GetAstPathOptions; function lastOf(items) { return null === items || 0 === items.length ? null : items[items.length - 1]; } @@ -216,8 +216,10 @@ var TypeScript; this.path = new TypeScript.AstPath(); } } - TypeScript1.AstPathContext = AstPathContext, (GetAstPathOptions1 = GetAstPathOptions || (GetAstPathOptions = { - }))[GetAstPathOptions1.Default = 0] = "Default", GetAstPathOptions1[GetAstPathOptions1.EdgeInclusive = 1] = "EdgeInclusive", GetAstPathOptions1[GetAstPathOptions1.DontPruneSearchBasedOnPosition = 2] = "DontPruneSearchBasedOnPosition", TypeScript1.getAstPathToPosition = function(script, pos, options = GetAstPathOptions.Default) { + TypeScript1.AstPathContext = AstPathContext; + let GetAstPathOptions; + (GetAstPathOptions = GetAstPathOptions || (GetAstPathOptions = { + }))[GetAstPathOptions.Default = 0] = "Default", GetAstPathOptions[GetAstPathOptions.EdgeInclusive = 1] = "EdgeInclusive", GetAstPathOptions[GetAstPathOptions.DontPruneSearchBasedOnPosition = 2] = "DontPruneSearchBasedOnPosition", TypeScript1.getAstPathToPosition = function(script, pos, options = GetAstPathOptions.Default) { var lookInComments = (comments)=>{ if (comments && comments.length > 0) for(var i = 0; i < comments.length; i++){ var minChar = comments[i].minChar, limChar = comments[i].limChar; diff --git a/crates/swc/tests/tsc-references/parser/ecmascript5/parserRealSource14/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/parser/ecmascript5/parserRealSource14/input.ts/es5.1.normal/output.js index 2929632a238..cb8b95f2442 100644 --- a/crates/swc/tests/tsc-references/parser/ecmascript5/parserRealSource14/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/parser/ecmascript5/parserRealSource14/input.ts/es5.1.normal/output.js @@ -37,7 +37,7 @@ var TypeScript; return true; }; var getAstPathToPosition = function getAstPathToPosition(script, pos) { - var options = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : GetAstPathOptions1.Default; + var options = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : GetAstPathOptions.Default; var lookInComments = function(comments) { if (comments && comments.length > 0) { for(var i = 0; i < comments.length; i++){ @@ -61,7 +61,7 @@ var TypeScript; // bar // 0123 // If "position == 3", the caret is at the "right" of the "r" character, which should be considered valid - var inclusive = hasFlag(options, GetAstPathOptions1.EdgeInclusive) || cur.nodeType === TypeScript.NodeType.Name || pos === script.limChar; // Special "EOF" case + var inclusive = hasFlag(options, GetAstPathOptions.EdgeInclusive) || cur.nodeType === TypeScript.NodeType.Name || pos === script.limChar; // Special "EOF" case var minChar = cur.minChar; var limChar = cur.limChar + (inclusive ? 1 : 0); if (pos >= minChar && pos < limChar) { @@ -81,7 +81,7 @@ var TypeScript; if (pos >= minChar) { lookInComments(cur.postComments); } - if (!hasFlag(options, GetAstPathOptions1.DontPruneSearchBasedOnPosition)) { + if (!hasFlag(options, GetAstPathOptions.DontPruneSearchBasedOnPosition)) { // Don't go further down the tree if pos is outside of [minChar, limChar] walker.options.goChildren = minChar <= pos && pos <= limChar; } @@ -537,7 +537,7 @@ var TypeScript; this.path = new TypeScript.AstPath(); }; TypeScript1.AstPathContext = AstPathContext; - var GetAstPathOptions1; + var GetAstPathOptions; (function(GetAstPathOptions) { GetAstPathOptions[GetAstPathOptions["Default"] = 0] = "Default"; GetAstPathOptions[GetAstPathOptions["EdgeInclusive"] = 1] = "EdgeInclusive"; @@ -549,11 +549,11 @@ var TypeScript; // we don't find the "precomment" attached to the errorneous empty stmt. //TODO: It would be nice to be able to get rid of this. "DontPruneSearchBasedOnPosition"] = 2] = "DontPruneSearchBasedOnPosition"; - })(GetAstPathOptions1 || (GetAstPathOptions1 = { + })(GetAstPathOptions || (GetAstPathOptions = { })); TypeScript1.getAstPathToPosition = getAstPathToPosition; TypeScript1.getTokenizationOffset = getTokenizationOffset; TypeScript1.walkAST = walkAST; - TypeScript1.GetAstPathOptions = GetAstPathOptions1; + TypeScript1.GetAstPathOptions = GetAstPathOptions; })(TypeScript || (TypeScript = { })); diff --git a/crates/swc/tests/tsc-references/parser/ecmascript5/parserRealSource14/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/parser/ecmascript5/parserRealSource14/input.ts/es5.2.minified/output.js index f2f331b8361..fdd8587bf94 100644 --- a/crates/swc/tests/tsc-references/parser/ecmascript5/parserRealSource14/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/parser/ecmascript5/parserRealSource14/input.ts/es5.2.minified/output.js @@ -434,11 +434,11 @@ function _defineProperties(target, props) { ], protoProps && _defineProperties(Constructor.prototype, protoProps), staticProps && _defineProperties(Constructor, staticProps), AstPath; }(); TypeScript1.AstPath = AstPath, TypeScript1.isValidAstNode = isValidAstNode; - var GetAstPathOptions1, AstPathContext = function AstPathContext() { + var GetAstPathOptions, AstPathContext = function AstPathContext() { "use strict"; _classCallCheck(this, AstPathContext), this.path = new TypeScript.AstPath(); }; - TypeScript1.AstPathContext = AstPathContext, (GetAstPathOptions1 = GetAstPathOptions || (GetAstPathOptions = { - }))[GetAstPathOptions1.Default = 0] = "Default", GetAstPathOptions1[GetAstPathOptions1.EdgeInclusive = 1] = "EdgeInclusive", GetAstPathOptions1[GetAstPathOptions1.DontPruneSearchBasedOnPosition = 2] = "DontPruneSearchBasedOnPosition", TypeScript1.getAstPathToPosition = getAstPathToPosition, TypeScript1.getTokenizationOffset = getTokenizationOffset, TypeScript1.walkAST = walkAST, TypeScript1.GetAstPathOptions = GetAstPathOptions; + TypeScript1.AstPathContext = AstPathContext, (GetAstPathOptions = GetAstPathOptions || (GetAstPathOptions = { + }))[GetAstPathOptions.Default = 0] = "Default", GetAstPathOptions[GetAstPathOptions.EdgeInclusive = 1] = "EdgeInclusive", GetAstPathOptions[GetAstPathOptions.DontPruneSearchBasedOnPosition = 2] = "DontPruneSearchBasedOnPosition", TypeScript1.getAstPathToPosition = getAstPathToPosition, TypeScript1.getTokenizationOffset = getTokenizationOffset, TypeScript1.walkAST = walkAST, TypeScript1.GetAstPathOptions = GetAstPathOptions; }(TypeScript || (TypeScript = { })); diff --git a/crates/swc/tests/tsc-references/parser/ecmascript5/parserRealSource2/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/parser/ecmascript5/parserRealSource2/input.ts/es2015.1.normal/output.js index 35d0b7a8ed1..7cdce519d72 100644 --- a/crates/swc/tests/tsc-references/parser/ecmascript5/parserRealSource2/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/parser/ecmascript5/parserRealSource2/input.ts/es2015.1.normal/output.js @@ -7,7 +7,7 @@ var TypeScript; return (val & flag) != 0; } TypeScript1.hasFlag = hasFlag; - var ErrorRecoverySet1; + let ErrorRecoverySet; (function(ErrorRecoverySet) { ErrorRecoverySet[ErrorRecoverySet["None"] = 0] = "None"; ErrorRecoverySet[ErrorRecoverySet["Comma"] = 1] = "Comma"; @@ -47,9 +47,9 @@ var TypeScript; ErrorRecoverySet[ErrorRecoverySet["ExprStart"] = 520158210] = "ExprStart"; ErrorRecoverySet[ErrorRecoverySet["StmtStart"] = 1608580098] = "StmtStart"; ErrorRecoverySet[ErrorRecoverySet["Postfix"] = 49280] = "Postfix"; - })(ErrorRecoverySet1 || (ErrorRecoverySet1 = { + })(ErrorRecoverySet || (ErrorRecoverySet = { })); - var AllowedElements1; + let AllowedElements; (function(AllowedElements) { AllowedElements[AllowedElements["None"] = 0] = "None"; AllowedElements[AllowedElements["ModuleDeclarations"] = 4] = "ModuleDeclarations"; @@ -59,9 +59,9 @@ var TypeScript; AllowedElements[AllowedElements["Properties"] = 2048] = "Properties"; AllowedElements[AllowedElements["Global"] = 1052] = "Global"; AllowedElements[AllowedElements["QuickParse"] = 3100] = "QuickParse"; - })(AllowedElements1 || (AllowedElements1 = { + })(AllowedElements || (AllowedElements = { })); - var Modifiers1; + let Modifiers; (function(Modifiers) { Modifiers[Modifiers["None"] = 0] = "None"; Modifiers[Modifiers["Private"] = 1] = "Private"; @@ -72,9 +72,9 @@ var TypeScript; Modifiers[Modifiers["Getter"] = 32] = "Getter"; Modifiers[Modifiers["Setter"] = 64] = "Setter"; Modifiers[Modifiers["Static"] = 128] = "Static"; - })(Modifiers1 || (Modifiers1 = { + })(Modifiers || (Modifiers = { })); - var ASTFlags1; + let ASTFlags; (function(ASTFlags) { ASTFlags[ASTFlags["None"] = 0] = "None"; ASTFlags[ASTFlags["ExplicitSemicolon"] = 1] = "ExplicitSemicolon"; @@ -92,9 +92,9 @@ var TypeScript; // The flag is used to communicate this piece of information to the calling parseTerm, which intern will remove it. // Once we have a better way to associate information with nodes, this flag should not be used. "SkipNextRParen"] = 2048] = "SkipNextRParen"; - })(ASTFlags1 || (ASTFlags1 = { + })(ASTFlags || (ASTFlags = { })); - var DeclFlags1; + let DeclFlags; (function(DeclFlags) { DeclFlags[DeclFlags["None"] = 0] = "None"; DeclFlags[DeclFlags["Exported"] = 1] = "Exported"; @@ -105,9 +105,9 @@ var TypeScript; DeclFlags[DeclFlags["LocalStatic"] = 32] = "LocalStatic"; DeclFlags[DeclFlags["GetAccessor"] = 64] = "GetAccessor"; DeclFlags[DeclFlags["SetAccessor"] = 128] = "SetAccessor"; - })(DeclFlags1 || (DeclFlags1 = { + })(DeclFlags || (DeclFlags = { })); - var ModuleFlags1; + let ModuleFlags; (function(ModuleFlags) { ModuleFlags[ModuleFlags["None"] = 0] = "None"; ModuleFlags[ModuleFlags["Exported"] = 1] = "Exported"; @@ -123,9 +123,9 @@ var TypeScript; ModuleFlags[ModuleFlags["IsWholeFile"] = 1024] = "IsWholeFile"; ModuleFlags[ModuleFlags["IsDynamic"] = 2048] = "IsDynamic"; ModuleFlags[ModuleFlags["MustCaptureThis"] = 4096] = "MustCaptureThis"; - })(ModuleFlags1 || (ModuleFlags1 = { + })(ModuleFlags || (ModuleFlags = { })); - var SymbolFlags1; + let SymbolFlags; (function(SymbolFlags) { SymbolFlags[SymbolFlags["None"] = 0] = "None"; SymbolFlags[SymbolFlags["Exported"] = 1] = "Exported"; @@ -148,9 +148,9 @@ var TypeScript; SymbolFlags[SymbolFlags["RecursivelyReferenced"] = 131072] = "RecursivelyReferenced"; SymbolFlags[SymbolFlags["Bound"] = 262144] = "Bound"; SymbolFlags[SymbolFlags["CompilerGenerated"] = 524288] = "CompilerGenerated"; - })(SymbolFlags1 || (SymbolFlags1 = { + })(SymbolFlags || (SymbolFlags = { })); - var VarFlags1; + let VarFlags; (function(VarFlags) { VarFlags[VarFlags["None"] = 0] = "None"; VarFlags[VarFlags["Exported"] = 1] = "Exported"; @@ -171,9 +171,9 @@ var TypeScript; VarFlags[VarFlags["ClassSuperMustBeFirstCallInConstructor"] = 32768] = "ClassSuperMustBeFirstCallInConstructor"; VarFlags[VarFlags["Constant"] = 65536] = "Constant"; VarFlags[VarFlags["MustCaptureThis"] = 131072] = "MustCaptureThis"; - })(VarFlags1 || (VarFlags1 = { + })(VarFlags || (VarFlags = { })); - var FncFlags1; + let FncFlags; (function(FncFlags) { FncFlags[FncFlags["None"] = 0] = "None"; FncFlags[FncFlags["Exported"] = 1] = "Exported"; @@ -196,21 +196,21 @@ var TypeScript; FncFlags[FncFlags["IsFunctionExpression"] = 131072] = "IsFunctionExpression"; FncFlags[FncFlags["ClassMethod"] = 262144] = "ClassMethod"; FncFlags[FncFlags["ClassPropertyMethodExported"] = 524288] = "ClassPropertyMethodExported"; - })(FncFlags1 || (FncFlags1 = { + })(FncFlags || (FncFlags = { })); - var SignatureFlags1; + let SignatureFlags; (function(SignatureFlags) { SignatureFlags[SignatureFlags["None"] = 0] = "None"; SignatureFlags[SignatureFlags["IsIndexer"] = 1] = "IsIndexer"; SignatureFlags[SignatureFlags["IsStringIndexer"] = 2] = "IsStringIndexer"; SignatureFlags[SignatureFlags["IsNumberIndexer"] = 4] = "IsNumberIndexer"; - })(SignatureFlags1 || (SignatureFlags1 = { + })(SignatureFlags || (SignatureFlags = { })); function ToDeclFlags(fncOrVarOrSymbolOrModuleFlags) { return fncOrVarOrSymbolOrModuleFlags; } TypeScript1.ToDeclFlags = ToDeclFlags; - var TypeFlags1; + let TypeFlags; (function(TypeFlags) { TypeFlags[TypeFlags["None"] = 0] = "None"; TypeFlags[TypeFlags["HasImplementation"] = 1] = "HasImplementation"; @@ -221,9 +221,9 @@ var TypeScript; TypeFlags[TypeFlags["HasBaseType"] = 32] = "HasBaseType"; TypeFlags[TypeFlags["HasBaseTypeOfObject"] = 64] = "HasBaseTypeOfObject"; TypeFlags[TypeFlags["IsClass"] = 128] = "IsClass"; - })(TypeFlags1 || (TypeFlags1 = { + })(TypeFlags || (TypeFlags = { })); - var TypeRelationshipFlags1; + let TypeRelationshipFlags; (function(TypeRelationshipFlags) { TypeRelationshipFlags[TypeRelationshipFlags["SuccessfulComparison"] = 0] = "SuccessfulComparison"; TypeRelationshipFlags[TypeRelationshipFlags["SourceIsNullTargetIsVoidOrUndefined"] = 1] = "SourceIsNullTargetIsVoidOrUndefined"; @@ -233,23 +233,23 @@ var TypeScript; TypeRelationshipFlags[TypeRelationshipFlags["IncompatibleReturnTypes"] = 16] = "IncompatibleReturnTypes"; TypeRelationshipFlags[TypeRelationshipFlags["IncompatiblePropertyTypes"] = 32] = "IncompatiblePropertyTypes"; TypeRelationshipFlags[TypeRelationshipFlags["IncompatibleParameterTypes"] = 64] = "IncompatibleParameterTypes"; - })(TypeRelationshipFlags1 || (TypeRelationshipFlags1 = { + })(TypeRelationshipFlags || (TypeRelationshipFlags = { })); - var CodeGenTarget1; + let CodeGenTarget; (function(CodeGenTarget) { CodeGenTarget[CodeGenTarget["ES3"] = 0] = "ES3"; CodeGenTarget[CodeGenTarget["ES5"] = 1] = "ES5"; - })(CodeGenTarget1 || (CodeGenTarget1 = { + })(CodeGenTarget || (CodeGenTarget = { })); - var ModuleGenTarget1; + let ModuleGenTarget; (function(ModuleGenTarget) { ModuleGenTarget[ModuleGenTarget["Synchronous"] = 0] = "Synchronous"; ModuleGenTarget[ModuleGenTarget["Asynchronous"] = 1] = "Asynchronous"; ModuleGenTarget[ModuleGenTarget["Local"] = 2] = "Local"; - })(ModuleGenTarget1 || (ModuleGenTarget1 = { + })(ModuleGenTarget || (ModuleGenTarget = { })); - TypeScript1.codeGenTarget = CodeGenTarget1.ES3; - TypeScript1.moduleGenTarget = ModuleGenTarget1.Synchronous; + TypeScript1.codeGenTarget = CodeGenTarget.ES3; + TypeScript1.moduleGenTarget = ModuleGenTarget.Synchronous; TypeScript1.optimizeModuleCodeGen = true; function flagsToString(e, flags) { var builder = ""; @@ -269,6 +269,6 @@ var TypeScript; return builder; } TypeScript1.flagsToString = flagsToString; - TypeScript1.ErrorRecoverySet = ErrorRecoverySet1, TypeScript1.AllowedElements = AllowedElements1, TypeScript1.Modifiers = Modifiers1, TypeScript1.ASTFlags = ASTFlags1, TypeScript1.DeclFlags = DeclFlags1, TypeScript1.ModuleFlags = ModuleFlags1, TypeScript1.SymbolFlags = SymbolFlags1, TypeScript1.VarFlags = VarFlags1, TypeScript1.FncFlags = FncFlags1, TypeScript1.SignatureFlags = SignatureFlags1, TypeScript1.TypeFlags = TypeFlags1, TypeScript1.TypeRelationshipFlags = TypeRelationshipFlags1, TypeScript1.CodeGenTarget = CodeGenTarget1, TypeScript1.ModuleGenTarget = ModuleGenTarget1; + TypeScript1.ErrorRecoverySet = ErrorRecoverySet, TypeScript1.AllowedElements = AllowedElements, TypeScript1.Modifiers = Modifiers, TypeScript1.ASTFlags = ASTFlags, TypeScript1.DeclFlags = DeclFlags, TypeScript1.ModuleFlags = ModuleFlags, TypeScript1.SymbolFlags = SymbolFlags, TypeScript1.VarFlags = VarFlags, TypeScript1.FncFlags = FncFlags, TypeScript1.SignatureFlags = SignatureFlags, TypeScript1.TypeFlags = TypeFlags, TypeScript1.TypeRelationshipFlags = TypeRelationshipFlags, TypeScript1.CodeGenTarget = CodeGenTarget, TypeScript1.ModuleGenTarget = ModuleGenTarget; })(TypeScript || (TypeScript = { })); diff --git a/crates/swc/tests/tsc-references/parser/ecmascript5/parserRealSource2/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/parser/ecmascript5/parserRealSource2/input.ts/es2015.2.minified/output.js index 1414caa3f4d..9555c5cbc82 100644 --- a/crates/swc/tests/tsc-references/parser/ecmascript5/parserRealSource2/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/parser/ecmascript5/parserRealSource2/input.ts/es2015.2.minified/output.js @@ -1,25 +1,53 @@ var TypeScript; !function(TypeScript1) { - var ErrorRecoverySet, AllowedElements, Modifiers, ASTFlags, DeclFlags, ModuleFlags, SymbolFlags, VarFlags, FncFlags, SignatureFlags, TypeFlags, TypeRelationshipFlags, CodeGenTarget, ModuleGenTarget, ErrorRecoverySet1, AllowedElements1, Modifiers1, ASTFlags1, DeclFlags1, ModuleFlags1, SymbolFlags1, VarFlags1, FncFlags1, SignatureFlags1, TypeFlags1, TypeRelationshipFlags1, CodeGenTarget1, ModuleGenTarget1; + var ErrorRecoverySet, AllowedElements, Modifiers, ASTFlags, DeclFlags, ModuleFlags, SymbolFlags, VarFlags, FncFlags, SignatureFlags, TypeFlags, TypeRelationshipFlags, CodeGenTarget, ModuleGenTarget; TypeScript1.hasFlag = function(val, flag) { return (val & flag) != 0; - }, (ErrorRecoverySet1 = ErrorRecoverySet || (ErrorRecoverySet = { - }))[ErrorRecoverySet1.None = 0] = "None", ErrorRecoverySet1[ErrorRecoverySet1.Comma = 1] = "Comma", ErrorRecoverySet1[ErrorRecoverySet1.SColon = 2] = "SColon", ErrorRecoverySet1[ErrorRecoverySet1.Asg = 4] = "Asg", ErrorRecoverySet1[ErrorRecoverySet1.BinOp = 8] = "BinOp", ErrorRecoverySet1[ErrorRecoverySet1.RBrack = 16] = "RBrack", ErrorRecoverySet1[ErrorRecoverySet1.RCurly = 32] = "RCurly", ErrorRecoverySet1[ErrorRecoverySet1.RParen = 64] = "RParen", ErrorRecoverySet1[ErrorRecoverySet1.Dot = 128] = "Dot", ErrorRecoverySet1[ErrorRecoverySet1.Colon = 256] = "Colon", ErrorRecoverySet1[ErrorRecoverySet1.PrimType = 512] = "PrimType", ErrorRecoverySet1[ErrorRecoverySet1.AddOp = 1024] = "AddOp", ErrorRecoverySet1[ErrorRecoverySet1.LCurly = 2048] = "LCurly", ErrorRecoverySet1[ErrorRecoverySet1.PreOp = 4096] = "PreOp", ErrorRecoverySet1[ErrorRecoverySet1.RegExp = 8192] = "RegExp", ErrorRecoverySet1[ErrorRecoverySet1.LParen = 16384] = "LParen", ErrorRecoverySet1[ErrorRecoverySet1.LBrack = 32768] = "LBrack", ErrorRecoverySet1[ErrorRecoverySet1.Scope = 65536] = "Scope", ErrorRecoverySet1[ErrorRecoverySet1.In = 131072] = "In", ErrorRecoverySet1[ErrorRecoverySet1.SCase = 262144] = "SCase", ErrorRecoverySet1[ErrorRecoverySet1.Else = 524288] = "Else", ErrorRecoverySet1[ErrorRecoverySet1.Catch = 1048576] = "Catch", ErrorRecoverySet1[ErrorRecoverySet1.Var = 2097152] = "Var", ErrorRecoverySet1[ErrorRecoverySet1.Stmt = 4194304] = "Stmt", ErrorRecoverySet1[ErrorRecoverySet1.While = 8388608] = "While", ErrorRecoverySet1[ErrorRecoverySet1.ID = 16777216] = "ID", ErrorRecoverySet1[ErrorRecoverySet1.Prefix = 33554432] = "Prefix", ErrorRecoverySet1[ErrorRecoverySet1.Literal = 67108864] = "Literal", ErrorRecoverySet1[ErrorRecoverySet1.RLit = 134217728] = "RLit", ErrorRecoverySet1[ErrorRecoverySet1.Func = 268435456] = "Func", ErrorRecoverySet1[ErrorRecoverySet1.EOF = 536870912] = "EOF", ErrorRecoverySet1[ErrorRecoverySet1.TypeScriptS = 1073741824] = "TypeScriptS", ErrorRecoverySet1[ErrorRecoverySet1.ExprStart = 520158210] = "ExprStart", ErrorRecoverySet1[ErrorRecoverySet1.StmtStart = 1608580098] = "StmtStart", ErrorRecoverySet1[ErrorRecoverySet1.Postfix = 49280] = "Postfix", (AllowedElements1 = AllowedElements || (AllowedElements = { - }))[AllowedElements1.None = 0] = "None", AllowedElements1[AllowedElements1.ModuleDeclarations = 4] = "ModuleDeclarations", AllowedElements1[AllowedElements1.ClassDeclarations = 8] = "ClassDeclarations", AllowedElements1[AllowedElements1.InterfaceDeclarations = 16] = "InterfaceDeclarations", AllowedElements1[AllowedElements1.AmbientDeclarations = 1024] = "AmbientDeclarations", AllowedElements1[AllowedElements1.Properties = 2048] = "Properties", AllowedElements1[AllowedElements1.Global = 1052] = "Global", AllowedElements1[AllowedElements1.QuickParse = 3100] = "QuickParse", (Modifiers1 = Modifiers || (Modifiers = { - }))[Modifiers1.None = 0] = "None", Modifiers1[Modifiers1.Private = 1] = "Private", Modifiers1[Modifiers1.Public = 2] = "Public", Modifiers1[Modifiers1.Readonly = 4] = "Readonly", Modifiers1[Modifiers1.Ambient = 8] = "Ambient", Modifiers1[Modifiers1.Exported = 16] = "Exported", Modifiers1[Modifiers1.Getter = 32] = "Getter", Modifiers1[Modifiers1.Setter = 64] = "Setter", Modifiers1[Modifiers1.Static = 128] = "Static", (ASTFlags1 = ASTFlags || (ASTFlags = { - }))[ASTFlags1.None = 0] = "None", ASTFlags1[ASTFlags1.ExplicitSemicolon = 1] = "ExplicitSemicolon", ASTFlags1[ASTFlags1.AutomaticSemicolon = 2] = "AutomaticSemicolon", ASTFlags1[ASTFlags1.Writeable = 4] = "Writeable", ASTFlags1[ASTFlags1.Error = 8] = "Error", ASTFlags1[ASTFlags1.DotLHSPartial = 16] = "DotLHSPartial", ASTFlags1[ASTFlags1.DotLHS = 32] = "DotLHS", ASTFlags1[ASTFlags1.IsStatement = 64] = "IsStatement", ASTFlags1[ASTFlags1.StrictMode = 128] = "StrictMode", ASTFlags1[ASTFlags1.PossibleOptionalParameter = 256] = "PossibleOptionalParameter", ASTFlags1[ASTFlags1.ClassBaseConstructorCall = 512] = "ClassBaseConstructorCall", ASTFlags1[ASTFlags1.OptionalName = 1024] = "OptionalName", ASTFlags1[ASTFlags1.SkipNextRParen = 2048] = "SkipNextRParen", (DeclFlags1 = DeclFlags || (DeclFlags = { - }))[DeclFlags1.None = 0] = "None", DeclFlags1[DeclFlags1.Exported = 1] = "Exported", DeclFlags1[DeclFlags1.Private = 2] = "Private", DeclFlags1[DeclFlags1.Public = 4] = "Public", DeclFlags1[DeclFlags1.Ambient = 8] = "Ambient", DeclFlags1[DeclFlags1.Static = 16] = "Static", DeclFlags1[DeclFlags1.LocalStatic = 32] = "LocalStatic", DeclFlags1[DeclFlags1.GetAccessor = 64] = "GetAccessor", DeclFlags1[DeclFlags1.SetAccessor = 128] = "SetAccessor", (ModuleFlags1 = ModuleFlags || (ModuleFlags = { - }))[ModuleFlags1.None = 0] = "None", ModuleFlags1[ModuleFlags1.Exported = 1] = "Exported", ModuleFlags1[ModuleFlags1.Private = 2] = "Private", ModuleFlags1[ModuleFlags1.Public = 4] = "Public", ModuleFlags1[ModuleFlags1.Ambient = 8] = "Ambient", ModuleFlags1[ModuleFlags1.Static = 16] = "Static", ModuleFlags1[ModuleFlags1.LocalStatic = 32] = "LocalStatic", ModuleFlags1[ModuleFlags1.GetAccessor = 64] = "GetAccessor", ModuleFlags1[ModuleFlags1.SetAccessor = 128] = "SetAccessor", ModuleFlags1[ModuleFlags1.IsEnum = 256] = "IsEnum", ModuleFlags1[ModuleFlags1.ShouldEmitModuleDecl = 512] = "ShouldEmitModuleDecl", ModuleFlags1[ModuleFlags1.IsWholeFile = 1024] = "IsWholeFile", ModuleFlags1[ModuleFlags1.IsDynamic = 2048] = "IsDynamic", ModuleFlags1[ModuleFlags1.MustCaptureThis = 4096] = "MustCaptureThis", (SymbolFlags1 = SymbolFlags || (SymbolFlags = { - }))[SymbolFlags1.None = 0] = "None", SymbolFlags1[SymbolFlags1.Exported = 1] = "Exported", SymbolFlags1[SymbolFlags1.Private = 2] = "Private", SymbolFlags1[SymbolFlags1.Public = 4] = "Public", SymbolFlags1[SymbolFlags1.Ambient = 8] = "Ambient", SymbolFlags1[SymbolFlags1.Static = 16] = "Static", SymbolFlags1[SymbolFlags1.LocalStatic = 32] = "LocalStatic", SymbolFlags1[SymbolFlags1.GetAccessor = 64] = "GetAccessor", SymbolFlags1[SymbolFlags1.SetAccessor = 128] = "SetAccessor", SymbolFlags1[SymbolFlags1.Property = 256] = "Property", SymbolFlags1[SymbolFlags1.Readonly = 512] = "Readonly", SymbolFlags1[SymbolFlags1.ModuleMember = 1024] = "ModuleMember", SymbolFlags1[SymbolFlags1.InterfaceMember = 2048] = "InterfaceMember", SymbolFlags1[SymbolFlags1.ClassMember = 4096] = "ClassMember", SymbolFlags1[SymbolFlags1.BuiltIn = 8192] = "BuiltIn", SymbolFlags1[SymbolFlags1.TypeSetDuringScopeAssignment = 16384] = "TypeSetDuringScopeAssignment", SymbolFlags1[SymbolFlags1.Constant = 32768] = "Constant", SymbolFlags1[SymbolFlags1.Optional = 65536] = "Optional", SymbolFlags1[SymbolFlags1.RecursivelyReferenced = 131072] = "RecursivelyReferenced", SymbolFlags1[SymbolFlags1.Bound = 262144] = "Bound", SymbolFlags1[SymbolFlags1.CompilerGenerated = 524288] = "CompilerGenerated", (VarFlags1 = VarFlags || (VarFlags = { - }))[VarFlags1.None = 0] = "None", VarFlags1[VarFlags1.Exported = 1] = "Exported", VarFlags1[VarFlags1.Private = 2] = "Private", VarFlags1[VarFlags1.Public = 4] = "Public", VarFlags1[VarFlags1.Ambient = 8] = "Ambient", VarFlags1[VarFlags1.Static = 16] = "Static", VarFlags1[VarFlags1.LocalStatic = 32] = "LocalStatic", VarFlags1[VarFlags1.GetAccessor = 64] = "GetAccessor", VarFlags1[VarFlags1.SetAccessor = 128] = "SetAccessor", VarFlags1[VarFlags1.AutoInit = 256] = "AutoInit", VarFlags1[VarFlags1.Property = 512] = "Property", VarFlags1[VarFlags1.Readonly = 1024] = "Readonly", VarFlags1[VarFlags1.Class = 2048] = "Class", VarFlags1[VarFlags1.ClassProperty = 4096] = "ClassProperty", VarFlags1[VarFlags1.ClassBodyProperty = 8192] = "ClassBodyProperty", VarFlags1[VarFlags1.ClassConstructorProperty = 16384] = "ClassConstructorProperty", VarFlags1[VarFlags1.ClassSuperMustBeFirstCallInConstructor = 32768] = "ClassSuperMustBeFirstCallInConstructor", VarFlags1[VarFlags1.Constant = 65536] = "Constant", VarFlags1[VarFlags1.MustCaptureThis = 131072] = "MustCaptureThis", (FncFlags1 = FncFlags || (FncFlags = { - }))[FncFlags1.None = 0] = "None", FncFlags1[FncFlags1.Exported = 1] = "Exported", FncFlags1[FncFlags1.Private = 2] = "Private", FncFlags1[FncFlags1.Public = 4] = "Public", FncFlags1[FncFlags1.Ambient = 8] = "Ambient", FncFlags1[FncFlags1.Static = 16] = "Static", FncFlags1[FncFlags1.LocalStatic = 32] = "LocalStatic", FncFlags1[FncFlags1.GetAccessor = 64] = "GetAccessor", FncFlags1[FncFlags1.SetAccessor = 128] = "SetAccessor", FncFlags1[FncFlags1.Definition = 256] = "Definition", FncFlags1[FncFlags1.Signature = 512] = "Signature", FncFlags1[FncFlags1.Method = 1024] = "Method", FncFlags1[FncFlags1.HasReturnExpression = 2048] = "HasReturnExpression", FncFlags1[FncFlags1.CallMember = 4096] = "CallMember", FncFlags1[FncFlags1.ConstructMember = 8192] = "ConstructMember", FncFlags1[FncFlags1.HasSelfReference = 16384] = "HasSelfReference", FncFlags1[FncFlags1.IsFatArrowFunction = 32768] = "IsFatArrowFunction", FncFlags1[FncFlags1.IndexerMember = 65536] = "IndexerMember", FncFlags1[FncFlags1.IsFunctionExpression = 131072] = "IsFunctionExpression", FncFlags1[FncFlags1.ClassMethod = 262144] = "ClassMethod", FncFlags1[FncFlags1.ClassPropertyMethodExported = 524288] = "ClassPropertyMethodExported", (SignatureFlags1 = SignatureFlags || (SignatureFlags = { - }))[SignatureFlags1.None = 0] = "None", SignatureFlags1[SignatureFlags1.IsIndexer = 1] = "IsIndexer", SignatureFlags1[SignatureFlags1.IsStringIndexer = 2] = "IsStringIndexer", SignatureFlags1[SignatureFlags1.IsNumberIndexer = 4] = "IsNumberIndexer", TypeScript1.ToDeclFlags = function(fncOrVarOrSymbolOrModuleFlags) { + }; + let ErrorRecoverySet; + (ErrorRecoverySet = ErrorRecoverySet || (ErrorRecoverySet = { + }))[ErrorRecoverySet.None = 0] = "None", ErrorRecoverySet[ErrorRecoverySet.Comma = 1] = "Comma", ErrorRecoverySet[ErrorRecoverySet.SColon = 2] = "SColon", ErrorRecoverySet[ErrorRecoverySet.Asg = 4] = "Asg", ErrorRecoverySet[ErrorRecoverySet.BinOp = 8] = "BinOp", ErrorRecoverySet[ErrorRecoverySet.RBrack = 16] = "RBrack", ErrorRecoverySet[ErrorRecoverySet.RCurly = 32] = "RCurly", ErrorRecoverySet[ErrorRecoverySet.RParen = 64] = "RParen", ErrorRecoverySet[ErrorRecoverySet.Dot = 128] = "Dot", ErrorRecoverySet[ErrorRecoverySet.Colon = 256] = "Colon", ErrorRecoverySet[ErrorRecoverySet.PrimType = 512] = "PrimType", ErrorRecoverySet[ErrorRecoverySet.AddOp = 1024] = "AddOp", ErrorRecoverySet[ErrorRecoverySet.LCurly = 2048] = "LCurly", ErrorRecoverySet[ErrorRecoverySet.PreOp = 4096] = "PreOp", ErrorRecoverySet[ErrorRecoverySet.RegExp = 8192] = "RegExp", ErrorRecoverySet[ErrorRecoverySet.LParen = 16384] = "LParen", ErrorRecoverySet[ErrorRecoverySet.LBrack = 32768] = "LBrack", ErrorRecoverySet[ErrorRecoverySet.Scope = 65536] = "Scope", ErrorRecoverySet[ErrorRecoverySet.In = 131072] = "In", ErrorRecoverySet[ErrorRecoverySet.SCase = 262144] = "SCase", ErrorRecoverySet[ErrorRecoverySet.Else = 524288] = "Else", ErrorRecoverySet[ErrorRecoverySet.Catch = 1048576] = "Catch", ErrorRecoverySet[ErrorRecoverySet.Var = 2097152] = "Var", ErrorRecoverySet[ErrorRecoverySet.Stmt = 4194304] = "Stmt", ErrorRecoverySet[ErrorRecoverySet.While = 8388608] = "While", ErrorRecoverySet[ErrorRecoverySet.ID = 16777216] = "ID", ErrorRecoverySet[ErrorRecoverySet.Prefix = 33554432] = "Prefix", ErrorRecoverySet[ErrorRecoverySet.Literal = 67108864] = "Literal", ErrorRecoverySet[ErrorRecoverySet.RLit = 134217728] = "RLit", ErrorRecoverySet[ErrorRecoverySet.Func = 268435456] = "Func", ErrorRecoverySet[ErrorRecoverySet.EOF = 536870912] = "EOF", ErrorRecoverySet[ErrorRecoverySet.TypeScriptS = 1073741824] = "TypeScriptS", ErrorRecoverySet[ErrorRecoverySet.ExprStart = 520158210] = "ExprStart", ErrorRecoverySet[ErrorRecoverySet.StmtStart = 1608580098] = "StmtStart", ErrorRecoverySet[ErrorRecoverySet.Postfix = 49280] = "Postfix"; + let AllowedElements; + (AllowedElements = AllowedElements || (AllowedElements = { + }))[AllowedElements.None = 0] = "None", AllowedElements[AllowedElements.ModuleDeclarations = 4] = "ModuleDeclarations", AllowedElements[AllowedElements.ClassDeclarations = 8] = "ClassDeclarations", AllowedElements[AllowedElements.InterfaceDeclarations = 16] = "InterfaceDeclarations", AllowedElements[AllowedElements.AmbientDeclarations = 1024] = "AmbientDeclarations", AllowedElements[AllowedElements.Properties = 2048] = "Properties", AllowedElements[AllowedElements.Global = 1052] = "Global", AllowedElements[AllowedElements.QuickParse = 3100] = "QuickParse"; + let Modifiers; + (Modifiers = Modifiers || (Modifiers = { + }))[Modifiers.None = 0] = "None", Modifiers[Modifiers.Private = 1] = "Private", Modifiers[Modifiers.Public = 2] = "Public", Modifiers[Modifiers.Readonly = 4] = "Readonly", Modifiers[Modifiers.Ambient = 8] = "Ambient", Modifiers[Modifiers.Exported = 16] = "Exported", Modifiers[Modifiers.Getter = 32] = "Getter", Modifiers[Modifiers.Setter = 64] = "Setter", Modifiers[Modifiers.Static = 128] = "Static"; + let ASTFlags; + (ASTFlags = ASTFlags || (ASTFlags = { + }))[ASTFlags.None = 0] = "None", ASTFlags[ASTFlags.ExplicitSemicolon = 1] = "ExplicitSemicolon", ASTFlags[ASTFlags.AutomaticSemicolon = 2] = "AutomaticSemicolon", ASTFlags[ASTFlags.Writeable = 4] = "Writeable", ASTFlags[ASTFlags.Error = 8] = "Error", ASTFlags[ASTFlags.DotLHSPartial = 16] = "DotLHSPartial", ASTFlags[ASTFlags.DotLHS = 32] = "DotLHS", ASTFlags[ASTFlags.IsStatement = 64] = "IsStatement", ASTFlags[ASTFlags.StrictMode = 128] = "StrictMode", ASTFlags[ASTFlags.PossibleOptionalParameter = 256] = "PossibleOptionalParameter", ASTFlags[ASTFlags.ClassBaseConstructorCall = 512] = "ClassBaseConstructorCall", ASTFlags[ASTFlags.OptionalName = 1024] = "OptionalName", ASTFlags[ASTFlags.SkipNextRParen = 2048] = "SkipNextRParen"; + let DeclFlags; + (DeclFlags = DeclFlags || (DeclFlags = { + }))[DeclFlags.None = 0] = "None", DeclFlags[DeclFlags.Exported = 1] = "Exported", DeclFlags[DeclFlags.Private = 2] = "Private", DeclFlags[DeclFlags.Public = 4] = "Public", DeclFlags[DeclFlags.Ambient = 8] = "Ambient", DeclFlags[DeclFlags.Static = 16] = "Static", DeclFlags[DeclFlags.LocalStatic = 32] = "LocalStatic", DeclFlags[DeclFlags.GetAccessor = 64] = "GetAccessor", DeclFlags[DeclFlags.SetAccessor = 128] = "SetAccessor"; + let ModuleFlags; + (ModuleFlags = ModuleFlags || (ModuleFlags = { + }))[ModuleFlags.None = 0] = "None", ModuleFlags[ModuleFlags.Exported = 1] = "Exported", ModuleFlags[ModuleFlags.Private = 2] = "Private", ModuleFlags[ModuleFlags.Public = 4] = "Public", ModuleFlags[ModuleFlags.Ambient = 8] = "Ambient", ModuleFlags[ModuleFlags.Static = 16] = "Static", ModuleFlags[ModuleFlags.LocalStatic = 32] = "LocalStatic", ModuleFlags[ModuleFlags.GetAccessor = 64] = "GetAccessor", ModuleFlags[ModuleFlags.SetAccessor = 128] = "SetAccessor", ModuleFlags[ModuleFlags.IsEnum = 256] = "IsEnum", ModuleFlags[ModuleFlags.ShouldEmitModuleDecl = 512] = "ShouldEmitModuleDecl", ModuleFlags[ModuleFlags.IsWholeFile = 1024] = "IsWholeFile", ModuleFlags[ModuleFlags.IsDynamic = 2048] = "IsDynamic", ModuleFlags[ModuleFlags.MustCaptureThis = 4096] = "MustCaptureThis"; + let SymbolFlags; + (SymbolFlags = SymbolFlags || (SymbolFlags = { + }))[SymbolFlags.None = 0] = "None", SymbolFlags[SymbolFlags.Exported = 1] = "Exported", SymbolFlags[SymbolFlags.Private = 2] = "Private", SymbolFlags[SymbolFlags.Public = 4] = "Public", SymbolFlags[SymbolFlags.Ambient = 8] = "Ambient", SymbolFlags[SymbolFlags.Static = 16] = "Static", SymbolFlags[SymbolFlags.LocalStatic = 32] = "LocalStatic", SymbolFlags[SymbolFlags.GetAccessor = 64] = "GetAccessor", SymbolFlags[SymbolFlags.SetAccessor = 128] = "SetAccessor", SymbolFlags[SymbolFlags.Property = 256] = "Property", SymbolFlags[SymbolFlags.Readonly = 512] = "Readonly", SymbolFlags[SymbolFlags.ModuleMember = 1024] = "ModuleMember", SymbolFlags[SymbolFlags.InterfaceMember = 2048] = "InterfaceMember", SymbolFlags[SymbolFlags.ClassMember = 4096] = "ClassMember", SymbolFlags[SymbolFlags.BuiltIn = 8192] = "BuiltIn", SymbolFlags[SymbolFlags.TypeSetDuringScopeAssignment = 16384] = "TypeSetDuringScopeAssignment", SymbolFlags[SymbolFlags.Constant = 32768] = "Constant", SymbolFlags[SymbolFlags.Optional = 65536] = "Optional", SymbolFlags[SymbolFlags.RecursivelyReferenced = 131072] = "RecursivelyReferenced", SymbolFlags[SymbolFlags.Bound = 262144] = "Bound", SymbolFlags[SymbolFlags.CompilerGenerated = 524288] = "CompilerGenerated"; + let VarFlags; + (VarFlags = VarFlags || (VarFlags = { + }))[VarFlags.None = 0] = "None", VarFlags[VarFlags.Exported = 1] = "Exported", VarFlags[VarFlags.Private = 2] = "Private", VarFlags[VarFlags.Public = 4] = "Public", VarFlags[VarFlags.Ambient = 8] = "Ambient", VarFlags[VarFlags.Static = 16] = "Static", VarFlags[VarFlags.LocalStatic = 32] = "LocalStatic", VarFlags[VarFlags.GetAccessor = 64] = "GetAccessor", VarFlags[VarFlags.SetAccessor = 128] = "SetAccessor", VarFlags[VarFlags.AutoInit = 256] = "AutoInit", VarFlags[VarFlags.Property = 512] = "Property", VarFlags[VarFlags.Readonly = 1024] = "Readonly", VarFlags[VarFlags.Class = 2048] = "Class", VarFlags[VarFlags.ClassProperty = 4096] = "ClassProperty", VarFlags[VarFlags.ClassBodyProperty = 8192] = "ClassBodyProperty", VarFlags[VarFlags.ClassConstructorProperty = 16384] = "ClassConstructorProperty", VarFlags[VarFlags.ClassSuperMustBeFirstCallInConstructor = 32768] = "ClassSuperMustBeFirstCallInConstructor", VarFlags[VarFlags.Constant = 65536] = "Constant", VarFlags[VarFlags.MustCaptureThis = 131072] = "MustCaptureThis"; + let FncFlags; + (FncFlags = FncFlags || (FncFlags = { + }))[FncFlags.None = 0] = "None", FncFlags[FncFlags.Exported = 1] = "Exported", FncFlags[FncFlags.Private = 2] = "Private", FncFlags[FncFlags.Public = 4] = "Public", FncFlags[FncFlags.Ambient = 8] = "Ambient", FncFlags[FncFlags.Static = 16] = "Static", FncFlags[FncFlags.LocalStatic = 32] = "LocalStatic", FncFlags[FncFlags.GetAccessor = 64] = "GetAccessor", FncFlags[FncFlags.SetAccessor = 128] = "SetAccessor", FncFlags[FncFlags.Definition = 256] = "Definition", FncFlags[FncFlags.Signature = 512] = "Signature", FncFlags[FncFlags.Method = 1024] = "Method", FncFlags[FncFlags.HasReturnExpression = 2048] = "HasReturnExpression", FncFlags[FncFlags.CallMember = 4096] = "CallMember", FncFlags[FncFlags.ConstructMember = 8192] = "ConstructMember", FncFlags[FncFlags.HasSelfReference = 16384] = "HasSelfReference", FncFlags[FncFlags.IsFatArrowFunction = 32768] = "IsFatArrowFunction", FncFlags[FncFlags.IndexerMember = 65536] = "IndexerMember", FncFlags[FncFlags.IsFunctionExpression = 131072] = "IsFunctionExpression", FncFlags[FncFlags.ClassMethod = 262144] = "ClassMethod", FncFlags[FncFlags.ClassPropertyMethodExported = 524288] = "ClassPropertyMethodExported"; + let SignatureFlags; + (SignatureFlags = SignatureFlags || (SignatureFlags = { + }))[SignatureFlags.None = 0] = "None", SignatureFlags[SignatureFlags.IsIndexer = 1] = "IsIndexer", SignatureFlags[SignatureFlags.IsStringIndexer = 2] = "IsStringIndexer", SignatureFlags[SignatureFlags.IsNumberIndexer = 4] = "IsNumberIndexer", TypeScript1.ToDeclFlags = function(fncOrVarOrSymbolOrModuleFlags) { return fncOrVarOrSymbolOrModuleFlags; - }, (TypeFlags1 = TypeFlags || (TypeFlags = { - }))[TypeFlags1.None = 0] = "None", TypeFlags1[TypeFlags1.HasImplementation = 1] = "HasImplementation", TypeFlags1[TypeFlags1.HasSelfReference = 2] = "HasSelfReference", TypeFlags1[TypeFlags1.MergeResult = 4] = "MergeResult", TypeFlags1[TypeFlags1.IsEnum = 8] = "IsEnum", TypeFlags1[TypeFlags1.BuildingName = 16] = "BuildingName", TypeFlags1[TypeFlags1.HasBaseType = 32] = "HasBaseType", TypeFlags1[TypeFlags1.HasBaseTypeOfObject = 64] = "HasBaseTypeOfObject", TypeFlags1[TypeFlags1.IsClass = 128] = "IsClass", (TypeRelationshipFlags1 = TypeRelationshipFlags || (TypeRelationshipFlags = { - }))[TypeRelationshipFlags1.SuccessfulComparison = 0] = "SuccessfulComparison", TypeRelationshipFlags1[TypeRelationshipFlags1.SourceIsNullTargetIsVoidOrUndefined = 1] = "SourceIsNullTargetIsVoidOrUndefined", TypeRelationshipFlags1[TypeRelationshipFlags1.RequiredPropertyIsMissing = 2] = "RequiredPropertyIsMissing", TypeRelationshipFlags1[TypeRelationshipFlags1.IncompatibleSignatures = 4] = "IncompatibleSignatures", TypeRelationshipFlags1[TypeRelationshipFlags1.SourceSignatureHasTooManyParameters = 3] = "SourceSignatureHasTooManyParameters", TypeRelationshipFlags1[TypeRelationshipFlags1.IncompatibleReturnTypes = 16] = "IncompatibleReturnTypes", TypeRelationshipFlags1[TypeRelationshipFlags1.IncompatiblePropertyTypes = 32] = "IncompatiblePropertyTypes", TypeRelationshipFlags1[TypeRelationshipFlags1.IncompatibleParameterTypes = 64] = "IncompatibleParameterTypes", (CodeGenTarget1 = CodeGenTarget || (CodeGenTarget = { - }))[CodeGenTarget1.ES3 = 0] = "ES3", CodeGenTarget1[CodeGenTarget1.ES5 = 1] = "ES5", (ModuleGenTarget1 = ModuleGenTarget || (ModuleGenTarget = { - }))[ModuleGenTarget1.Synchronous = 0] = "Synchronous", ModuleGenTarget1[ModuleGenTarget1.Asynchronous = 1] = "Asynchronous", ModuleGenTarget1[ModuleGenTarget1.Local = 2] = "Local", TypeScript1.codeGenTarget = CodeGenTarget.ES3, TypeScript1.moduleGenTarget = ModuleGenTarget.Synchronous, TypeScript1.optimizeModuleCodeGen = !0, TypeScript1.flagsToString = function(e, flags) { + }; + let TypeFlags; + (TypeFlags = TypeFlags || (TypeFlags = { + }))[TypeFlags.None = 0] = "None", TypeFlags[TypeFlags.HasImplementation = 1] = "HasImplementation", TypeFlags[TypeFlags.HasSelfReference = 2] = "HasSelfReference", TypeFlags[TypeFlags.MergeResult = 4] = "MergeResult", TypeFlags[TypeFlags.IsEnum = 8] = "IsEnum", TypeFlags[TypeFlags.BuildingName = 16] = "BuildingName", TypeFlags[TypeFlags.HasBaseType = 32] = "HasBaseType", TypeFlags[TypeFlags.HasBaseTypeOfObject = 64] = "HasBaseTypeOfObject", TypeFlags[TypeFlags.IsClass = 128] = "IsClass"; + let TypeRelationshipFlags; + (TypeRelationshipFlags = TypeRelationshipFlags || (TypeRelationshipFlags = { + }))[TypeRelationshipFlags.SuccessfulComparison = 0] = "SuccessfulComparison", TypeRelationshipFlags[TypeRelationshipFlags.SourceIsNullTargetIsVoidOrUndefined = 1] = "SourceIsNullTargetIsVoidOrUndefined", TypeRelationshipFlags[TypeRelationshipFlags.RequiredPropertyIsMissing = 2] = "RequiredPropertyIsMissing", TypeRelationshipFlags[TypeRelationshipFlags.IncompatibleSignatures = 4] = "IncompatibleSignatures", TypeRelationshipFlags[TypeRelationshipFlags.SourceSignatureHasTooManyParameters = 3] = "SourceSignatureHasTooManyParameters", TypeRelationshipFlags[TypeRelationshipFlags.IncompatibleReturnTypes = 16] = "IncompatibleReturnTypes", TypeRelationshipFlags[TypeRelationshipFlags.IncompatiblePropertyTypes = 32] = "IncompatiblePropertyTypes", TypeRelationshipFlags[TypeRelationshipFlags.IncompatibleParameterTypes = 64] = "IncompatibleParameterTypes"; + let CodeGenTarget; + (CodeGenTarget = CodeGenTarget || (CodeGenTarget = { + }))[CodeGenTarget.ES3 = 0] = "ES3", CodeGenTarget[CodeGenTarget.ES5 = 1] = "ES5"; + let ModuleGenTarget; + (ModuleGenTarget = ModuleGenTarget || (ModuleGenTarget = { + }))[ModuleGenTarget.Synchronous = 0] = "Synchronous", ModuleGenTarget[ModuleGenTarget.Asynchronous = 1] = "Asynchronous", ModuleGenTarget[ModuleGenTarget.Local = 2] = "Local", TypeScript1.codeGenTarget = CodeGenTarget.ES3, TypeScript1.moduleGenTarget = ModuleGenTarget.Synchronous, TypeScript1.optimizeModuleCodeGen = !0, TypeScript1.flagsToString = function(e, flags) { for(var builder = "", i = 1; i < -2147483648; i <<= 1)if ((flags & i) != 0) { for(var k in e)if (e[k] == i) { builder.length > 0 && (builder += "|"), builder += k; diff --git a/crates/swc/tests/tsc-references/parser/ecmascript5/parserRealSource2/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/parser/ecmascript5/parserRealSource2/input.ts/es5.1.normal/output.js index ee4aeffe400..5d0e640889e 100644 --- a/crates/swc/tests/tsc-references/parser/ecmascript5/parserRealSource2/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/parser/ecmascript5/parserRealSource2/input.ts/es5.1.normal/output.js @@ -27,7 +27,7 @@ var TypeScript; return builder; }; TypeScript1.hasFlag = hasFlag; - var ErrorRecoverySet1; + var ErrorRecoverySet; (function(ErrorRecoverySet) { ErrorRecoverySet[ErrorRecoverySet["None"] = 0] = "None"; ErrorRecoverySet[ErrorRecoverySet["Comma"] = 1] = "Comma"; @@ -67,9 +67,9 @@ var TypeScript; ErrorRecoverySet[ErrorRecoverySet["ExprStart"] = 520158210] = "ExprStart"; ErrorRecoverySet[ErrorRecoverySet["StmtStart"] = 1608580098] = "StmtStart"; ErrorRecoverySet[ErrorRecoverySet["Postfix"] = 49280] = "Postfix"; - })(ErrorRecoverySet1 || (ErrorRecoverySet1 = { + })(ErrorRecoverySet || (ErrorRecoverySet = { })); - var AllowedElements1; + var AllowedElements; (function(AllowedElements) { AllowedElements[AllowedElements["None"] = 0] = "None"; AllowedElements[AllowedElements["ModuleDeclarations"] = 4] = "ModuleDeclarations"; @@ -79,9 +79,9 @@ var TypeScript; AllowedElements[AllowedElements["Properties"] = 2048] = "Properties"; AllowedElements[AllowedElements["Global"] = 1052] = "Global"; AllowedElements[AllowedElements["QuickParse"] = 3100] = "QuickParse"; - })(AllowedElements1 || (AllowedElements1 = { + })(AllowedElements || (AllowedElements = { })); - var Modifiers1; + var Modifiers; (function(Modifiers) { Modifiers[Modifiers["None"] = 0] = "None"; Modifiers[Modifiers["Private"] = 1] = "Private"; @@ -92,9 +92,9 @@ var TypeScript; Modifiers[Modifiers["Getter"] = 32] = "Getter"; Modifiers[Modifiers["Setter"] = 64] = "Setter"; Modifiers[Modifiers["Static"] = 128] = "Static"; - })(Modifiers1 || (Modifiers1 = { + })(Modifiers || (Modifiers = { })); - var ASTFlags1; + var ASTFlags; (function(ASTFlags) { ASTFlags[ASTFlags["None"] = 0] = "None"; ASTFlags[ASTFlags["ExplicitSemicolon"] = 1] = "ExplicitSemicolon"; @@ -112,9 +112,9 @@ var TypeScript; // The flag is used to communicate this piece of information to the calling parseTerm, which intern will remove it. // Once we have a better way to associate information with nodes, this flag should not be used. "SkipNextRParen"] = 2048] = "SkipNextRParen"; - })(ASTFlags1 || (ASTFlags1 = { + })(ASTFlags || (ASTFlags = { })); - var DeclFlags1; + var DeclFlags; (function(DeclFlags) { DeclFlags[DeclFlags["None"] = 0] = "None"; DeclFlags[DeclFlags["Exported"] = 1] = "Exported"; @@ -125,9 +125,9 @@ var TypeScript; DeclFlags[DeclFlags["LocalStatic"] = 32] = "LocalStatic"; DeclFlags[DeclFlags["GetAccessor"] = 64] = "GetAccessor"; DeclFlags[DeclFlags["SetAccessor"] = 128] = "SetAccessor"; - })(DeclFlags1 || (DeclFlags1 = { + })(DeclFlags || (DeclFlags = { })); - var ModuleFlags1; + var ModuleFlags; (function(ModuleFlags) { ModuleFlags[ModuleFlags["None"] = 0] = "None"; ModuleFlags[ModuleFlags["Exported"] = 1] = "Exported"; @@ -143,9 +143,9 @@ var TypeScript; ModuleFlags[ModuleFlags["IsWholeFile"] = 1024] = "IsWholeFile"; ModuleFlags[ModuleFlags["IsDynamic"] = 2048] = "IsDynamic"; ModuleFlags[ModuleFlags["MustCaptureThis"] = 4096] = "MustCaptureThis"; - })(ModuleFlags1 || (ModuleFlags1 = { + })(ModuleFlags || (ModuleFlags = { })); - var SymbolFlags1; + var SymbolFlags; (function(SymbolFlags) { SymbolFlags[SymbolFlags["None"] = 0] = "None"; SymbolFlags[SymbolFlags["Exported"] = 1] = "Exported"; @@ -168,9 +168,9 @@ var TypeScript; SymbolFlags[SymbolFlags["RecursivelyReferenced"] = 131072] = "RecursivelyReferenced"; SymbolFlags[SymbolFlags["Bound"] = 262144] = "Bound"; SymbolFlags[SymbolFlags["CompilerGenerated"] = 524288] = "CompilerGenerated"; - })(SymbolFlags1 || (SymbolFlags1 = { + })(SymbolFlags || (SymbolFlags = { })); - var VarFlags1; + var VarFlags; (function(VarFlags) { VarFlags[VarFlags["None"] = 0] = "None"; VarFlags[VarFlags["Exported"] = 1] = "Exported"; @@ -191,9 +191,9 @@ var TypeScript; VarFlags[VarFlags["ClassSuperMustBeFirstCallInConstructor"] = 32768] = "ClassSuperMustBeFirstCallInConstructor"; VarFlags[VarFlags["Constant"] = 65536] = "Constant"; VarFlags[VarFlags["MustCaptureThis"] = 131072] = "MustCaptureThis"; - })(VarFlags1 || (VarFlags1 = { + })(VarFlags || (VarFlags = { })); - var FncFlags1; + var FncFlags; (function(FncFlags) { FncFlags[FncFlags["None"] = 0] = "None"; FncFlags[FncFlags["Exported"] = 1] = "Exported"; @@ -216,18 +216,18 @@ var TypeScript; FncFlags[FncFlags["IsFunctionExpression"] = 131072] = "IsFunctionExpression"; FncFlags[FncFlags["ClassMethod"] = 262144] = "ClassMethod"; FncFlags[FncFlags["ClassPropertyMethodExported"] = 524288] = "ClassPropertyMethodExported"; - })(FncFlags1 || (FncFlags1 = { + })(FncFlags || (FncFlags = { })); - var SignatureFlags1; + var SignatureFlags; (function(SignatureFlags) { SignatureFlags[SignatureFlags["None"] = 0] = "None"; SignatureFlags[SignatureFlags["IsIndexer"] = 1] = "IsIndexer"; SignatureFlags[SignatureFlags["IsStringIndexer"] = 2] = "IsStringIndexer"; SignatureFlags[SignatureFlags["IsNumberIndexer"] = 4] = "IsNumberIndexer"; - })(SignatureFlags1 || (SignatureFlags1 = { + })(SignatureFlags || (SignatureFlags = { })); TypeScript1.ToDeclFlags = ToDeclFlags; - var TypeFlags1; + var TypeFlags; (function(TypeFlags) { TypeFlags[TypeFlags["None"] = 0] = "None"; TypeFlags[TypeFlags["HasImplementation"] = 1] = "HasImplementation"; @@ -238,9 +238,9 @@ var TypeScript; TypeFlags[TypeFlags["HasBaseType"] = 32] = "HasBaseType"; TypeFlags[TypeFlags["HasBaseTypeOfObject"] = 64] = "HasBaseTypeOfObject"; TypeFlags[TypeFlags["IsClass"] = 128] = "IsClass"; - })(TypeFlags1 || (TypeFlags1 = { + })(TypeFlags || (TypeFlags = { })); - var TypeRelationshipFlags1; + var TypeRelationshipFlags; (function(TypeRelationshipFlags) { TypeRelationshipFlags[TypeRelationshipFlags["SuccessfulComparison"] = 0] = "SuccessfulComparison"; TypeRelationshipFlags[TypeRelationshipFlags["SourceIsNullTargetIsVoidOrUndefined"] = 1] = "SourceIsNullTargetIsVoidOrUndefined"; @@ -250,25 +250,25 @@ var TypeScript; TypeRelationshipFlags[TypeRelationshipFlags["IncompatibleReturnTypes"] = 16] = "IncompatibleReturnTypes"; TypeRelationshipFlags[TypeRelationshipFlags["IncompatiblePropertyTypes"] = 32] = "IncompatiblePropertyTypes"; TypeRelationshipFlags[TypeRelationshipFlags["IncompatibleParameterTypes"] = 64] = "IncompatibleParameterTypes"; - })(TypeRelationshipFlags1 || (TypeRelationshipFlags1 = { + })(TypeRelationshipFlags || (TypeRelationshipFlags = { })); - var CodeGenTarget1; + var CodeGenTarget; (function(CodeGenTarget) { CodeGenTarget[CodeGenTarget["ES3"] = 0] = "ES3"; CodeGenTarget[CodeGenTarget["ES5"] = 1] = "ES5"; - })(CodeGenTarget1 || (CodeGenTarget1 = { + })(CodeGenTarget || (CodeGenTarget = { })); - var ModuleGenTarget1; + var ModuleGenTarget; (function(ModuleGenTarget) { ModuleGenTarget[ModuleGenTarget["Synchronous"] = 0] = "Synchronous"; ModuleGenTarget[ModuleGenTarget["Asynchronous"] = 1] = "Asynchronous"; ModuleGenTarget[ModuleGenTarget["Local"] = 2] = "Local"; - })(ModuleGenTarget1 || (ModuleGenTarget1 = { + })(ModuleGenTarget || (ModuleGenTarget = { })); - TypeScript1.codeGenTarget = CodeGenTarget1.ES3; - TypeScript1.moduleGenTarget = ModuleGenTarget1.Synchronous; + TypeScript1.codeGenTarget = CodeGenTarget.ES3; + TypeScript1.moduleGenTarget = ModuleGenTarget.Synchronous; TypeScript1.optimizeModuleCodeGen = true; TypeScript1.flagsToString = flagsToString; - TypeScript1.ErrorRecoverySet = ErrorRecoverySet1, TypeScript1.AllowedElements = AllowedElements1, TypeScript1.Modifiers = Modifiers1, TypeScript1.ASTFlags = ASTFlags1, TypeScript1.DeclFlags = DeclFlags1, TypeScript1.ModuleFlags = ModuleFlags1, TypeScript1.SymbolFlags = SymbolFlags1, TypeScript1.VarFlags = VarFlags1, TypeScript1.FncFlags = FncFlags1, TypeScript1.SignatureFlags = SignatureFlags1, TypeScript1.TypeFlags = TypeFlags1, TypeScript1.TypeRelationshipFlags = TypeRelationshipFlags1, TypeScript1.CodeGenTarget = CodeGenTarget1, TypeScript1.ModuleGenTarget = ModuleGenTarget1; + TypeScript1.ErrorRecoverySet = ErrorRecoverySet, TypeScript1.AllowedElements = AllowedElements, TypeScript1.Modifiers = Modifiers, TypeScript1.ASTFlags = ASTFlags, TypeScript1.DeclFlags = DeclFlags, TypeScript1.ModuleFlags = ModuleFlags, TypeScript1.SymbolFlags = SymbolFlags, TypeScript1.VarFlags = VarFlags, TypeScript1.FncFlags = FncFlags, TypeScript1.SignatureFlags = SignatureFlags, TypeScript1.TypeFlags = TypeFlags, TypeScript1.TypeRelationshipFlags = TypeRelationshipFlags, TypeScript1.CodeGenTarget = CodeGenTarget, TypeScript1.ModuleGenTarget = ModuleGenTarget; })(TypeScript || (TypeScript = { })); diff --git a/crates/swc/tests/tsc-references/parser/ecmascript5/parserRealSource2/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/parser/ecmascript5/parserRealSource2/input.ts/es5.2.minified/output.js index 1414caa3f4d..a4da480ee46 100644 --- a/crates/swc/tests/tsc-references/parser/ecmascript5/parserRealSource2/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/parser/ecmascript5/parserRealSource2/input.ts/es5.2.minified/output.js @@ -1,25 +1,25 @@ var TypeScript; !function(TypeScript1) { - var ErrorRecoverySet, AllowedElements, Modifiers, ASTFlags, DeclFlags, ModuleFlags, SymbolFlags, VarFlags, FncFlags, SignatureFlags, TypeFlags, TypeRelationshipFlags, CodeGenTarget, ModuleGenTarget, ErrorRecoverySet1, AllowedElements1, Modifiers1, ASTFlags1, DeclFlags1, ModuleFlags1, SymbolFlags1, VarFlags1, FncFlags1, SignatureFlags1, TypeFlags1, TypeRelationshipFlags1, CodeGenTarget1, ModuleGenTarget1; + var ErrorRecoverySet, AllowedElements, Modifiers, ASTFlags, DeclFlags, ModuleFlags, SymbolFlags, VarFlags, FncFlags, SignatureFlags, TypeFlags, TypeRelationshipFlags, CodeGenTarget, ModuleGenTarget, ErrorRecoverySet, AllowedElements, Modifiers, ASTFlags, DeclFlags, ModuleFlags, SymbolFlags, VarFlags, FncFlags, SignatureFlags, TypeFlags, TypeRelationshipFlags, CodeGenTarget, ModuleGenTarget; TypeScript1.hasFlag = function(val, flag) { return (val & flag) != 0; - }, (ErrorRecoverySet1 = ErrorRecoverySet || (ErrorRecoverySet = { - }))[ErrorRecoverySet1.None = 0] = "None", ErrorRecoverySet1[ErrorRecoverySet1.Comma = 1] = "Comma", ErrorRecoverySet1[ErrorRecoverySet1.SColon = 2] = "SColon", ErrorRecoverySet1[ErrorRecoverySet1.Asg = 4] = "Asg", ErrorRecoverySet1[ErrorRecoverySet1.BinOp = 8] = "BinOp", ErrorRecoverySet1[ErrorRecoverySet1.RBrack = 16] = "RBrack", ErrorRecoverySet1[ErrorRecoverySet1.RCurly = 32] = "RCurly", ErrorRecoverySet1[ErrorRecoverySet1.RParen = 64] = "RParen", ErrorRecoverySet1[ErrorRecoverySet1.Dot = 128] = "Dot", ErrorRecoverySet1[ErrorRecoverySet1.Colon = 256] = "Colon", ErrorRecoverySet1[ErrorRecoverySet1.PrimType = 512] = "PrimType", ErrorRecoverySet1[ErrorRecoverySet1.AddOp = 1024] = "AddOp", ErrorRecoverySet1[ErrorRecoverySet1.LCurly = 2048] = "LCurly", ErrorRecoverySet1[ErrorRecoverySet1.PreOp = 4096] = "PreOp", ErrorRecoverySet1[ErrorRecoverySet1.RegExp = 8192] = "RegExp", ErrorRecoverySet1[ErrorRecoverySet1.LParen = 16384] = "LParen", ErrorRecoverySet1[ErrorRecoverySet1.LBrack = 32768] = "LBrack", ErrorRecoverySet1[ErrorRecoverySet1.Scope = 65536] = "Scope", ErrorRecoverySet1[ErrorRecoverySet1.In = 131072] = "In", ErrorRecoverySet1[ErrorRecoverySet1.SCase = 262144] = "SCase", ErrorRecoverySet1[ErrorRecoverySet1.Else = 524288] = "Else", ErrorRecoverySet1[ErrorRecoverySet1.Catch = 1048576] = "Catch", ErrorRecoverySet1[ErrorRecoverySet1.Var = 2097152] = "Var", ErrorRecoverySet1[ErrorRecoverySet1.Stmt = 4194304] = "Stmt", ErrorRecoverySet1[ErrorRecoverySet1.While = 8388608] = "While", ErrorRecoverySet1[ErrorRecoverySet1.ID = 16777216] = "ID", ErrorRecoverySet1[ErrorRecoverySet1.Prefix = 33554432] = "Prefix", ErrorRecoverySet1[ErrorRecoverySet1.Literal = 67108864] = "Literal", ErrorRecoverySet1[ErrorRecoverySet1.RLit = 134217728] = "RLit", ErrorRecoverySet1[ErrorRecoverySet1.Func = 268435456] = "Func", ErrorRecoverySet1[ErrorRecoverySet1.EOF = 536870912] = "EOF", ErrorRecoverySet1[ErrorRecoverySet1.TypeScriptS = 1073741824] = "TypeScriptS", ErrorRecoverySet1[ErrorRecoverySet1.ExprStart = 520158210] = "ExprStart", ErrorRecoverySet1[ErrorRecoverySet1.StmtStart = 1608580098] = "StmtStart", ErrorRecoverySet1[ErrorRecoverySet1.Postfix = 49280] = "Postfix", (AllowedElements1 = AllowedElements || (AllowedElements = { - }))[AllowedElements1.None = 0] = "None", AllowedElements1[AllowedElements1.ModuleDeclarations = 4] = "ModuleDeclarations", AllowedElements1[AllowedElements1.ClassDeclarations = 8] = "ClassDeclarations", AllowedElements1[AllowedElements1.InterfaceDeclarations = 16] = "InterfaceDeclarations", AllowedElements1[AllowedElements1.AmbientDeclarations = 1024] = "AmbientDeclarations", AllowedElements1[AllowedElements1.Properties = 2048] = "Properties", AllowedElements1[AllowedElements1.Global = 1052] = "Global", AllowedElements1[AllowedElements1.QuickParse = 3100] = "QuickParse", (Modifiers1 = Modifiers || (Modifiers = { - }))[Modifiers1.None = 0] = "None", Modifiers1[Modifiers1.Private = 1] = "Private", Modifiers1[Modifiers1.Public = 2] = "Public", Modifiers1[Modifiers1.Readonly = 4] = "Readonly", Modifiers1[Modifiers1.Ambient = 8] = "Ambient", Modifiers1[Modifiers1.Exported = 16] = "Exported", Modifiers1[Modifiers1.Getter = 32] = "Getter", Modifiers1[Modifiers1.Setter = 64] = "Setter", Modifiers1[Modifiers1.Static = 128] = "Static", (ASTFlags1 = ASTFlags || (ASTFlags = { - }))[ASTFlags1.None = 0] = "None", ASTFlags1[ASTFlags1.ExplicitSemicolon = 1] = "ExplicitSemicolon", ASTFlags1[ASTFlags1.AutomaticSemicolon = 2] = "AutomaticSemicolon", ASTFlags1[ASTFlags1.Writeable = 4] = "Writeable", ASTFlags1[ASTFlags1.Error = 8] = "Error", ASTFlags1[ASTFlags1.DotLHSPartial = 16] = "DotLHSPartial", ASTFlags1[ASTFlags1.DotLHS = 32] = "DotLHS", ASTFlags1[ASTFlags1.IsStatement = 64] = "IsStatement", ASTFlags1[ASTFlags1.StrictMode = 128] = "StrictMode", ASTFlags1[ASTFlags1.PossibleOptionalParameter = 256] = "PossibleOptionalParameter", ASTFlags1[ASTFlags1.ClassBaseConstructorCall = 512] = "ClassBaseConstructorCall", ASTFlags1[ASTFlags1.OptionalName = 1024] = "OptionalName", ASTFlags1[ASTFlags1.SkipNextRParen = 2048] = "SkipNextRParen", (DeclFlags1 = DeclFlags || (DeclFlags = { - }))[DeclFlags1.None = 0] = "None", DeclFlags1[DeclFlags1.Exported = 1] = "Exported", DeclFlags1[DeclFlags1.Private = 2] = "Private", DeclFlags1[DeclFlags1.Public = 4] = "Public", DeclFlags1[DeclFlags1.Ambient = 8] = "Ambient", DeclFlags1[DeclFlags1.Static = 16] = "Static", DeclFlags1[DeclFlags1.LocalStatic = 32] = "LocalStatic", DeclFlags1[DeclFlags1.GetAccessor = 64] = "GetAccessor", DeclFlags1[DeclFlags1.SetAccessor = 128] = "SetAccessor", (ModuleFlags1 = ModuleFlags || (ModuleFlags = { - }))[ModuleFlags1.None = 0] = "None", ModuleFlags1[ModuleFlags1.Exported = 1] = "Exported", ModuleFlags1[ModuleFlags1.Private = 2] = "Private", ModuleFlags1[ModuleFlags1.Public = 4] = "Public", ModuleFlags1[ModuleFlags1.Ambient = 8] = "Ambient", ModuleFlags1[ModuleFlags1.Static = 16] = "Static", ModuleFlags1[ModuleFlags1.LocalStatic = 32] = "LocalStatic", ModuleFlags1[ModuleFlags1.GetAccessor = 64] = "GetAccessor", ModuleFlags1[ModuleFlags1.SetAccessor = 128] = "SetAccessor", ModuleFlags1[ModuleFlags1.IsEnum = 256] = "IsEnum", ModuleFlags1[ModuleFlags1.ShouldEmitModuleDecl = 512] = "ShouldEmitModuleDecl", ModuleFlags1[ModuleFlags1.IsWholeFile = 1024] = "IsWholeFile", ModuleFlags1[ModuleFlags1.IsDynamic = 2048] = "IsDynamic", ModuleFlags1[ModuleFlags1.MustCaptureThis = 4096] = "MustCaptureThis", (SymbolFlags1 = SymbolFlags || (SymbolFlags = { - }))[SymbolFlags1.None = 0] = "None", SymbolFlags1[SymbolFlags1.Exported = 1] = "Exported", SymbolFlags1[SymbolFlags1.Private = 2] = "Private", SymbolFlags1[SymbolFlags1.Public = 4] = "Public", SymbolFlags1[SymbolFlags1.Ambient = 8] = "Ambient", SymbolFlags1[SymbolFlags1.Static = 16] = "Static", SymbolFlags1[SymbolFlags1.LocalStatic = 32] = "LocalStatic", SymbolFlags1[SymbolFlags1.GetAccessor = 64] = "GetAccessor", SymbolFlags1[SymbolFlags1.SetAccessor = 128] = "SetAccessor", SymbolFlags1[SymbolFlags1.Property = 256] = "Property", SymbolFlags1[SymbolFlags1.Readonly = 512] = "Readonly", SymbolFlags1[SymbolFlags1.ModuleMember = 1024] = "ModuleMember", SymbolFlags1[SymbolFlags1.InterfaceMember = 2048] = "InterfaceMember", SymbolFlags1[SymbolFlags1.ClassMember = 4096] = "ClassMember", SymbolFlags1[SymbolFlags1.BuiltIn = 8192] = "BuiltIn", SymbolFlags1[SymbolFlags1.TypeSetDuringScopeAssignment = 16384] = "TypeSetDuringScopeAssignment", SymbolFlags1[SymbolFlags1.Constant = 32768] = "Constant", SymbolFlags1[SymbolFlags1.Optional = 65536] = "Optional", SymbolFlags1[SymbolFlags1.RecursivelyReferenced = 131072] = "RecursivelyReferenced", SymbolFlags1[SymbolFlags1.Bound = 262144] = "Bound", SymbolFlags1[SymbolFlags1.CompilerGenerated = 524288] = "CompilerGenerated", (VarFlags1 = VarFlags || (VarFlags = { - }))[VarFlags1.None = 0] = "None", VarFlags1[VarFlags1.Exported = 1] = "Exported", VarFlags1[VarFlags1.Private = 2] = "Private", VarFlags1[VarFlags1.Public = 4] = "Public", VarFlags1[VarFlags1.Ambient = 8] = "Ambient", VarFlags1[VarFlags1.Static = 16] = "Static", VarFlags1[VarFlags1.LocalStatic = 32] = "LocalStatic", VarFlags1[VarFlags1.GetAccessor = 64] = "GetAccessor", VarFlags1[VarFlags1.SetAccessor = 128] = "SetAccessor", VarFlags1[VarFlags1.AutoInit = 256] = "AutoInit", VarFlags1[VarFlags1.Property = 512] = "Property", VarFlags1[VarFlags1.Readonly = 1024] = "Readonly", VarFlags1[VarFlags1.Class = 2048] = "Class", VarFlags1[VarFlags1.ClassProperty = 4096] = "ClassProperty", VarFlags1[VarFlags1.ClassBodyProperty = 8192] = "ClassBodyProperty", VarFlags1[VarFlags1.ClassConstructorProperty = 16384] = "ClassConstructorProperty", VarFlags1[VarFlags1.ClassSuperMustBeFirstCallInConstructor = 32768] = "ClassSuperMustBeFirstCallInConstructor", VarFlags1[VarFlags1.Constant = 65536] = "Constant", VarFlags1[VarFlags1.MustCaptureThis = 131072] = "MustCaptureThis", (FncFlags1 = FncFlags || (FncFlags = { - }))[FncFlags1.None = 0] = "None", FncFlags1[FncFlags1.Exported = 1] = "Exported", FncFlags1[FncFlags1.Private = 2] = "Private", FncFlags1[FncFlags1.Public = 4] = "Public", FncFlags1[FncFlags1.Ambient = 8] = "Ambient", FncFlags1[FncFlags1.Static = 16] = "Static", FncFlags1[FncFlags1.LocalStatic = 32] = "LocalStatic", FncFlags1[FncFlags1.GetAccessor = 64] = "GetAccessor", FncFlags1[FncFlags1.SetAccessor = 128] = "SetAccessor", FncFlags1[FncFlags1.Definition = 256] = "Definition", FncFlags1[FncFlags1.Signature = 512] = "Signature", FncFlags1[FncFlags1.Method = 1024] = "Method", FncFlags1[FncFlags1.HasReturnExpression = 2048] = "HasReturnExpression", FncFlags1[FncFlags1.CallMember = 4096] = "CallMember", FncFlags1[FncFlags1.ConstructMember = 8192] = "ConstructMember", FncFlags1[FncFlags1.HasSelfReference = 16384] = "HasSelfReference", FncFlags1[FncFlags1.IsFatArrowFunction = 32768] = "IsFatArrowFunction", FncFlags1[FncFlags1.IndexerMember = 65536] = "IndexerMember", FncFlags1[FncFlags1.IsFunctionExpression = 131072] = "IsFunctionExpression", FncFlags1[FncFlags1.ClassMethod = 262144] = "ClassMethod", FncFlags1[FncFlags1.ClassPropertyMethodExported = 524288] = "ClassPropertyMethodExported", (SignatureFlags1 = SignatureFlags || (SignatureFlags = { - }))[SignatureFlags1.None = 0] = "None", SignatureFlags1[SignatureFlags1.IsIndexer = 1] = "IsIndexer", SignatureFlags1[SignatureFlags1.IsStringIndexer = 2] = "IsStringIndexer", SignatureFlags1[SignatureFlags1.IsNumberIndexer = 4] = "IsNumberIndexer", TypeScript1.ToDeclFlags = function(fncOrVarOrSymbolOrModuleFlags) { + }, (ErrorRecoverySet = ErrorRecoverySet || (ErrorRecoverySet = { + }))[ErrorRecoverySet.None = 0] = "None", ErrorRecoverySet[ErrorRecoverySet.Comma = 1] = "Comma", ErrorRecoverySet[ErrorRecoverySet.SColon = 2] = "SColon", ErrorRecoverySet[ErrorRecoverySet.Asg = 4] = "Asg", ErrorRecoverySet[ErrorRecoverySet.BinOp = 8] = "BinOp", ErrorRecoverySet[ErrorRecoverySet.RBrack = 16] = "RBrack", ErrorRecoverySet[ErrorRecoverySet.RCurly = 32] = "RCurly", ErrorRecoverySet[ErrorRecoverySet.RParen = 64] = "RParen", ErrorRecoverySet[ErrorRecoverySet.Dot = 128] = "Dot", ErrorRecoverySet[ErrorRecoverySet.Colon = 256] = "Colon", ErrorRecoverySet[ErrorRecoverySet.PrimType = 512] = "PrimType", ErrorRecoverySet[ErrorRecoverySet.AddOp = 1024] = "AddOp", ErrorRecoverySet[ErrorRecoverySet.LCurly = 2048] = "LCurly", ErrorRecoverySet[ErrorRecoverySet.PreOp = 4096] = "PreOp", ErrorRecoverySet[ErrorRecoverySet.RegExp = 8192] = "RegExp", ErrorRecoverySet[ErrorRecoverySet.LParen = 16384] = "LParen", ErrorRecoverySet[ErrorRecoverySet.LBrack = 32768] = "LBrack", ErrorRecoverySet[ErrorRecoverySet.Scope = 65536] = "Scope", ErrorRecoverySet[ErrorRecoverySet.In = 131072] = "In", ErrorRecoverySet[ErrorRecoverySet.SCase = 262144] = "SCase", ErrorRecoverySet[ErrorRecoverySet.Else = 524288] = "Else", ErrorRecoverySet[ErrorRecoverySet.Catch = 1048576] = "Catch", ErrorRecoverySet[ErrorRecoverySet.Var = 2097152] = "Var", ErrorRecoverySet[ErrorRecoverySet.Stmt = 4194304] = "Stmt", ErrorRecoverySet[ErrorRecoverySet.While = 8388608] = "While", ErrorRecoverySet[ErrorRecoverySet.ID = 16777216] = "ID", ErrorRecoverySet[ErrorRecoverySet.Prefix = 33554432] = "Prefix", ErrorRecoverySet[ErrorRecoverySet.Literal = 67108864] = "Literal", ErrorRecoverySet[ErrorRecoverySet.RLit = 134217728] = "RLit", ErrorRecoverySet[ErrorRecoverySet.Func = 268435456] = "Func", ErrorRecoverySet[ErrorRecoverySet.EOF = 536870912] = "EOF", ErrorRecoverySet[ErrorRecoverySet.TypeScriptS = 1073741824] = "TypeScriptS", ErrorRecoverySet[ErrorRecoverySet.ExprStart = 520158210] = "ExprStart", ErrorRecoverySet[ErrorRecoverySet.StmtStart = 1608580098] = "StmtStart", ErrorRecoverySet[ErrorRecoverySet.Postfix = 49280] = "Postfix", (AllowedElements = AllowedElements || (AllowedElements = { + }))[AllowedElements.None = 0] = "None", AllowedElements[AllowedElements.ModuleDeclarations = 4] = "ModuleDeclarations", AllowedElements[AllowedElements.ClassDeclarations = 8] = "ClassDeclarations", AllowedElements[AllowedElements.InterfaceDeclarations = 16] = "InterfaceDeclarations", AllowedElements[AllowedElements.AmbientDeclarations = 1024] = "AmbientDeclarations", AllowedElements[AllowedElements.Properties = 2048] = "Properties", AllowedElements[AllowedElements.Global = 1052] = "Global", AllowedElements[AllowedElements.QuickParse = 3100] = "QuickParse", (Modifiers = Modifiers || (Modifiers = { + }))[Modifiers.None = 0] = "None", Modifiers[Modifiers.Private = 1] = "Private", Modifiers[Modifiers.Public = 2] = "Public", Modifiers[Modifiers.Readonly = 4] = "Readonly", Modifiers[Modifiers.Ambient = 8] = "Ambient", Modifiers[Modifiers.Exported = 16] = "Exported", Modifiers[Modifiers.Getter = 32] = "Getter", Modifiers[Modifiers.Setter = 64] = "Setter", Modifiers[Modifiers.Static = 128] = "Static", (ASTFlags = ASTFlags || (ASTFlags = { + }))[ASTFlags.None = 0] = "None", ASTFlags[ASTFlags.ExplicitSemicolon = 1] = "ExplicitSemicolon", ASTFlags[ASTFlags.AutomaticSemicolon = 2] = "AutomaticSemicolon", ASTFlags[ASTFlags.Writeable = 4] = "Writeable", ASTFlags[ASTFlags.Error = 8] = "Error", ASTFlags[ASTFlags.DotLHSPartial = 16] = "DotLHSPartial", ASTFlags[ASTFlags.DotLHS = 32] = "DotLHS", ASTFlags[ASTFlags.IsStatement = 64] = "IsStatement", ASTFlags[ASTFlags.StrictMode = 128] = "StrictMode", ASTFlags[ASTFlags.PossibleOptionalParameter = 256] = "PossibleOptionalParameter", ASTFlags[ASTFlags.ClassBaseConstructorCall = 512] = "ClassBaseConstructorCall", ASTFlags[ASTFlags.OptionalName = 1024] = "OptionalName", ASTFlags[ASTFlags.SkipNextRParen = 2048] = "SkipNextRParen", (DeclFlags = DeclFlags || (DeclFlags = { + }))[DeclFlags.None = 0] = "None", DeclFlags[DeclFlags.Exported = 1] = "Exported", DeclFlags[DeclFlags.Private = 2] = "Private", DeclFlags[DeclFlags.Public = 4] = "Public", DeclFlags[DeclFlags.Ambient = 8] = "Ambient", DeclFlags[DeclFlags.Static = 16] = "Static", DeclFlags[DeclFlags.LocalStatic = 32] = "LocalStatic", DeclFlags[DeclFlags.GetAccessor = 64] = "GetAccessor", DeclFlags[DeclFlags.SetAccessor = 128] = "SetAccessor", (ModuleFlags = ModuleFlags || (ModuleFlags = { + }))[ModuleFlags.None = 0] = "None", ModuleFlags[ModuleFlags.Exported = 1] = "Exported", ModuleFlags[ModuleFlags.Private = 2] = "Private", ModuleFlags[ModuleFlags.Public = 4] = "Public", ModuleFlags[ModuleFlags.Ambient = 8] = "Ambient", ModuleFlags[ModuleFlags.Static = 16] = "Static", ModuleFlags[ModuleFlags.LocalStatic = 32] = "LocalStatic", ModuleFlags[ModuleFlags.GetAccessor = 64] = "GetAccessor", ModuleFlags[ModuleFlags.SetAccessor = 128] = "SetAccessor", ModuleFlags[ModuleFlags.IsEnum = 256] = "IsEnum", ModuleFlags[ModuleFlags.ShouldEmitModuleDecl = 512] = "ShouldEmitModuleDecl", ModuleFlags[ModuleFlags.IsWholeFile = 1024] = "IsWholeFile", ModuleFlags[ModuleFlags.IsDynamic = 2048] = "IsDynamic", ModuleFlags[ModuleFlags.MustCaptureThis = 4096] = "MustCaptureThis", (SymbolFlags = SymbolFlags || (SymbolFlags = { + }))[SymbolFlags.None = 0] = "None", SymbolFlags[SymbolFlags.Exported = 1] = "Exported", SymbolFlags[SymbolFlags.Private = 2] = "Private", SymbolFlags[SymbolFlags.Public = 4] = "Public", SymbolFlags[SymbolFlags.Ambient = 8] = "Ambient", SymbolFlags[SymbolFlags.Static = 16] = "Static", SymbolFlags[SymbolFlags.LocalStatic = 32] = "LocalStatic", SymbolFlags[SymbolFlags.GetAccessor = 64] = "GetAccessor", SymbolFlags[SymbolFlags.SetAccessor = 128] = "SetAccessor", SymbolFlags[SymbolFlags.Property = 256] = "Property", SymbolFlags[SymbolFlags.Readonly = 512] = "Readonly", SymbolFlags[SymbolFlags.ModuleMember = 1024] = "ModuleMember", SymbolFlags[SymbolFlags.InterfaceMember = 2048] = "InterfaceMember", SymbolFlags[SymbolFlags.ClassMember = 4096] = "ClassMember", SymbolFlags[SymbolFlags.BuiltIn = 8192] = "BuiltIn", SymbolFlags[SymbolFlags.TypeSetDuringScopeAssignment = 16384] = "TypeSetDuringScopeAssignment", SymbolFlags[SymbolFlags.Constant = 32768] = "Constant", SymbolFlags[SymbolFlags.Optional = 65536] = "Optional", SymbolFlags[SymbolFlags.RecursivelyReferenced = 131072] = "RecursivelyReferenced", SymbolFlags[SymbolFlags.Bound = 262144] = "Bound", SymbolFlags[SymbolFlags.CompilerGenerated = 524288] = "CompilerGenerated", (VarFlags = VarFlags || (VarFlags = { + }))[VarFlags.None = 0] = "None", VarFlags[VarFlags.Exported = 1] = "Exported", VarFlags[VarFlags.Private = 2] = "Private", VarFlags[VarFlags.Public = 4] = "Public", VarFlags[VarFlags.Ambient = 8] = "Ambient", VarFlags[VarFlags.Static = 16] = "Static", VarFlags[VarFlags.LocalStatic = 32] = "LocalStatic", VarFlags[VarFlags.GetAccessor = 64] = "GetAccessor", VarFlags[VarFlags.SetAccessor = 128] = "SetAccessor", VarFlags[VarFlags.AutoInit = 256] = "AutoInit", VarFlags[VarFlags.Property = 512] = "Property", VarFlags[VarFlags.Readonly = 1024] = "Readonly", VarFlags[VarFlags.Class = 2048] = "Class", VarFlags[VarFlags.ClassProperty = 4096] = "ClassProperty", VarFlags[VarFlags.ClassBodyProperty = 8192] = "ClassBodyProperty", VarFlags[VarFlags.ClassConstructorProperty = 16384] = "ClassConstructorProperty", VarFlags[VarFlags.ClassSuperMustBeFirstCallInConstructor = 32768] = "ClassSuperMustBeFirstCallInConstructor", VarFlags[VarFlags.Constant = 65536] = "Constant", VarFlags[VarFlags.MustCaptureThis = 131072] = "MustCaptureThis", (FncFlags = FncFlags || (FncFlags = { + }))[FncFlags.None = 0] = "None", FncFlags[FncFlags.Exported = 1] = "Exported", FncFlags[FncFlags.Private = 2] = "Private", FncFlags[FncFlags.Public = 4] = "Public", FncFlags[FncFlags.Ambient = 8] = "Ambient", FncFlags[FncFlags.Static = 16] = "Static", FncFlags[FncFlags.LocalStatic = 32] = "LocalStatic", FncFlags[FncFlags.GetAccessor = 64] = "GetAccessor", FncFlags[FncFlags.SetAccessor = 128] = "SetAccessor", FncFlags[FncFlags.Definition = 256] = "Definition", FncFlags[FncFlags.Signature = 512] = "Signature", FncFlags[FncFlags.Method = 1024] = "Method", FncFlags[FncFlags.HasReturnExpression = 2048] = "HasReturnExpression", FncFlags[FncFlags.CallMember = 4096] = "CallMember", FncFlags[FncFlags.ConstructMember = 8192] = "ConstructMember", FncFlags[FncFlags.HasSelfReference = 16384] = "HasSelfReference", FncFlags[FncFlags.IsFatArrowFunction = 32768] = "IsFatArrowFunction", FncFlags[FncFlags.IndexerMember = 65536] = "IndexerMember", FncFlags[FncFlags.IsFunctionExpression = 131072] = "IsFunctionExpression", FncFlags[FncFlags.ClassMethod = 262144] = "ClassMethod", FncFlags[FncFlags.ClassPropertyMethodExported = 524288] = "ClassPropertyMethodExported", (SignatureFlags = SignatureFlags || (SignatureFlags = { + }))[SignatureFlags.None = 0] = "None", SignatureFlags[SignatureFlags.IsIndexer = 1] = "IsIndexer", SignatureFlags[SignatureFlags.IsStringIndexer = 2] = "IsStringIndexer", SignatureFlags[SignatureFlags.IsNumberIndexer = 4] = "IsNumberIndexer", TypeScript1.ToDeclFlags = function(fncOrVarOrSymbolOrModuleFlags) { return fncOrVarOrSymbolOrModuleFlags; - }, (TypeFlags1 = TypeFlags || (TypeFlags = { - }))[TypeFlags1.None = 0] = "None", TypeFlags1[TypeFlags1.HasImplementation = 1] = "HasImplementation", TypeFlags1[TypeFlags1.HasSelfReference = 2] = "HasSelfReference", TypeFlags1[TypeFlags1.MergeResult = 4] = "MergeResult", TypeFlags1[TypeFlags1.IsEnum = 8] = "IsEnum", TypeFlags1[TypeFlags1.BuildingName = 16] = "BuildingName", TypeFlags1[TypeFlags1.HasBaseType = 32] = "HasBaseType", TypeFlags1[TypeFlags1.HasBaseTypeOfObject = 64] = "HasBaseTypeOfObject", TypeFlags1[TypeFlags1.IsClass = 128] = "IsClass", (TypeRelationshipFlags1 = TypeRelationshipFlags || (TypeRelationshipFlags = { - }))[TypeRelationshipFlags1.SuccessfulComparison = 0] = "SuccessfulComparison", TypeRelationshipFlags1[TypeRelationshipFlags1.SourceIsNullTargetIsVoidOrUndefined = 1] = "SourceIsNullTargetIsVoidOrUndefined", TypeRelationshipFlags1[TypeRelationshipFlags1.RequiredPropertyIsMissing = 2] = "RequiredPropertyIsMissing", TypeRelationshipFlags1[TypeRelationshipFlags1.IncompatibleSignatures = 4] = "IncompatibleSignatures", TypeRelationshipFlags1[TypeRelationshipFlags1.SourceSignatureHasTooManyParameters = 3] = "SourceSignatureHasTooManyParameters", TypeRelationshipFlags1[TypeRelationshipFlags1.IncompatibleReturnTypes = 16] = "IncompatibleReturnTypes", TypeRelationshipFlags1[TypeRelationshipFlags1.IncompatiblePropertyTypes = 32] = "IncompatiblePropertyTypes", TypeRelationshipFlags1[TypeRelationshipFlags1.IncompatibleParameterTypes = 64] = "IncompatibleParameterTypes", (CodeGenTarget1 = CodeGenTarget || (CodeGenTarget = { - }))[CodeGenTarget1.ES3 = 0] = "ES3", CodeGenTarget1[CodeGenTarget1.ES5 = 1] = "ES5", (ModuleGenTarget1 = ModuleGenTarget || (ModuleGenTarget = { - }))[ModuleGenTarget1.Synchronous = 0] = "Synchronous", ModuleGenTarget1[ModuleGenTarget1.Asynchronous = 1] = "Asynchronous", ModuleGenTarget1[ModuleGenTarget1.Local = 2] = "Local", TypeScript1.codeGenTarget = CodeGenTarget.ES3, TypeScript1.moduleGenTarget = ModuleGenTarget.Synchronous, TypeScript1.optimizeModuleCodeGen = !0, TypeScript1.flagsToString = function(e, flags) { + }, (TypeFlags = TypeFlags || (TypeFlags = { + }))[TypeFlags.None = 0] = "None", TypeFlags[TypeFlags.HasImplementation = 1] = "HasImplementation", TypeFlags[TypeFlags.HasSelfReference = 2] = "HasSelfReference", TypeFlags[TypeFlags.MergeResult = 4] = "MergeResult", TypeFlags[TypeFlags.IsEnum = 8] = "IsEnum", TypeFlags[TypeFlags.BuildingName = 16] = "BuildingName", TypeFlags[TypeFlags.HasBaseType = 32] = "HasBaseType", TypeFlags[TypeFlags.HasBaseTypeOfObject = 64] = "HasBaseTypeOfObject", TypeFlags[TypeFlags.IsClass = 128] = "IsClass", (TypeRelationshipFlags = TypeRelationshipFlags || (TypeRelationshipFlags = { + }))[TypeRelationshipFlags.SuccessfulComparison = 0] = "SuccessfulComparison", TypeRelationshipFlags[TypeRelationshipFlags.SourceIsNullTargetIsVoidOrUndefined = 1] = "SourceIsNullTargetIsVoidOrUndefined", TypeRelationshipFlags[TypeRelationshipFlags.RequiredPropertyIsMissing = 2] = "RequiredPropertyIsMissing", TypeRelationshipFlags[TypeRelationshipFlags.IncompatibleSignatures = 4] = "IncompatibleSignatures", TypeRelationshipFlags[TypeRelationshipFlags.SourceSignatureHasTooManyParameters = 3] = "SourceSignatureHasTooManyParameters", TypeRelationshipFlags[TypeRelationshipFlags.IncompatibleReturnTypes = 16] = "IncompatibleReturnTypes", TypeRelationshipFlags[TypeRelationshipFlags.IncompatiblePropertyTypes = 32] = "IncompatiblePropertyTypes", TypeRelationshipFlags[TypeRelationshipFlags.IncompatibleParameterTypes = 64] = "IncompatibleParameterTypes", (CodeGenTarget = CodeGenTarget || (CodeGenTarget = { + }))[CodeGenTarget.ES3 = 0] = "ES3", CodeGenTarget[CodeGenTarget.ES5 = 1] = "ES5", (ModuleGenTarget = ModuleGenTarget || (ModuleGenTarget = { + }))[ModuleGenTarget.Synchronous = 0] = "Synchronous", ModuleGenTarget[ModuleGenTarget.Asynchronous = 1] = "Asynchronous", ModuleGenTarget[ModuleGenTarget.Local = 2] = "Local", TypeScript1.codeGenTarget = CodeGenTarget.ES3, TypeScript1.moduleGenTarget = ModuleGenTarget.Synchronous, TypeScript1.optimizeModuleCodeGen = !0, TypeScript1.flagsToString = function(e, flags) { for(var builder = "", i = 1; i < -2147483648; i <<= 1)if ((flags & i) != 0) { for(var k in e)if (e[k] == i) { builder.length > 0 && (builder += "|"), builder += k; diff --git a/crates/swc/tests/tsc-references/parser/ecmascript5/parserRealSource3/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/parser/ecmascript5/parserRealSource3/input.ts/es2015.1.normal/output.js index 78423035977..5340ab9c58d 100644 --- a/crates/swc/tests/tsc-references/parser/ecmascript5/parserRealSource3/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/parser/ecmascript5/parserRealSource3/input.ts/es2015.1.normal/output.js @@ -3,7 +3,7 @@ /// var TypeScript; (function(TypeScript1) { - var NodeType1; + let NodeType; (function(NodeType) { NodeType[NodeType["None"] = 0] = "None"; NodeType[NodeType["Empty"] = 1] = "Empty"; @@ -112,10 +112,10 @@ var TypeScript; NodeType[NodeType["Error"] = 104] = "Error"; NodeType[NodeType["Comment"] = 105] = "Comment"; NodeType[NodeType["Debugger"] = 106] = "Debugger"; - NodeType[NodeType["GeneralNode"] = 71] = "GeneralNode"; - NodeType[NodeType["LastAsg"] = 41] = "LastAsg"; - })(NodeType1 || (NodeType1 = { + NodeType[NodeType["GeneralNode"] = FuncDecl] = "GeneralNode"; + NodeType[NodeType["LastAsg"] = AsgRs2] = "LastAsg"; + })(NodeType || (NodeType = { })); - TypeScript1.NodeType = NodeType1; + TypeScript1.NodeType = NodeType; })(TypeScript || (TypeScript = { })); diff --git a/crates/swc/tests/tsc-references/parser/ecmascript5/parserRealSource3/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/parser/ecmascript5/parserRealSource3/input.ts/es2015.2.minified/output.js index 14ff8edd84e..b65fb47ccb6 100644 --- a/crates/swc/tests/tsc-references/parser/ecmascript5/parserRealSource3/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/parser/ecmascript5/parserRealSource3/input.ts/es2015.2.minified/output.js @@ -1,7 +1,8 @@ var TypeScript; !function(TypeScript1) { - var NodeType, NodeType1; - (NodeType1 = NodeType || (NodeType = { - }))[NodeType1.None = 0] = "None", NodeType1[NodeType1.Empty = 1] = "Empty", NodeType1[NodeType1.EmptyExpr = 2] = "EmptyExpr", NodeType1[NodeType1.True = 3] = "True", NodeType1[NodeType1.False = 4] = "False", NodeType1[NodeType1.This = 5] = "This", NodeType1[NodeType1.Super = 6] = "Super", NodeType1[NodeType1.QString = 7] = "QString", NodeType1[NodeType1.Regex = 8] = "Regex", NodeType1[NodeType1.Null = 9] = "Null", NodeType1[NodeType1.ArrayLit = 10] = "ArrayLit", NodeType1[NodeType1.ObjectLit = 11] = "ObjectLit", NodeType1[NodeType1.Void = 12] = "Void", NodeType1[NodeType1.Comma = 13] = "Comma", NodeType1[NodeType1.Pos = 14] = "Pos", NodeType1[NodeType1.Neg = 15] = "Neg", NodeType1[NodeType1.Delete = 16] = "Delete", NodeType1[NodeType1.Await = 17] = "Await", NodeType1[NodeType1.In = 18] = "In", NodeType1[NodeType1.Dot = 19] = "Dot", NodeType1[NodeType1.From = 20] = "From", NodeType1[NodeType1.Is = 21] = "Is", NodeType1[NodeType1.InstOf = 22] = "InstOf", NodeType1[NodeType1.Typeof = 23] = "Typeof", NodeType1[NodeType1.NumberLit = 24] = "NumberLit", NodeType1[NodeType1.Name = 25] = "Name", NodeType1[NodeType1.TypeRef = 26] = "TypeRef", NodeType1[NodeType1.Index = 27] = "Index", NodeType1[NodeType1.Call = 28] = "Call", NodeType1[NodeType1.New = 29] = "New", NodeType1[NodeType1.Asg = 30] = "Asg", NodeType1[NodeType1.AsgAdd = 31] = "AsgAdd", NodeType1[NodeType1.AsgSub = 32] = "AsgSub", NodeType1[NodeType1.AsgDiv = 33] = "AsgDiv", NodeType1[NodeType1.AsgMul = 34] = "AsgMul", NodeType1[NodeType1.AsgMod = 35] = "AsgMod", NodeType1[NodeType1.AsgAnd = 36] = "AsgAnd", NodeType1[NodeType1.AsgXor = 37] = "AsgXor", NodeType1[NodeType1.AsgOr = 38] = "AsgOr", NodeType1[NodeType1.AsgLsh = 39] = "AsgLsh", NodeType1[NodeType1.AsgRsh = 40] = "AsgRsh", NodeType1[NodeType1.AsgRs2 = 41] = "AsgRs2", NodeType1[NodeType1.ConditionalExpression = 42] = "ConditionalExpression", NodeType1[NodeType1.LogOr = 43] = "LogOr", NodeType1[NodeType1.LogAnd = 44] = "LogAnd", NodeType1[NodeType1.Or = 45] = "Or", NodeType1[NodeType1.Xor = 46] = "Xor", NodeType1[NodeType1.And = 47] = "And", NodeType1[NodeType1.Eq = 48] = "Eq", NodeType1[NodeType1.Ne = 49] = "Ne", NodeType1[NodeType1.Eqv = 50] = "Eqv", NodeType1[NodeType1.NEqv = 51] = "NEqv", NodeType1[NodeType1.Lt = 52] = "Lt", NodeType1[NodeType1.Le = 53] = "Le", NodeType1[NodeType1.Gt = 54] = "Gt", NodeType1[NodeType1.Ge = 55] = "Ge", NodeType1[NodeType1.Add = 56] = "Add", NodeType1[NodeType1.Sub = 57] = "Sub", NodeType1[NodeType1.Mul = 58] = "Mul", NodeType1[NodeType1.Div = 59] = "Div", NodeType1[NodeType1.Mod = 60] = "Mod", NodeType1[NodeType1.Lsh = 61] = "Lsh", NodeType1[NodeType1.Rsh = 62] = "Rsh", NodeType1[NodeType1.Rs2 = 63] = "Rs2", NodeType1[NodeType1.Not = 64] = "Not", NodeType1[NodeType1.LogNot = 65] = "LogNot", NodeType1[NodeType1.IncPre = 66] = "IncPre", NodeType1[NodeType1.DecPre = 67] = "DecPre", NodeType1[NodeType1.IncPost = 68] = "IncPost", NodeType1[NodeType1.DecPost = 69] = "DecPost", NodeType1[NodeType1.TypeAssertion = 70] = "TypeAssertion", NodeType1[NodeType1.FuncDecl = 71] = "FuncDecl", NodeType1[NodeType1.Member = 72] = "Member", NodeType1[NodeType1.VarDecl = 73] = "VarDecl", NodeType1[NodeType1.ArgDecl = 74] = "ArgDecl", NodeType1[NodeType1.Return = 75] = "Return", NodeType1[NodeType1.Break = 76] = "Break", NodeType1[NodeType1.Continue = 77] = "Continue", NodeType1[NodeType1.Throw = 78] = "Throw", NodeType1[NodeType1.For = 79] = "For", NodeType1[NodeType1.ForIn = 80] = "ForIn", NodeType1[NodeType1.If = 81] = "If", NodeType1[NodeType1.While = 82] = "While", NodeType1[NodeType1.DoWhile = 83] = "DoWhile", NodeType1[NodeType1.Block = 84] = "Block", NodeType1[NodeType1.Case = 85] = "Case", NodeType1[NodeType1.Switch = 86] = "Switch", NodeType1[NodeType1.Try = 87] = "Try", NodeType1[NodeType1.TryCatch = 88] = "TryCatch", NodeType1[NodeType1.TryFinally = 89] = "TryFinally", NodeType1[NodeType1.Finally = 90] = "Finally", NodeType1[NodeType1.Catch = 91] = "Catch", NodeType1[NodeType1.List = 92] = "List", NodeType1[NodeType1.Script = 93] = "Script", NodeType1[NodeType1.ClassDeclaration = 94] = "ClassDeclaration", NodeType1[NodeType1.InterfaceDeclaration = 95] = "InterfaceDeclaration", NodeType1[NodeType1.ModuleDeclaration = 96] = "ModuleDeclaration", NodeType1[NodeType1.ImportDeclaration = 97] = "ImportDeclaration", NodeType1[NodeType1.With = 98] = "With", NodeType1[NodeType1.Label = 99] = "Label", NodeType1[NodeType1.LabeledStatement = 100] = "LabeledStatement", NodeType1[NodeType1.EBStart = 101] = "EBStart", NodeType1[NodeType1.GotoEB = 102] = "GotoEB", NodeType1[NodeType1.EndCode = 103] = "EndCode", NodeType1[NodeType1.Error = 104] = "Error", NodeType1[NodeType1.Comment = 105] = "Comment", NodeType1[NodeType1.Debugger = 106] = "Debugger", NodeType1[NodeType1.GeneralNode = 71] = "GeneralNode", NodeType1[NodeType1.LastAsg = 41] = "LastAsg", TypeScript1.NodeType = NodeType; + var NodeType; + let NodeType; + (NodeType = NodeType || (NodeType = { + }))[NodeType.None = 0] = "None", NodeType[NodeType.Empty = 1] = "Empty", NodeType[NodeType.EmptyExpr = 2] = "EmptyExpr", NodeType[NodeType.True = 3] = "True", NodeType[NodeType.False = 4] = "False", NodeType[NodeType.This = 5] = "This", NodeType[NodeType.Super = 6] = "Super", NodeType[NodeType.QString = 7] = "QString", NodeType[NodeType.Regex = 8] = "Regex", NodeType[NodeType.Null = 9] = "Null", NodeType[NodeType.ArrayLit = 10] = "ArrayLit", NodeType[NodeType.ObjectLit = 11] = "ObjectLit", NodeType[NodeType.Void = 12] = "Void", NodeType[NodeType.Comma = 13] = "Comma", NodeType[NodeType.Pos = 14] = "Pos", NodeType[NodeType.Neg = 15] = "Neg", NodeType[NodeType.Delete = 16] = "Delete", NodeType[NodeType.Await = 17] = "Await", NodeType[NodeType.In = 18] = "In", NodeType[NodeType.Dot = 19] = "Dot", NodeType[NodeType.From = 20] = "From", NodeType[NodeType.Is = 21] = "Is", NodeType[NodeType.InstOf = 22] = "InstOf", NodeType[NodeType.Typeof = 23] = "Typeof", NodeType[NodeType.NumberLit = 24] = "NumberLit", NodeType[NodeType.Name = 25] = "Name", NodeType[NodeType.TypeRef = 26] = "TypeRef", NodeType[NodeType.Index = 27] = "Index", NodeType[NodeType.Call = 28] = "Call", NodeType[NodeType.New = 29] = "New", NodeType[NodeType.Asg = 30] = "Asg", NodeType[NodeType.AsgAdd = 31] = "AsgAdd", NodeType[NodeType.AsgSub = 32] = "AsgSub", NodeType[NodeType.AsgDiv = 33] = "AsgDiv", NodeType[NodeType.AsgMul = 34] = "AsgMul", NodeType[NodeType.AsgMod = 35] = "AsgMod", NodeType[NodeType.AsgAnd = 36] = "AsgAnd", NodeType[NodeType.AsgXor = 37] = "AsgXor", NodeType[NodeType.AsgOr = 38] = "AsgOr", NodeType[NodeType.AsgLsh = 39] = "AsgLsh", NodeType[NodeType.AsgRsh = 40] = "AsgRsh", NodeType[NodeType.AsgRs2 = 41] = "AsgRs2", NodeType[NodeType.ConditionalExpression = 42] = "ConditionalExpression", NodeType[NodeType.LogOr = 43] = "LogOr", NodeType[NodeType.LogAnd = 44] = "LogAnd", NodeType[NodeType.Or = 45] = "Or", NodeType[NodeType.Xor = 46] = "Xor", NodeType[NodeType.And = 47] = "And", NodeType[NodeType.Eq = 48] = "Eq", NodeType[NodeType.Ne = 49] = "Ne", NodeType[NodeType.Eqv = 50] = "Eqv", NodeType[NodeType.NEqv = 51] = "NEqv", NodeType[NodeType.Lt = 52] = "Lt", NodeType[NodeType.Le = 53] = "Le", NodeType[NodeType.Gt = 54] = "Gt", NodeType[NodeType.Ge = 55] = "Ge", NodeType[NodeType.Add = 56] = "Add", NodeType[NodeType.Sub = 57] = "Sub", NodeType[NodeType.Mul = 58] = "Mul", NodeType[NodeType.Div = 59] = "Div", NodeType[NodeType.Mod = 60] = "Mod", NodeType[NodeType.Lsh = 61] = "Lsh", NodeType[NodeType.Rsh = 62] = "Rsh", NodeType[NodeType.Rs2 = 63] = "Rs2", NodeType[NodeType.Not = 64] = "Not", NodeType[NodeType.LogNot = 65] = "LogNot", NodeType[NodeType.IncPre = 66] = "IncPre", NodeType[NodeType.DecPre = 67] = "DecPre", NodeType[NodeType.IncPost = 68] = "IncPost", NodeType[NodeType.DecPost = 69] = "DecPost", NodeType[NodeType.TypeAssertion = 70] = "TypeAssertion", NodeType[NodeType.FuncDecl = 71] = "FuncDecl", NodeType[NodeType.Member = 72] = "Member", NodeType[NodeType.VarDecl = 73] = "VarDecl", NodeType[NodeType.ArgDecl = 74] = "ArgDecl", NodeType[NodeType.Return = 75] = "Return", NodeType[NodeType.Break = 76] = "Break", NodeType[NodeType.Continue = 77] = "Continue", NodeType[NodeType.Throw = 78] = "Throw", NodeType[NodeType.For = 79] = "For", NodeType[NodeType.ForIn = 80] = "ForIn", NodeType[NodeType.If = 81] = "If", NodeType[NodeType.While = 82] = "While", NodeType[NodeType.DoWhile = 83] = "DoWhile", NodeType[NodeType.Block = 84] = "Block", NodeType[NodeType.Case = 85] = "Case", NodeType[NodeType.Switch = 86] = "Switch", NodeType[NodeType.Try = 87] = "Try", NodeType[NodeType.TryCatch = 88] = "TryCatch", NodeType[NodeType.TryFinally = 89] = "TryFinally", NodeType[NodeType.Finally = 90] = "Finally", NodeType[NodeType.Catch = 91] = "Catch", NodeType[NodeType.List = 92] = "List", NodeType[NodeType.Script = 93] = "Script", NodeType[NodeType.ClassDeclaration = 94] = "ClassDeclaration", NodeType[NodeType.InterfaceDeclaration = 95] = "InterfaceDeclaration", NodeType[NodeType.ModuleDeclaration = 96] = "ModuleDeclaration", NodeType[NodeType.ImportDeclaration = 97] = "ImportDeclaration", NodeType[NodeType.With = 98] = "With", NodeType[NodeType.Label = 99] = "Label", NodeType[NodeType.LabeledStatement = 100] = "LabeledStatement", NodeType[NodeType.EBStart = 101] = "EBStart", NodeType[NodeType.GotoEB = 102] = "GotoEB", NodeType[NodeType.EndCode = 103] = "EndCode", NodeType[NodeType.Error = 104] = "Error", NodeType[NodeType.Comment = 105] = "Comment", NodeType[NodeType.Debugger = 106] = "Debugger", NodeType[NodeType.GeneralNode = FuncDecl] = "GeneralNode", NodeType[NodeType.LastAsg = AsgRs2] = "LastAsg", TypeScript1.NodeType = NodeType; }(TypeScript || (TypeScript = { })); diff --git a/crates/swc/tests/tsc-references/parser/ecmascript5/parserRealSource3/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/parser/ecmascript5/parserRealSource3/input.ts/es5.1.normal/output.js index 78423035977..34ff2d48f4a 100644 --- a/crates/swc/tests/tsc-references/parser/ecmascript5/parserRealSource3/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/parser/ecmascript5/parserRealSource3/input.ts/es5.1.normal/output.js @@ -3,7 +3,7 @@ /// var TypeScript; (function(TypeScript1) { - var NodeType1; + var NodeType; (function(NodeType) { NodeType[NodeType["None"] = 0] = "None"; NodeType[NodeType["Empty"] = 1] = "Empty"; @@ -112,10 +112,10 @@ var TypeScript; NodeType[NodeType["Error"] = 104] = "Error"; NodeType[NodeType["Comment"] = 105] = "Comment"; NodeType[NodeType["Debugger"] = 106] = "Debugger"; - NodeType[NodeType["GeneralNode"] = 71] = "GeneralNode"; - NodeType[NodeType["LastAsg"] = 41] = "LastAsg"; - })(NodeType1 || (NodeType1 = { + NodeType[NodeType["GeneralNode"] = FuncDecl] = "GeneralNode"; + NodeType[NodeType["LastAsg"] = AsgRs2] = "LastAsg"; + })(NodeType || (NodeType = { })); - TypeScript1.NodeType = NodeType1; + TypeScript1.NodeType = NodeType; })(TypeScript || (TypeScript = { })); diff --git a/crates/swc/tests/tsc-references/parser/ecmascript5/parserRealSource3/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/parser/ecmascript5/parserRealSource3/input.ts/es5.2.minified/output.js index 14ff8edd84e..9cfdee36ac6 100644 --- a/crates/swc/tests/tsc-references/parser/ecmascript5/parserRealSource3/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/parser/ecmascript5/parserRealSource3/input.ts/es5.2.minified/output.js @@ -1,7 +1,7 @@ var TypeScript; !function(TypeScript1) { - var NodeType, NodeType1; - (NodeType1 = NodeType || (NodeType = { - }))[NodeType1.None = 0] = "None", NodeType1[NodeType1.Empty = 1] = "Empty", NodeType1[NodeType1.EmptyExpr = 2] = "EmptyExpr", NodeType1[NodeType1.True = 3] = "True", NodeType1[NodeType1.False = 4] = "False", NodeType1[NodeType1.This = 5] = "This", NodeType1[NodeType1.Super = 6] = "Super", NodeType1[NodeType1.QString = 7] = "QString", NodeType1[NodeType1.Regex = 8] = "Regex", NodeType1[NodeType1.Null = 9] = "Null", NodeType1[NodeType1.ArrayLit = 10] = "ArrayLit", NodeType1[NodeType1.ObjectLit = 11] = "ObjectLit", NodeType1[NodeType1.Void = 12] = "Void", NodeType1[NodeType1.Comma = 13] = "Comma", NodeType1[NodeType1.Pos = 14] = "Pos", NodeType1[NodeType1.Neg = 15] = "Neg", NodeType1[NodeType1.Delete = 16] = "Delete", NodeType1[NodeType1.Await = 17] = "Await", NodeType1[NodeType1.In = 18] = "In", NodeType1[NodeType1.Dot = 19] = "Dot", NodeType1[NodeType1.From = 20] = "From", NodeType1[NodeType1.Is = 21] = "Is", NodeType1[NodeType1.InstOf = 22] = "InstOf", NodeType1[NodeType1.Typeof = 23] = "Typeof", NodeType1[NodeType1.NumberLit = 24] = "NumberLit", NodeType1[NodeType1.Name = 25] = "Name", NodeType1[NodeType1.TypeRef = 26] = "TypeRef", NodeType1[NodeType1.Index = 27] = "Index", NodeType1[NodeType1.Call = 28] = "Call", NodeType1[NodeType1.New = 29] = "New", NodeType1[NodeType1.Asg = 30] = "Asg", NodeType1[NodeType1.AsgAdd = 31] = "AsgAdd", NodeType1[NodeType1.AsgSub = 32] = "AsgSub", NodeType1[NodeType1.AsgDiv = 33] = "AsgDiv", NodeType1[NodeType1.AsgMul = 34] = "AsgMul", NodeType1[NodeType1.AsgMod = 35] = "AsgMod", NodeType1[NodeType1.AsgAnd = 36] = "AsgAnd", NodeType1[NodeType1.AsgXor = 37] = "AsgXor", NodeType1[NodeType1.AsgOr = 38] = "AsgOr", NodeType1[NodeType1.AsgLsh = 39] = "AsgLsh", NodeType1[NodeType1.AsgRsh = 40] = "AsgRsh", NodeType1[NodeType1.AsgRs2 = 41] = "AsgRs2", NodeType1[NodeType1.ConditionalExpression = 42] = "ConditionalExpression", NodeType1[NodeType1.LogOr = 43] = "LogOr", NodeType1[NodeType1.LogAnd = 44] = "LogAnd", NodeType1[NodeType1.Or = 45] = "Or", NodeType1[NodeType1.Xor = 46] = "Xor", NodeType1[NodeType1.And = 47] = "And", NodeType1[NodeType1.Eq = 48] = "Eq", NodeType1[NodeType1.Ne = 49] = "Ne", NodeType1[NodeType1.Eqv = 50] = "Eqv", NodeType1[NodeType1.NEqv = 51] = "NEqv", NodeType1[NodeType1.Lt = 52] = "Lt", NodeType1[NodeType1.Le = 53] = "Le", NodeType1[NodeType1.Gt = 54] = "Gt", NodeType1[NodeType1.Ge = 55] = "Ge", NodeType1[NodeType1.Add = 56] = "Add", NodeType1[NodeType1.Sub = 57] = "Sub", NodeType1[NodeType1.Mul = 58] = "Mul", NodeType1[NodeType1.Div = 59] = "Div", NodeType1[NodeType1.Mod = 60] = "Mod", NodeType1[NodeType1.Lsh = 61] = "Lsh", NodeType1[NodeType1.Rsh = 62] = "Rsh", NodeType1[NodeType1.Rs2 = 63] = "Rs2", NodeType1[NodeType1.Not = 64] = "Not", NodeType1[NodeType1.LogNot = 65] = "LogNot", NodeType1[NodeType1.IncPre = 66] = "IncPre", NodeType1[NodeType1.DecPre = 67] = "DecPre", NodeType1[NodeType1.IncPost = 68] = "IncPost", NodeType1[NodeType1.DecPost = 69] = "DecPost", NodeType1[NodeType1.TypeAssertion = 70] = "TypeAssertion", NodeType1[NodeType1.FuncDecl = 71] = "FuncDecl", NodeType1[NodeType1.Member = 72] = "Member", NodeType1[NodeType1.VarDecl = 73] = "VarDecl", NodeType1[NodeType1.ArgDecl = 74] = "ArgDecl", NodeType1[NodeType1.Return = 75] = "Return", NodeType1[NodeType1.Break = 76] = "Break", NodeType1[NodeType1.Continue = 77] = "Continue", NodeType1[NodeType1.Throw = 78] = "Throw", NodeType1[NodeType1.For = 79] = "For", NodeType1[NodeType1.ForIn = 80] = "ForIn", NodeType1[NodeType1.If = 81] = "If", NodeType1[NodeType1.While = 82] = "While", NodeType1[NodeType1.DoWhile = 83] = "DoWhile", NodeType1[NodeType1.Block = 84] = "Block", NodeType1[NodeType1.Case = 85] = "Case", NodeType1[NodeType1.Switch = 86] = "Switch", NodeType1[NodeType1.Try = 87] = "Try", NodeType1[NodeType1.TryCatch = 88] = "TryCatch", NodeType1[NodeType1.TryFinally = 89] = "TryFinally", NodeType1[NodeType1.Finally = 90] = "Finally", NodeType1[NodeType1.Catch = 91] = "Catch", NodeType1[NodeType1.List = 92] = "List", NodeType1[NodeType1.Script = 93] = "Script", NodeType1[NodeType1.ClassDeclaration = 94] = "ClassDeclaration", NodeType1[NodeType1.InterfaceDeclaration = 95] = "InterfaceDeclaration", NodeType1[NodeType1.ModuleDeclaration = 96] = "ModuleDeclaration", NodeType1[NodeType1.ImportDeclaration = 97] = "ImportDeclaration", NodeType1[NodeType1.With = 98] = "With", NodeType1[NodeType1.Label = 99] = "Label", NodeType1[NodeType1.LabeledStatement = 100] = "LabeledStatement", NodeType1[NodeType1.EBStart = 101] = "EBStart", NodeType1[NodeType1.GotoEB = 102] = "GotoEB", NodeType1[NodeType1.EndCode = 103] = "EndCode", NodeType1[NodeType1.Error = 104] = "Error", NodeType1[NodeType1.Comment = 105] = "Comment", NodeType1[NodeType1.Debugger = 106] = "Debugger", NodeType1[NodeType1.GeneralNode = 71] = "GeneralNode", NodeType1[NodeType1.LastAsg = 41] = "LastAsg", TypeScript1.NodeType = NodeType; + var NodeType, NodeType; + (NodeType = NodeType || (NodeType = { + }))[NodeType.None = 0] = "None", NodeType[NodeType.Empty = 1] = "Empty", NodeType[NodeType.EmptyExpr = 2] = "EmptyExpr", NodeType[NodeType.True = 3] = "True", NodeType[NodeType.False = 4] = "False", NodeType[NodeType.This = 5] = "This", NodeType[NodeType.Super = 6] = "Super", NodeType[NodeType.QString = 7] = "QString", NodeType[NodeType.Regex = 8] = "Regex", NodeType[NodeType.Null = 9] = "Null", NodeType[NodeType.ArrayLit = 10] = "ArrayLit", NodeType[NodeType.ObjectLit = 11] = "ObjectLit", NodeType[NodeType.Void = 12] = "Void", NodeType[NodeType.Comma = 13] = "Comma", NodeType[NodeType.Pos = 14] = "Pos", NodeType[NodeType.Neg = 15] = "Neg", NodeType[NodeType.Delete = 16] = "Delete", NodeType[NodeType.Await = 17] = "Await", NodeType[NodeType.In = 18] = "In", NodeType[NodeType.Dot = 19] = "Dot", NodeType[NodeType.From = 20] = "From", NodeType[NodeType.Is = 21] = "Is", NodeType[NodeType.InstOf = 22] = "InstOf", NodeType[NodeType.Typeof = 23] = "Typeof", NodeType[NodeType.NumberLit = 24] = "NumberLit", NodeType[NodeType.Name = 25] = "Name", NodeType[NodeType.TypeRef = 26] = "TypeRef", NodeType[NodeType.Index = 27] = "Index", NodeType[NodeType.Call = 28] = "Call", NodeType[NodeType.New = 29] = "New", NodeType[NodeType.Asg = 30] = "Asg", NodeType[NodeType.AsgAdd = 31] = "AsgAdd", NodeType[NodeType.AsgSub = 32] = "AsgSub", NodeType[NodeType.AsgDiv = 33] = "AsgDiv", NodeType[NodeType.AsgMul = 34] = "AsgMul", NodeType[NodeType.AsgMod = 35] = "AsgMod", NodeType[NodeType.AsgAnd = 36] = "AsgAnd", NodeType[NodeType.AsgXor = 37] = "AsgXor", NodeType[NodeType.AsgOr = 38] = "AsgOr", NodeType[NodeType.AsgLsh = 39] = "AsgLsh", NodeType[NodeType.AsgRsh = 40] = "AsgRsh", NodeType[NodeType.AsgRs2 = 41] = "AsgRs2", NodeType[NodeType.ConditionalExpression = 42] = "ConditionalExpression", NodeType[NodeType.LogOr = 43] = "LogOr", NodeType[NodeType.LogAnd = 44] = "LogAnd", NodeType[NodeType.Or = 45] = "Or", NodeType[NodeType.Xor = 46] = "Xor", NodeType[NodeType.And = 47] = "And", NodeType[NodeType.Eq = 48] = "Eq", NodeType[NodeType.Ne = 49] = "Ne", NodeType[NodeType.Eqv = 50] = "Eqv", NodeType[NodeType.NEqv = 51] = "NEqv", NodeType[NodeType.Lt = 52] = "Lt", NodeType[NodeType.Le = 53] = "Le", NodeType[NodeType.Gt = 54] = "Gt", NodeType[NodeType.Ge = 55] = "Ge", NodeType[NodeType.Add = 56] = "Add", NodeType[NodeType.Sub = 57] = "Sub", NodeType[NodeType.Mul = 58] = "Mul", NodeType[NodeType.Div = 59] = "Div", NodeType[NodeType.Mod = 60] = "Mod", NodeType[NodeType.Lsh = 61] = "Lsh", NodeType[NodeType.Rsh = 62] = "Rsh", NodeType[NodeType.Rs2 = 63] = "Rs2", NodeType[NodeType.Not = 64] = "Not", NodeType[NodeType.LogNot = 65] = "LogNot", NodeType[NodeType.IncPre = 66] = "IncPre", NodeType[NodeType.DecPre = 67] = "DecPre", NodeType[NodeType.IncPost = 68] = "IncPost", NodeType[NodeType.DecPost = 69] = "DecPost", NodeType[NodeType.TypeAssertion = 70] = "TypeAssertion", NodeType[NodeType.FuncDecl = 71] = "FuncDecl", NodeType[NodeType.Member = 72] = "Member", NodeType[NodeType.VarDecl = 73] = "VarDecl", NodeType[NodeType.ArgDecl = 74] = "ArgDecl", NodeType[NodeType.Return = 75] = "Return", NodeType[NodeType.Break = 76] = "Break", NodeType[NodeType.Continue = 77] = "Continue", NodeType[NodeType.Throw = 78] = "Throw", NodeType[NodeType.For = 79] = "For", NodeType[NodeType.ForIn = 80] = "ForIn", NodeType[NodeType.If = 81] = "If", NodeType[NodeType.While = 82] = "While", NodeType[NodeType.DoWhile = 83] = "DoWhile", NodeType[NodeType.Block = 84] = "Block", NodeType[NodeType.Case = 85] = "Case", NodeType[NodeType.Switch = 86] = "Switch", NodeType[NodeType.Try = 87] = "Try", NodeType[NodeType.TryCatch = 88] = "TryCatch", NodeType[NodeType.TryFinally = 89] = "TryFinally", NodeType[NodeType.Finally = 90] = "Finally", NodeType[NodeType.Catch = 91] = "Catch", NodeType[NodeType.List = 92] = "List", NodeType[NodeType.Script = 93] = "Script", NodeType[NodeType.ClassDeclaration = 94] = "ClassDeclaration", NodeType[NodeType.InterfaceDeclaration = 95] = "InterfaceDeclaration", NodeType[NodeType.ModuleDeclaration = 96] = "ModuleDeclaration", NodeType[NodeType.ImportDeclaration = 97] = "ImportDeclaration", NodeType[NodeType.With = 98] = "With", NodeType[NodeType.Label = 99] = "Label", NodeType[NodeType.LabeledStatement = 100] = "LabeledStatement", NodeType[NodeType.EBStart = 101] = "EBStart", NodeType[NodeType.GotoEB = 102] = "GotoEB", NodeType[NodeType.EndCode = 103] = "EndCode", NodeType[NodeType.Error = 104] = "Error", NodeType[NodeType.Comment = 105] = "Comment", NodeType[NodeType.Debugger = 106] = "Debugger", NodeType[NodeType.GeneralNode = FuncDecl] = "GeneralNode", NodeType[NodeType.LastAsg = AsgRs2] = "LastAsg", TypeScript1.NodeType = NodeType; }(TypeScript || (TypeScript = { })); diff --git a/crates/swc/tests/tsc-references/pedantic/noUncheckedIndexedAccess/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/pedantic/noUncheckedIndexedAccess/input.ts/es2015.1.normal/output.js index b934195b1d8..7851add33df 100644 --- a/crates/swc/tests/tsc-references/pedantic/noUncheckedIndexedAccess/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/pedantic/noUncheckedIndexedAccess/input.ts/es2015.1.normal/output.js @@ -1,21 +1,21 @@ var NumericEnum1; -(function(NumericEnum11) { - NumericEnum11[NumericEnum11["A"] = 0] = "A"; - NumericEnum11[NumericEnum11["B"] = 1] = "B"; - NumericEnum11[NumericEnum11["C"] = 2] = "C"; +(function(NumericEnum1) { + NumericEnum1[NumericEnum1["A"] = 0] = "A"; + NumericEnum1[NumericEnum1["B"] = 1] = "B"; + NumericEnum1[NumericEnum1["C"] = 2] = "C"; })(NumericEnum1 || (NumericEnum1 = { })); var NumericEnum2; -(function(NumericEnum21) { - NumericEnum21[NumericEnum21["A"] = 0] = "A"; - NumericEnum21[NumericEnum21["B"] = 1] = "B"; - NumericEnum21[NumericEnum21["C"] = 2] = "C"; +(function(NumericEnum2) { + NumericEnum2[NumericEnum2["A"] = 0] = "A"; + NumericEnum2[NumericEnum2["B"] = 1] = "B"; + NumericEnum2[NumericEnum2["C"] = 2] = "C"; })(NumericEnum2 || (NumericEnum2 = { })); var StringEnum1; -(function(StringEnum11) { - StringEnum11["A"] = "Alpha"; - StringEnum11["B"] = "Beta"; +(function(StringEnum1) { + StringEnum1["A"] = "Alpha"; + StringEnum1["B"] = "Beta"; })(StringEnum1 || (StringEnum1 = { })); // All of these should be errors diff --git a/crates/swc/tests/tsc-references/pedantic/noUncheckedIndexedAccess/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/pedantic/noUncheckedIndexedAccess/input.ts/es2015.2.minified/output.js index 2400bfb004c..178cb1dacfb 100644 --- a/crates/swc/tests/tsc-references/pedantic/noUncheckedIndexedAccess/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/pedantic/noUncheckedIndexedAccess/input.ts/es2015.2.minified/output.js @@ -1,5 +1,5 @@ -var NumericEnum1, NumericEnum2, StringEnum1, NumericEnum11, NumericEnum21, StringEnum11; -(NumericEnum11 = NumericEnum1 || (NumericEnum1 = { -}))[NumericEnum11.A = 0] = "A", NumericEnum11[NumericEnum11.B = 1] = "B", NumericEnum11[NumericEnum11.C = 2] = "C", (NumericEnum21 = NumericEnum2 || (NumericEnum2 = { -}))[NumericEnum21.A = 0] = "A", NumericEnum21[NumericEnum21.B = 1] = "B", NumericEnum21[NumericEnum21.C = 2] = "C", (StringEnum11 = StringEnum1 || (StringEnum1 = { -})).A = "Alpha", StringEnum11.B = "Beta", strMap[0], strMap[0], strMap[0], strMap[0], strMap[NumericEnum1.A], strMap[NumericEnum2.A], strMap[StringEnum1.A], strMap[StringEnum1.A], strMap[NumericEnum1.A], strMap[NumericEnum2.A], strMap[null], strMap.baz = void 0, strMap.qua = void 0, strMap[0] = void 0, strMap[null] = void 0, numMap[0], numMap[0], numMap[0], numMap[NumericEnum1.A], numMap[NumericEnum2.A], symbolMap[s], symbolMap[s] = void 0, nonEmptyStringArray[0], nonEmptyStringArray[1]; +var NumericEnum1, NumericEnum2, StringEnum1, NumericEnum1, NumericEnum2, StringEnum1; +(NumericEnum1 = NumericEnum1 || (NumericEnum1 = { +}))[NumericEnum1.A = 0] = "A", NumericEnum1[NumericEnum1.B = 1] = "B", NumericEnum1[NumericEnum1.C = 2] = "C", (NumericEnum2 = NumericEnum2 || (NumericEnum2 = { +}))[NumericEnum2.A = 0] = "A", NumericEnum2[NumericEnum2.B = 1] = "B", NumericEnum2[NumericEnum2.C = 2] = "C", (StringEnum1 = StringEnum1 || (StringEnum1 = { +})).A = "Alpha", StringEnum1.B = "Beta", strMap[0], strMap[0], strMap[0], strMap[0], strMap[NumericEnum1.A], strMap[NumericEnum2.A], strMap[StringEnum1.A], strMap[StringEnum1.A], strMap[NumericEnum1.A], strMap[NumericEnum2.A], strMap[null], strMap.baz = void 0, strMap.qua = void 0, strMap[0] = void 0, strMap[null] = void 0, numMap[0], numMap[0], numMap[0], numMap[NumericEnum1.A], numMap[NumericEnum2.A], symbolMap[s], symbolMap[s] = void 0, nonEmptyStringArray[0], nonEmptyStringArray[1]; diff --git a/crates/swc/tests/tsc-references/pedantic/noUncheckedIndexedAccess/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/pedantic/noUncheckedIndexedAccess/input.ts/es5.1.normal/output.js index b9e10d5b59c..2da5d54272e 100644 --- a/crates/swc/tests/tsc-references/pedantic/noUncheckedIndexedAccess/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/pedantic/noUncheckedIndexedAccess/input.ts/es5.1.normal/output.js @@ -1,21 +1,21 @@ var NumericEnum1; -(function(NumericEnum11) { - NumericEnum11[NumericEnum11["A"] = 0] = "A"; - NumericEnum11[NumericEnum11["B"] = 1] = "B"; - NumericEnum11[NumericEnum11["C"] = 2] = "C"; +(function(NumericEnum1) { + NumericEnum1[NumericEnum1["A"] = 0] = "A"; + NumericEnum1[NumericEnum1["B"] = 1] = "B"; + NumericEnum1[NumericEnum1["C"] = 2] = "C"; })(NumericEnum1 || (NumericEnum1 = { })); var NumericEnum2; -(function(NumericEnum21) { - NumericEnum21[NumericEnum21["A"] = 0] = "A"; - NumericEnum21[NumericEnum21["B"] = 1] = "B"; - NumericEnum21[NumericEnum21["C"] = 2] = "C"; +(function(NumericEnum2) { + NumericEnum2[NumericEnum2["A"] = 0] = "A"; + NumericEnum2[NumericEnum2["B"] = 1] = "B"; + NumericEnum2[NumericEnum2["C"] = 2] = "C"; })(NumericEnum2 || (NumericEnum2 = { })); var StringEnum1; -(function(StringEnum11) { - StringEnum11["A"] = "Alpha"; - StringEnum11["B"] = "Beta"; +(function(StringEnum1) { + StringEnum1["A"] = "Alpha"; + StringEnum1["B"] = "Beta"; })(StringEnum1 || (StringEnum1 = { })); // All of these should be errors diff --git a/crates/swc/tests/tsc-references/pedantic/noUncheckedIndexedAccess/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/pedantic/noUncheckedIndexedAccess/input.ts/es5.2.minified/output.js index 8bb50645cfb..178cb1dacfb 100644 --- a/crates/swc/tests/tsc-references/pedantic/noUncheckedIndexedAccess/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/pedantic/noUncheckedIndexedAccess/input.ts/es5.2.minified/output.js @@ -1,5 +1,5 @@ -var NumericEnum1, NumericEnum2, StringEnum1, NumericEnum11, NumericEnum21, StringEnum11; -(NumericEnum1 = NumericEnum11 || (NumericEnum11 = { -}))[NumericEnum1.A = 0] = "A", NumericEnum1[NumericEnum1.B = 1] = "B", NumericEnum1[NumericEnum1.C = 2] = "C", (NumericEnum2 = NumericEnum21 || (NumericEnum21 = { -}))[NumericEnum2.A = 0] = "A", NumericEnum2[NumericEnum2.B = 1] = "B", NumericEnum2[NumericEnum2.C = 2] = "C", (StringEnum1 = StringEnum11 || (StringEnum11 = { -})).A = "Alpha", StringEnum1.B = "Beta", strMap[0], strMap[0], strMap[0], strMap[0], strMap[NumericEnum11.A], strMap[NumericEnum21.A], strMap[StringEnum11.A], strMap[StringEnum11.A], strMap[NumericEnum11.A], strMap[NumericEnum21.A], strMap[null], strMap.baz = void 0, strMap.qua = void 0, strMap[0] = void 0, strMap[null] = void 0, numMap[0], numMap[0], numMap[0], numMap[NumericEnum11.A], numMap[NumericEnum21.A], symbolMap[s], symbolMap[s] = void 0, nonEmptyStringArray[0], nonEmptyStringArray[1]; +var NumericEnum1, NumericEnum2, StringEnum1, NumericEnum1, NumericEnum2, StringEnum1; +(NumericEnum1 = NumericEnum1 || (NumericEnum1 = { +}))[NumericEnum1.A = 0] = "A", NumericEnum1[NumericEnum1.B = 1] = "B", NumericEnum1[NumericEnum1.C = 2] = "C", (NumericEnum2 = NumericEnum2 || (NumericEnum2 = { +}))[NumericEnum2.A = 0] = "A", NumericEnum2[NumericEnum2.B = 1] = "B", NumericEnum2[NumericEnum2.C = 2] = "C", (StringEnum1 = StringEnum1 || (StringEnum1 = { +})).A = "Alpha", StringEnum1.B = "Beta", strMap[0], strMap[0], strMap[0], strMap[0], strMap[NumericEnum1.A], strMap[NumericEnum2.A], strMap[StringEnum1.A], strMap[StringEnum1.A], strMap[NumericEnum1.A], strMap[NumericEnum2.A], strMap[null], strMap.baz = void 0, strMap.qua = void 0, strMap[0] = void 0, strMap[null] = void 0, numMap[0], numMap[0], numMap[0], numMap[NumericEnum1.A], numMap[NumericEnum2.A], symbolMap[s], symbolMap[s] = void 0, nonEmptyStringArray[0], nonEmptyStringArray[1]; diff --git a/crates/swc/tests/tsc-references/scanner/ecmascript5/scannerEnum1/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/scanner/ecmascript5/scannerEnum1/input.ts/es2015.1.normal/output.js index 4f40eb24666..45d7ada7db0 100644 --- a/crates/swc/tests/tsc-references/scanner/ecmascript5/scannerEnum1/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/scanner/ecmascript5/scannerEnum1/input.ts/es2015.1.normal/output.js @@ -1,6 +1,6 @@ export var CodeGenTarget; -(function(CodeGenTarget1) { - CodeGenTarget1[CodeGenTarget1["ES3"] = 0] = "ES3"; - CodeGenTarget1[CodeGenTarget1["ES5"] = 1] = "ES5"; +(function(CodeGenTarget) { + CodeGenTarget[CodeGenTarget["ES3"] = 0] = "ES3"; + CodeGenTarget[CodeGenTarget["ES5"] = 1] = "ES5"; })(CodeGenTarget || (CodeGenTarget = { })); diff --git a/crates/swc/tests/tsc-references/scanner/ecmascript5/scannerEnum1/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/scanner/ecmascript5/scannerEnum1/input.ts/es2015.2.minified/output.js index 42f57e7e266..243f274ae21 100644 --- a/crates/swc/tests/tsc-references/scanner/ecmascript5/scannerEnum1/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/scanner/ecmascript5/scannerEnum1/input.ts/es2015.2.minified/output.js @@ -1,3 +1,3 @@ -var CodeGenTarget, CodeGenTarget1; -(CodeGenTarget1 = CodeGenTarget || (CodeGenTarget = { -}))[CodeGenTarget1.ES3 = 0] = "ES3", CodeGenTarget1[CodeGenTarget1.ES5 = 1] = "ES5"; +var CodeGenTarget, CodeGenTarget; +(CodeGenTarget = CodeGenTarget || (CodeGenTarget = { +}))[CodeGenTarget.ES3 = 0] = "ES3", CodeGenTarget[CodeGenTarget.ES5 = 1] = "ES5"; diff --git a/crates/swc/tests/tsc-references/scanner/ecmascript5/scannerEnum1/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/scanner/ecmascript5/scannerEnum1/input.ts/es5.1.normal/output.js index 4f40eb24666..45d7ada7db0 100644 --- a/crates/swc/tests/tsc-references/scanner/ecmascript5/scannerEnum1/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/scanner/ecmascript5/scannerEnum1/input.ts/es5.1.normal/output.js @@ -1,6 +1,6 @@ export var CodeGenTarget; -(function(CodeGenTarget1) { - CodeGenTarget1[CodeGenTarget1["ES3"] = 0] = "ES3"; - CodeGenTarget1[CodeGenTarget1["ES5"] = 1] = "ES5"; +(function(CodeGenTarget) { + CodeGenTarget[CodeGenTarget["ES3"] = 0] = "ES3"; + CodeGenTarget[CodeGenTarget["ES5"] = 1] = "ES5"; })(CodeGenTarget || (CodeGenTarget = { })); diff --git a/crates/swc/tests/tsc-references/scanner/ecmascript5/scannerEnum1/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/scanner/ecmascript5/scannerEnum1/input.ts/es5.2.minified/output.js index 42f57e7e266..243f274ae21 100644 --- a/crates/swc/tests/tsc-references/scanner/ecmascript5/scannerEnum1/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/scanner/ecmascript5/scannerEnum1/input.ts/es5.2.minified/output.js @@ -1,3 +1,3 @@ -var CodeGenTarget, CodeGenTarget1; -(CodeGenTarget1 = CodeGenTarget || (CodeGenTarget = { -}))[CodeGenTarget1.ES3 = 0] = "ES3", CodeGenTarget1[CodeGenTarget1.ES5 = 1] = "ES5"; +var CodeGenTarget, CodeGenTarget; +(CodeGenTarget = CodeGenTarget || (CodeGenTarget = { +}))[CodeGenTarget.ES3 = 0] = "ES3", CodeGenTarget[CodeGenTarget.ES5 = 1] = "ES5"; diff --git a/crates/swc/tests/tsc-references/statements/for-inStatements/for-inStatements/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/statements/for-inStatements/for-inStatements/input.ts/es2015.1.normal/output.js index ed7d1468bfa..bb8460f6823 100644 --- a/crates/swc/tests/tsc-references/statements/for-inStatements/for-inStatements/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/statements/for-inStatements/for-inStatements/input.ts/es2015.1.normal/output.js @@ -97,9 +97,9 @@ for(var x in M){ for(var x in M.X){ } var Color; -(function(Color1) { - Color1[Color1["Red"] = 0] = "Red"; - Color1[Color1["Blue"] = 1] = "Blue"; +(function(Color) { + Color[Color["Red"] = 0] = "Red"; + Color[Color["Blue"] = 1] = "Blue"; })(Color || (Color = { })); for(var x in Color){ diff --git a/crates/swc/tests/tsc-references/statements/for-inStatements/for-inStatements/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/statements/for-inStatements/for-inStatements/input.ts/es2015.2.minified/output.js index b3140b15187..96a2d5513a4 100644 --- a/crates/swc/tests/tsc-references/statements/for-inStatements/for-inStatements/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/statements/for-inStatements/for-inStatements/input.ts/es2015.2.minified/output.js @@ -1,4 +1,4 @@ -var aString, anAny, c, d, e, i, M, Color, Color1; +var aString, anAny, c, d, e, i, M, Color, Color; for(aString in { }); for(anAny in { @@ -34,6 +34,6 @@ for(var x in (M || (M = { })).X = class { }, M); for(var x in M.X); -for(var x in (Color1 = Color || (Color = { -}))[Color1.Red = 0] = "Red", Color1[Color1.Blue = 1] = "Blue", Color); +for(var x in (Color = Color || (Color = { +}))[Color.Red = 0] = "Red", Color[Color.Blue = 1] = "Blue", Color); for(var x in Color.Blue); diff --git a/crates/swc/tests/tsc-references/statements/for-inStatements/for-inStatements/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/statements/for-inStatements/for-inStatements/input.ts/es5.1.normal/output.js index b172830d2d4..061bb2f461c 100644 --- a/crates/swc/tests/tsc-references/statements/for-inStatements/for-inStatements/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/statements/for-inStatements/for-inStatements/input.ts/es5.1.normal/output.js @@ -235,9 +235,9 @@ for(var x in M){ for(var x in M.X){ } var Color; -(function(Color1) { - Color1[Color1["Red"] = 0] = "Red"; - Color1[Color1["Blue"] = 1] = "Blue"; +(function(Color) { + Color[Color["Red"] = 0] = "Red"; + Color[Color["Blue"] = 1] = "Blue"; })(Color || (Color = { })); for(var x in Color){ diff --git a/crates/swc/tests/tsc-references/statements/for-inStatements/for-inStatements/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/statements/for-inStatements/for-inStatements/input.ts/es5.2.minified/output.js index e64005fb8a3..308805872be 100644 --- a/crates/swc/tests/tsc-references/statements/for-inStatements/for-inStatements/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/statements/for-inStatements/for-inStatements/input.ts/es5.2.minified/output.js @@ -64,7 +64,7 @@ for(var x in function(x1) { for(var x in function(x2, y) { return x2 + y; }); -var Color, aString, anAny, c, d, e, i, M, Color1, A = function() { +var Color, aString, anAny, c, d, e, i, M, Color, A = function() { "use strict"; function A() { _classCallCheck(this, A); @@ -153,6 +153,6 @@ for(var x in !function(M1) { }(M || (M = { })), M); for(var x in M.X); -for(var x in (Color = Color1 || (Color1 = { -}))[Color.Red = 0] = "Red", Color[Color.Blue = 1] = "Blue", Color1); -for(var x in Color1.Blue); +for(var x in (Color = Color || (Color = { +}))[Color.Red = 0] = "Red", Color[Color.Blue = 1] = "Blue", Color); +for(var x in Color.Blue); diff --git a/crates/swc/tests/tsc-references/types/any/assignAnyToEveryType/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/types/any/assignAnyToEveryType/input.ts/es2015.1.normal/output.js index cd492fdf167..37292b07537 100644 --- a/crates/swc/tests/tsc-references/types/any/assignAnyToEveryType/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/types/any/assignAnyToEveryType/input.ts/es2015.1.normal/output.js @@ -9,8 +9,8 @@ e = x; var f = undefined; f = x; var E; -(function(E1) { - E1[E1["A"] = 0] = "A"; +(function(E) { + E[E["A"] = 0] = "A"; })(E || (E = { })); var g = x; diff --git a/crates/swc/tests/tsc-references/types/any/assignAnyToEveryType/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/types/any/assignAnyToEveryType/input.ts/es2015.2.minified/output.js index c7083cc19e2..2c976940bf3 100644 --- a/crates/swc/tests/tsc-references/types/any/assignAnyToEveryType/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/types/any/assignAnyToEveryType/input.ts/es2015.2.minified/output.js @@ -1,4 +1,4 @@ -var x, E, M, E1; -(E1 = E || (E = { -}))[E1.A = 0] = "A", E.A, (M || (M = { +var x, E, M, E; +(E = E || (E = { +}))[E.A = 0] = "A", E.A, (M || (M = { })).foo = 1, M = x; diff --git a/crates/swc/tests/tsc-references/types/any/assignAnyToEveryType/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/types/any/assignAnyToEveryType/input.ts/es5.1.normal/output.js index 6e0cf225d1b..1852bf417fe 100644 --- a/crates/swc/tests/tsc-references/types/any/assignAnyToEveryType/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/types/any/assignAnyToEveryType/input.ts/es5.1.normal/output.js @@ -14,8 +14,8 @@ e = x; var f = undefined; f = x; var E; -(function(E1) { - E1[E1["A"] = 0] = "A"; +(function(E) { + E[E["A"] = 0] = "A"; })(E || (E = { })); var g = x; diff --git a/crates/swc/tests/tsc-references/types/any/assignAnyToEveryType/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/types/any/assignAnyToEveryType/input.ts/es5.2.minified/output.js index ccb64d77bba..43792b36778 100644 --- a/crates/swc/tests/tsc-references/types/any/assignAnyToEveryType/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/types/any/assignAnyToEveryType/input.ts/es5.2.minified/output.js @@ -1,6 +1,6 @@ -var x, E, M, E1; -(E1 = E || (E = { -}))[E1.A = 0] = "A", E.A; +var x, E, M, E; +(E = E || (E = { +}))[E.A = 0] = "A", E.A; var C = function() { "use strict"; !function(instance, Constructor) { diff --git a/crates/swc/tests/tsc-references/types/any/assignEveryTypeToAny/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/types/any/assignEveryTypeToAny/input.ts/es2015.1.normal/output.js index 1e50030eeb8..7461112be3c 100644 --- a/crates/swc/tests/tsc-references/types/any/assignEveryTypeToAny/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/types/any/assignEveryTypeToAny/input.ts/es2015.1.normal/output.js @@ -16,8 +16,8 @@ x = e; var e2; x = e2; var E; -(function(E1) { - E1[E1["A"] = 0] = "A"; +(function(E) { + E[E["A"] = 0] = "A"; })(E || (E = { })); x = E.A; diff --git a/crates/swc/tests/tsc-references/types/any/assignEveryTypeToAny/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/types/any/assignEveryTypeToAny/input.ts/es2015.2.minified/output.js index 47941337af4..4dac4549ce1 100644 --- a/crates/swc/tests/tsc-references/types/any/assignEveryTypeToAny/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/types/any/assignEveryTypeToAny/input.ts/es2015.2.minified/output.js @@ -1,3 +1,3 @@ -var E, E1; -(E1 = E || (E = { -}))[E1.A = 0] = "A"; +var E, E; +(E = E || (E = { +}))[E.A = 0] = "A"; diff --git a/crates/swc/tests/tsc-references/types/any/assignEveryTypeToAny/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/types/any/assignEveryTypeToAny/input.ts/es5.1.normal/output.js index 9ba3dc3c891..01b607da7a6 100644 --- a/crates/swc/tests/tsc-references/types/any/assignEveryTypeToAny/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/types/any/assignEveryTypeToAny/input.ts/es5.1.normal/output.js @@ -21,8 +21,8 @@ x = e; var e2; x = e2; var E; -(function(E1) { - E1[E1["A"] = 0] = "A"; +(function(E) { + E[E["A"] = 0] = "A"; })(E || (E = { })); x = E.A; diff --git a/crates/swc/tests/tsc-references/types/any/assignEveryTypeToAny/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/types/any/assignEveryTypeToAny/input.ts/es5.2.minified/output.js index a17c79ff03c..d75c50e764f 100644 --- a/crates/swc/tests/tsc-references/types/any/assignEveryTypeToAny/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/types/any/assignEveryTypeToAny/input.ts/es5.2.minified/output.js @@ -1,6 +1,6 @@ -(E1 = E || (E = { -}))[E1.A = 0] = "A"; -var E, E1, C = function() { +(E = E || (E = { +}))[E.A = 0] = "A"; +var E, E, C = function() { "use strict"; !function(instance, Constructor) { if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function"); diff --git a/crates/swc/tests/tsc-references/types/intersection/intersectionOfUnionOfUnitTypes/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/types/intersection/intersectionOfUnionOfUnitTypes/input.ts/es2015.1.normal/output.js index 892885f6814..ebdae1a11df 100644 --- a/crates/swc/tests/tsc-references/types/intersection/intersectionOfUnionOfUnitTypes/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/types/intersection/intersectionOfUnionOfUnitTypes/input.ts/es2015.1.normal/output.js @@ -1,12 +1,12 @@ var // @strict E; -(function(E1) { - E1[E1["A"] = 0] = "A"; - E1[E1["B"] = 1] = "B"; - E1[E1["C"] = 2] = "C"; - E1[E1["D"] = 3] = "D"; - E1[E1["E"] = 4] = "E"; - E1[E1["F"] = 5] = "F"; +(function(E) { + E[E["A"] = 0] = "A"; + E[E["B"] = 1] = "B"; + E[E["C"] = 2] = "C"; + E[E["D"] = 3] = "D"; + E[E["E"] = 4] = "E"; + E[E["F"] = 5] = "F"; })(E || (E = { })); let x0; // 'a' | 'b' | 'c' diff --git a/crates/swc/tests/tsc-references/types/intersection/intersectionOfUnionOfUnitTypes/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/types/intersection/intersectionOfUnionOfUnitTypes/input.ts/es2015.2.minified/output.js index c36db5a9d35..fa1613981de 100644 --- a/crates/swc/tests/tsc-references/types/intersection/intersectionOfUnionOfUnitTypes/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/types/intersection/intersectionOfUnionOfUnitTypes/input.ts/es2015.2.minified/output.js @@ -1,3 +1,3 @@ -var E, E1; -(E1 = E || (E = { -}))[E1.A = 0] = "A", E1[E1.B = 1] = "B", E1[E1.C = 2] = "C", E1[E1.D = 3] = "D", E1[E1.E = 4] = "E", E1[E1.F = 5] = "F"; +var E, E; +(E = E || (E = { +}))[E.A = 0] = "A", E[E.B = 1] = "B", E[E.C = 2] = "C", E[E.D = 3] = "D", E[E.E = 4] = "E", E[E.F = 5] = "F"; diff --git a/crates/swc/tests/tsc-references/types/intersection/intersectionOfUnionOfUnitTypes/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/types/intersection/intersectionOfUnionOfUnitTypes/input.ts/es5.1.normal/output.js index bc87052f0e9..342ab87e926 100644 --- a/crates/swc/tests/tsc-references/types/intersection/intersectionOfUnionOfUnitTypes/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/types/intersection/intersectionOfUnionOfUnitTypes/input.ts/es5.1.normal/output.js @@ -1,12 +1,12 @@ var // @strict E; -(function(E1) { - E1[E1["A"] = 0] = "A"; - E1[E1["B"] = 1] = "B"; - E1[E1["C"] = 2] = "C"; - E1[E1["D"] = 3] = "D"; - E1[E1["E"] = 4] = "E"; - E1[E1["F"] = 5] = "F"; +(function(E) { + E[E["A"] = 0] = "A"; + E[E["B"] = 1] = "B"; + E[E["C"] = 2] = "C"; + E[E["D"] = 3] = "D"; + E[E["E"] = 4] = "E"; + E[E["F"] = 5] = "F"; })(E || (E = { })); var x0; // 'a' | 'b' | 'c' diff --git a/crates/swc/tests/tsc-references/types/intersection/intersectionOfUnionOfUnitTypes/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/types/intersection/intersectionOfUnionOfUnitTypes/input.ts/es5.2.minified/output.js index c36db5a9d35..fa1613981de 100644 --- a/crates/swc/tests/tsc-references/types/intersection/intersectionOfUnionOfUnitTypes/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/types/intersection/intersectionOfUnionOfUnitTypes/input.ts/es5.2.minified/output.js @@ -1,3 +1,3 @@ -var E, E1; -(E1 = E || (E = { -}))[E1.A = 0] = "A", E1[E1.B = 1] = "B", E1[E1.C = 2] = "C", E1[E1.D = 3] = "D", E1[E1.E = 4] = "E", E1[E1.F = 5] = "F"; +var E, E; +(E = E || (E = { +}))[E.A = 0] = "A", E[E.B = 1] = "B", E[E.C = 2] = "C", E[E.D = 3] = "D", E[E.E = 4] = "E", E[E.F = 5] = "F"; diff --git a/crates/swc/tests/tsc-references/types/keyof/keyofAndIndexedAccess/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/types/keyof/keyofAndIndexedAccess/input.ts/es2015.1.normal/output.js index 2db6b2ee048..80c8946002a 100644 --- a/crates/swc/tests/tsc-references/types/keyof/keyofAndIndexedAccess/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/types/keyof/keyofAndIndexedAccess/input.ts/es2015.1.normal/output.js @@ -9,10 +9,10 @@ class Item { class Options { } var E; -(function(E1) { - E1[E1["A"] = 0] = "A"; - E1[E1["B"] = 1] = "B"; - E1[E1["C"] = 2] = "C"; +(function(E) { + E[E["A"] = 0] = "A"; + E[E["B"] = 1] = "B"; + E[E["C"] = 2] = "C"; })(E || (E = { })); function getProperty(obj, key) { @@ -422,9 +422,9 @@ function f3(t, k, tk) { } } var Flag; -(function(Flag1) { - Flag1["FLAG_1"] = "flag_1"; - Flag1["FLAG_2"] = "flag_2"; +(function(Flag) { + Flag["FLAG_1"] = "flag_1"; + Flag["FLAG_2"] = "flag_2"; })(Flag || (Flag = { })); function getFlagsFromSimpleRecord(record, flags) { diff --git a/crates/swc/tests/tsc-references/types/keyof/keyofAndIndexedAccess/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/types/keyof/keyofAndIndexedAccess/input.ts/es2015.2.minified/output.js index 123ff70002d..5a0f716232e 100644 --- a/crates/swc/tests/tsc-references/types/keyof/keyofAndIndexedAccess/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/types/keyof/keyofAndIndexedAccess/input.ts/es2015.2.minified/output.js @@ -1,5 +1,5 @@ -var E, E1, Flag, Flag1; -(E = E1 || (E1 = { +var E, E, Flag, Flag; +(E = E || (E = { }))[E.A = 0] = "A", E[E.B = 1] = "B", E[E.C = 2] = "C", one(()=>{ }), on({ test: ()=>{ @@ -30,5 +30,5 @@ new class extends SampleClass { })); } }({ -}), (Flag1 = Flag || (Flag = { -})).FLAG_1 = "flag_1", Flag1.FLAG_2 = "flag_2"; +}), (Flag = Flag || (Flag = { +})).FLAG_1 = "flag_1", Flag.FLAG_2 = "flag_2"; diff --git a/crates/swc/tests/tsc-references/types/keyof/keyofAndIndexedAccess/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/types/keyof/keyofAndIndexedAccess/input.ts/es5.1.normal/output.js index 2a1d9fb54e0..05664480826 100644 --- a/crates/swc/tests/tsc-references/types/keyof/keyofAndIndexedAccess/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/types/keyof/keyofAndIndexedAccess/input.ts/es5.1.normal/output.js @@ -123,10 +123,10 @@ var Options = function Options() { _classCallCheck(this, Options); }; var E; -(function(E1) { - E1[E1["A"] = 0] = "A"; - E1[E1["B"] = 1] = "B"; - E1[E1["C"] = 2] = "C"; +(function(E) { + E[E["A"] = 0] = "A"; + E[E["B"] = 1] = "B"; + E[E["C"] = 2] = "C"; })(E || (E = { })); function getProperty(obj, key) { @@ -676,9 +676,9 @@ function f3(t, k, tk) { } } var Flag; -(function(Flag1) { - Flag1["FLAG_1"] = "flag_1"; - Flag1["FLAG_2"] = "flag_2"; +(function(Flag) { + Flag["FLAG_1"] = "flag_1"; + Flag["FLAG_2"] = "flag_2"; })(Flag || (Flag = { })); function getFlagsFromSimpleRecord(record, flags) { diff --git a/crates/swc/tests/tsc-references/types/keyof/keyofAndIndexedAccess/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/types/keyof/keyofAndIndexedAccess/input.ts/es5.2.minified/output.js index 21e3018ffc8..9360fbe1ab8 100644 --- a/crates/swc/tests/tsc-references/types/keyof/keyofAndIndexedAccess/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/types/keyof/keyofAndIndexedAccess/input.ts/es5.2.minified/output.js @@ -54,7 +54,7 @@ function _createSuper(Derived) { })(self); }; } -var Flag, E, Flag1, E1, Shape = function() { +var Flag, E, Flag, E, Shape = function() { "use strict"; _classCallCheck(this, Shape); }, TaggedShape = function(Shape1) { @@ -78,8 +78,8 @@ function getProperty(obj, key) { function setProperty(obj, key, value) { obj[key] = value; } -(E1 = E || (E = { -}))[E1.A = 0] = "A", E1[E1.B = 1] = "B", E1[E1.C = 2] = "C"; +(E = E || (E = { +}))[E.A = 0] = "A", E[E.B = 1] = "B", E[E.C = 2] = "C"; var Component = function() { "use strict"; function Component() { @@ -244,7 +244,7 @@ var A = function() { ]), AnotherSampleClass; }(SampleClass); new AnotherSampleClass({ -}), (Flag = Flag1 || (Flag1 = { +}), (Flag = Flag || (Flag = { })).FLAG_1 = "flag_1", Flag.FLAG_2 = "flag_2"; var Unbounded = function() { "use strict"; diff --git a/crates/swc/tests/tsc-references/types/literal/enumLiteralTypes1/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/types/literal/enumLiteralTypes1/input.ts/es2015.1.normal/output.js index 292d7da4967..4ecb56a618d 100644 --- a/crates/swc/tests/tsc-references/types/literal/enumLiteralTypes1/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/types/literal/enumLiteralTypes1/input.ts/es2015.1.normal/output.js @@ -1,8 +1,8 @@ var Choice; -(function(Choice1) { - Choice1[Choice1["Unknown"] = 0] = "Unknown"; - Choice1[Choice1["Yes"] = 1] = "Yes"; - Choice1[Choice1["No"] = 2] = "No"; +(function(Choice) { + Choice[Choice["Unknown"] = 0] = "Unknown"; + Choice[Choice["Yes"] = 1] = "Yes"; + Choice[Choice["No"] = 2] = "No"; })(Choice || (Choice = { })); function f1() { diff --git a/crates/swc/tests/tsc-references/types/literal/enumLiteralTypes1/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/types/literal/enumLiteralTypes1/input.ts/es2015.2.minified/output.js index dab587ffd5b..eb31f078dc0 100644 --- a/crates/swc/tests/tsc-references/types/literal/enumLiteralTypes1/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/types/literal/enumLiteralTypes1/input.ts/es2015.2.minified/output.js @@ -1,3 +1,3 @@ -var Choice, Choice1; -(Choice1 = Choice || (Choice = { -}))[Choice1.Unknown = 0] = "Unknown", Choice1[Choice1.Yes = 1] = "Yes", Choice1[Choice1.No = 2] = "No"; +var Choice, Choice; +(Choice = Choice || (Choice = { +}))[Choice.Unknown = 0] = "Unknown", Choice[Choice.Yes = 1] = "Yes", Choice[Choice.No = 2] = "No"; diff --git a/crates/swc/tests/tsc-references/types/literal/enumLiteralTypes1/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/types/literal/enumLiteralTypes1/input.ts/es5.1.normal/output.js index 292d7da4967..4ecb56a618d 100644 --- a/crates/swc/tests/tsc-references/types/literal/enumLiteralTypes1/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/types/literal/enumLiteralTypes1/input.ts/es5.1.normal/output.js @@ -1,8 +1,8 @@ var Choice; -(function(Choice1) { - Choice1[Choice1["Unknown"] = 0] = "Unknown"; - Choice1[Choice1["Yes"] = 1] = "Yes"; - Choice1[Choice1["No"] = 2] = "No"; +(function(Choice) { + Choice[Choice["Unknown"] = 0] = "Unknown"; + Choice[Choice["Yes"] = 1] = "Yes"; + Choice[Choice["No"] = 2] = "No"; })(Choice || (Choice = { })); function f1() { diff --git a/crates/swc/tests/tsc-references/types/literal/enumLiteralTypes1/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/types/literal/enumLiteralTypes1/input.ts/es5.2.minified/output.js index dab587ffd5b..eb31f078dc0 100644 --- a/crates/swc/tests/tsc-references/types/literal/enumLiteralTypes1/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/types/literal/enumLiteralTypes1/input.ts/es5.2.minified/output.js @@ -1,3 +1,3 @@ -var Choice, Choice1; -(Choice1 = Choice || (Choice = { -}))[Choice1.Unknown = 0] = "Unknown", Choice1[Choice1.Yes = 1] = "Yes", Choice1[Choice1.No = 2] = "No"; +var Choice, Choice; +(Choice = Choice || (Choice = { +}))[Choice.Unknown = 0] = "Unknown", Choice[Choice.Yes = 1] = "Yes", Choice[Choice.No = 2] = "No"; diff --git a/crates/swc/tests/tsc-references/types/literal/enumLiteralTypes2/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/types/literal/enumLiteralTypes2/input.ts/es2015.1.normal/output.js index 1230b425641..05ed7049006 100644 --- a/crates/swc/tests/tsc-references/types/literal/enumLiteralTypes2/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/types/literal/enumLiteralTypes2/input.ts/es2015.1.normal/output.js @@ -1,9 +1,9 @@ var // @strictNullChecks: true Choice; -(function(Choice1) { - Choice1[Choice1["Unknown"] = 0] = "Unknown"; - Choice1[Choice1["Yes"] = 1] = "Yes"; - Choice1[Choice1["No"] = 2] = "No"; +(function(Choice) { + Choice[Choice["Unknown"] = 0] = "Unknown"; + Choice[Choice["Yes"] = 1] = "Yes"; + Choice[Choice["No"] = 2] = "No"; })(Choice || (Choice = { })); function f1() { diff --git a/crates/swc/tests/tsc-references/types/literal/enumLiteralTypes2/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/types/literal/enumLiteralTypes2/input.ts/es2015.2.minified/output.js index dab587ffd5b..eb31f078dc0 100644 --- a/crates/swc/tests/tsc-references/types/literal/enumLiteralTypes2/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/types/literal/enumLiteralTypes2/input.ts/es2015.2.minified/output.js @@ -1,3 +1,3 @@ -var Choice, Choice1; -(Choice1 = Choice || (Choice = { -}))[Choice1.Unknown = 0] = "Unknown", Choice1[Choice1.Yes = 1] = "Yes", Choice1[Choice1.No = 2] = "No"; +var Choice, Choice; +(Choice = Choice || (Choice = { +}))[Choice.Unknown = 0] = "Unknown", Choice[Choice.Yes = 1] = "Yes", Choice[Choice.No = 2] = "No"; diff --git a/crates/swc/tests/tsc-references/types/literal/enumLiteralTypes2/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/types/literal/enumLiteralTypes2/input.ts/es5.1.normal/output.js index 1230b425641..05ed7049006 100644 --- a/crates/swc/tests/tsc-references/types/literal/enumLiteralTypes2/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/types/literal/enumLiteralTypes2/input.ts/es5.1.normal/output.js @@ -1,9 +1,9 @@ var // @strictNullChecks: true Choice; -(function(Choice1) { - Choice1[Choice1["Unknown"] = 0] = "Unknown"; - Choice1[Choice1["Yes"] = 1] = "Yes"; - Choice1[Choice1["No"] = 2] = "No"; +(function(Choice) { + Choice[Choice["Unknown"] = 0] = "Unknown"; + Choice[Choice["Yes"] = 1] = "Yes"; + Choice[Choice["No"] = 2] = "No"; })(Choice || (Choice = { })); function f1() { diff --git a/crates/swc/tests/tsc-references/types/literal/enumLiteralTypes2/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/types/literal/enumLiteralTypes2/input.ts/es5.2.minified/output.js index dab587ffd5b..eb31f078dc0 100644 --- a/crates/swc/tests/tsc-references/types/literal/enumLiteralTypes2/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/types/literal/enumLiteralTypes2/input.ts/es5.2.minified/output.js @@ -1,3 +1,3 @@ -var Choice, Choice1; -(Choice1 = Choice || (Choice = { -}))[Choice1.Unknown = 0] = "Unknown", Choice1[Choice1.Yes = 1] = "Yes", Choice1[Choice1.No = 2] = "No"; +var Choice, Choice; +(Choice = Choice || (Choice = { +}))[Choice.Unknown = 0] = "Unknown", Choice[Choice.Yes = 1] = "Yes", Choice[Choice.No = 2] = "No"; diff --git a/crates/swc/tests/tsc-references/types/literal/enumLiteralTypes3/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/types/literal/enumLiteralTypes3/input.ts/es2015.1.normal/output.js index 0421f2214a5..0d55eba5f8a 100644 --- a/crates/swc/tests/tsc-references/types/literal/enumLiteralTypes3/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/types/literal/enumLiteralTypes3/input.ts/es2015.1.normal/output.js @@ -1,8 +1,8 @@ var Choice; -(function(Choice1) { - Choice1[Choice1["Unknown"] = 0] = "Unknown"; - Choice1[Choice1["Yes"] = 1] = "Yes"; - Choice1[Choice1["No"] = 2] = "No"; +(function(Choice) { + Choice[Choice["Unknown"] = 0] = "Unknown"; + Choice[Choice["Yes"] = 1] = "Yes"; + Choice[Choice["No"] = 2] = "No"; })(Choice || (Choice = { })); function f1(a, b, c, d) { diff --git a/crates/swc/tests/tsc-references/types/literal/enumLiteralTypes3/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/types/literal/enumLiteralTypes3/input.ts/es2015.2.minified/output.js index dab587ffd5b..eb31f078dc0 100644 --- a/crates/swc/tests/tsc-references/types/literal/enumLiteralTypes3/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/types/literal/enumLiteralTypes3/input.ts/es2015.2.minified/output.js @@ -1,3 +1,3 @@ -var Choice, Choice1; -(Choice1 = Choice || (Choice = { -}))[Choice1.Unknown = 0] = "Unknown", Choice1[Choice1.Yes = 1] = "Yes", Choice1[Choice1.No = 2] = "No"; +var Choice, Choice; +(Choice = Choice || (Choice = { +}))[Choice.Unknown = 0] = "Unknown", Choice[Choice.Yes = 1] = "Yes", Choice[Choice.No = 2] = "No"; diff --git a/crates/swc/tests/tsc-references/types/literal/enumLiteralTypes3/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/types/literal/enumLiteralTypes3/input.ts/es5.1.normal/output.js index 0421f2214a5..0d55eba5f8a 100644 --- a/crates/swc/tests/tsc-references/types/literal/enumLiteralTypes3/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/types/literal/enumLiteralTypes3/input.ts/es5.1.normal/output.js @@ -1,8 +1,8 @@ var Choice; -(function(Choice1) { - Choice1[Choice1["Unknown"] = 0] = "Unknown"; - Choice1[Choice1["Yes"] = 1] = "Yes"; - Choice1[Choice1["No"] = 2] = "No"; +(function(Choice) { + Choice[Choice["Unknown"] = 0] = "Unknown"; + Choice[Choice["Yes"] = 1] = "Yes"; + Choice[Choice["No"] = 2] = "No"; })(Choice || (Choice = { })); function f1(a, b, c, d) { diff --git a/crates/swc/tests/tsc-references/types/literal/enumLiteralTypes3/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/types/literal/enumLiteralTypes3/input.ts/es5.2.minified/output.js index dab587ffd5b..eb31f078dc0 100644 --- a/crates/swc/tests/tsc-references/types/literal/enumLiteralTypes3/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/types/literal/enumLiteralTypes3/input.ts/es5.2.minified/output.js @@ -1,3 +1,3 @@ -var Choice, Choice1; -(Choice1 = Choice || (Choice = { -}))[Choice1.Unknown = 0] = "Unknown", Choice1[Choice1.Yes = 1] = "Yes", Choice1[Choice1.No = 2] = "No"; +var Choice, Choice; +(Choice = Choice || (Choice = { +}))[Choice.Unknown = 0] = "Unknown", Choice[Choice.Yes = 1] = "Yes", Choice[Choice.No = 2] = "No"; diff --git a/crates/swc/tests/tsc-references/types/literal/literalTypeWidening/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/types/literal/literalTypeWidening/input.ts/es2015.1.normal/output.js index b119ca73b70..a30759fccca 100644 --- a/crates/swc/tests/tsc-references/types/literal/literalTypeWidening/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/types/literal/literalTypeWidening/input.ts/es2015.1.normal/output.js @@ -168,9 +168,9 @@ function test(obj) { }, rest); } var E; -(function(E1) { - E1[E1["A"] = 0] = "A"; - E1[E1["B"] = 1] = "B"; +(function(E) { + E[E["A"] = 0] = "A"; + E[E["B"] = 1] = "B"; })(E || (E = { })); const a = f(E.A); diff --git a/crates/swc/tests/tsc-references/types/literal/literalTypeWidening/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/types/literal/literalTypeWidening/input.ts/es2015.2.minified/output.js index c2b97029287..6f309f919cf 100644 --- a/crates/swc/tests/tsc-references/types/literal/literalTypeWidening/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/types/literal/literalTypeWidening/input.ts/es2015.2.minified/output.js @@ -1,4 +1,4 @@ -var E, E1; +var E, E; export function Set(...keys1) { const result = { }; @@ -13,5 +13,5 @@ export const langCodes = keys(langCodeSet); langCodes.map((code)=>({ code }) -), (E1 = E || (E = { -}))[E1.A = 0] = "A", E1[E1.B = 1] = "B", f(E.A); +), (E = E || (E = { +}))[E.A = 0] = "A", E[E.B = 1] = "B", f(E.A); diff --git a/crates/swc/tests/tsc-references/types/literal/literalTypeWidening/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/types/literal/literalTypeWidening/input.ts/es5.1.normal/output.js index 03cbb344943..02e2b372a25 100644 --- a/crates/swc/tests/tsc-references/types/literal/literalTypeWidening/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/types/literal/literalTypeWidening/input.ts/es5.1.normal/output.js @@ -173,9 +173,9 @@ function test(obj) { }, rest); } var E; -(function(E1) { - E1[E1["A"] = 0] = "A"; - E1[E1["B"] = 1] = "B"; +(function(E) { + E[E["A"] = 0] = "A"; + E[E["B"] = 1] = "B"; })(E || (E = { })); var a = f(E.A); diff --git a/crates/swc/tests/tsc-references/types/literal/literalTypeWidening/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/types/literal/literalTypeWidening/input.ts/es5.2.minified/output.js index 6ddfe64bd5d..638ceed53d6 100644 --- a/crates/swc/tests/tsc-references/types/literal/literalTypeWidening/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/types/literal/literalTypeWidening/input.ts/es5.2.minified/output.js @@ -1,4 +1,4 @@ -var E, E1; +var E, E; export function Set() { for(var _len = arguments.length, keys1 = new Array(_len), _key = 0; _key < _len; _key++)keys1[_key] = arguments[_key]; var result = { @@ -16,5 +16,5 @@ langCodes.map(function(code) { return { code: code }; -}), (E = E1 || (E1 = { -}))[E.A = 0] = "A", E[E.B = 1] = "B", f(E1.A); +}), (E = E || (E = { +}))[E.A = 0] = "A", E[E.B = 1] = "B", f(E.A); diff --git a/crates/swc/tests/tsc-references/types/literal/literalTypes2/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/types/literal/literalTypes2/input.ts/es2015.1.normal/output.js index af0ca4019f1..dc242d433a1 100644 --- a/crates/swc/tests/tsc-references/types/literal/literalTypes2/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/types/literal/literalTypes2/input.ts/es2015.1.normal/output.js @@ -1,8 +1,8 @@ var E; -(function(E1) { - E1[E1["A"] = 0] = "A"; - E1[E1["B"] = 1] = "B"; - E1[E1["C"] = 2] = "C"; +(function(E) { + E[E["A"] = 0] = "A"; + E[E["B"] = 1] = "B"; + E[E["C"] = 2] = "C"; })(E || (E = { })); let cond; diff --git a/crates/swc/tests/tsc-references/types/literal/literalTypes2/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/types/literal/literalTypes2/input.ts/es2015.2.minified/output.js index 8b15b6d2758..2a4ce99f2a7 100644 --- a/crates/swc/tests/tsc-references/types/literal/literalTypes2/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/types/literal/literalTypes2/input.ts/es2015.2.minified/output.js @@ -1,6 +1,6 @@ -var E, E1; -(E1 = E || (E = { -}))[E1.A = 0] = "A", E1[E1.B = 1] = "B", E1[E1.C = 2] = "C"; +var E, E; +(E = E || (E = { +}))[E.A = 0] = "A", E[E.B = 1] = "B", E[E.C = 2] = "C"; const a = [ 1, 2 diff --git a/crates/swc/tests/tsc-references/types/literal/literalTypes2/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/types/literal/literalTypes2/input.ts/es5.1.normal/output.js index 90aa556f6df..d29572b0f83 100644 --- a/crates/swc/tests/tsc-references/types/literal/literalTypes2/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/types/literal/literalTypes2/input.ts/es5.1.normal/output.js @@ -18,10 +18,10 @@ function _createClass(Constructor, protoProps, staticProps) { return Constructor; } var E; -(function(E1) { - E1[E1["A"] = 0] = "A"; - E1[E1["B"] = 1] = "B"; - E1[E1["C"] = 2] = "C"; +(function(E) { + E[E["A"] = 0] = "A"; + E[E["B"] = 1] = "B"; + E[E["C"] = 2] = "C"; })(E || (E = { })); var cond; diff --git a/crates/swc/tests/tsc-references/types/literal/literalTypes2/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/types/literal/literalTypes2/input.ts/es5.2.minified/output.js index a1d621f01f8..faea7e352b3 100644 --- a/crates/swc/tests/tsc-references/types/literal/literalTypes2/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/types/literal/literalTypes2/input.ts/es5.2.minified/output.js @@ -7,11 +7,11 @@ function _defineProperties(target, props) { descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor); } } -(E = E1 || (E1 = { +(E = E || (E = { }))[E.A = 0] = "A", E[E.B = 1] = "B", E[E.C = 2] = "C"; -var E, E1, cond, C1 = function() { +var E, E, cond, C1 = function() { "use strict"; - _classCallCheck(this, C1), this.x1 = 1, this.x2 = -123, this.x3 = 7, this.x4 = "abc", this.x5 = "", this.x6 = "abcdef", this.x7 = !0, this.x8 = E1.A, this.c1 = 1, this.c2 = -123, this.c3 = 7, this.c4 = "abc", this.c5 = "", this.c6 = "abcdef", this.c7 = !0, this.c8 = E1.A; + _classCallCheck(this, C1), this.x1 = 1, this.x2 = -123, this.x3 = 7, this.x4 = "abc", this.x5 = "", this.x6 = "abcdef", this.x7 = !0, this.x8 = E.A, this.c1 = 1, this.c2 = -123, this.c3 = 7, this.c4 = "abc", this.c5 = "", this.c6 = "abcdef", this.c7 = !0, this.c8 = E.A; }, C2 = function() { "use strict"; var Constructor, protoProps, staticProps; diff --git a/crates/swc/tests/tsc-references/types/literal/stringEnumLiteralTypes1/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/types/literal/stringEnumLiteralTypes1/input.ts/es2015.1.normal/output.js index 40357a49329..671a75aa065 100644 --- a/crates/swc/tests/tsc-references/types/literal/stringEnumLiteralTypes1/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/types/literal/stringEnumLiteralTypes1/input.ts/es2015.1.normal/output.js @@ -1,8 +1,8 @@ var Choice; -(function(Choice1) { - Choice1["Unknown"] = ""; - Choice1["Yes"] = "yes"; - Choice1["No"] = "no"; +(function(Choice) { + Choice["Unknown"] = ""; + Choice["Yes"] = "yes"; + Choice["No"] = "no"; })(Choice || (Choice = { })); function f1() { diff --git a/crates/swc/tests/tsc-references/types/literal/stringEnumLiteralTypes1/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/types/literal/stringEnumLiteralTypes1/input.ts/es2015.2.minified/output.js index ffc4ae4446d..e06d6e85103 100644 --- a/crates/swc/tests/tsc-references/types/literal/stringEnumLiteralTypes1/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/types/literal/stringEnumLiteralTypes1/input.ts/es2015.2.minified/output.js @@ -1,3 +1,3 @@ -var Choice, Choice1; -(Choice1 = Choice || (Choice = { -})).Unknown = "", Choice1.Yes = "yes", Choice1.No = "no"; +var Choice, Choice; +(Choice = Choice || (Choice = { +})).Unknown = "", Choice.Yes = "yes", Choice.No = "no"; diff --git a/crates/swc/tests/tsc-references/types/literal/stringEnumLiteralTypes1/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/types/literal/stringEnumLiteralTypes1/input.ts/es5.1.normal/output.js index 40357a49329..671a75aa065 100644 --- a/crates/swc/tests/tsc-references/types/literal/stringEnumLiteralTypes1/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/types/literal/stringEnumLiteralTypes1/input.ts/es5.1.normal/output.js @@ -1,8 +1,8 @@ var Choice; -(function(Choice1) { - Choice1["Unknown"] = ""; - Choice1["Yes"] = "yes"; - Choice1["No"] = "no"; +(function(Choice) { + Choice["Unknown"] = ""; + Choice["Yes"] = "yes"; + Choice["No"] = "no"; })(Choice || (Choice = { })); function f1() { diff --git a/crates/swc/tests/tsc-references/types/literal/stringEnumLiteralTypes1/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/types/literal/stringEnumLiteralTypes1/input.ts/es5.2.minified/output.js index ffc4ae4446d..e06d6e85103 100644 --- a/crates/swc/tests/tsc-references/types/literal/stringEnumLiteralTypes1/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/types/literal/stringEnumLiteralTypes1/input.ts/es5.2.minified/output.js @@ -1,3 +1,3 @@ -var Choice, Choice1; -(Choice1 = Choice || (Choice = { -})).Unknown = "", Choice1.Yes = "yes", Choice1.No = "no"; +var Choice, Choice; +(Choice = Choice || (Choice = { +})).Unknown = "", Choice.Yes = "yes", Choice.No = "no"; diff --git a/crates/swc/tests/tsc-references/types/literal/stringEnumLiteralTypes2/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/types/literal/stringEnumLiteralTypes2/input.ts/es2015.1.normal/output.js index 504d107439a..b98fc097717 100644 --- a/crates/swc/tests/tsc-references/types/literal/stringEnumLiteralTypes2/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/types/literal/stringEnumLiteralTypes2/input.ts/es2015.1.normal/output.js @@ -1,9 +1,9 @@ var // @strictNullChecks: true Choice; -(function(Choice1) { - Choice1["Unknown"] = ""; - Choice1["Yes"] = "yes"; - Choice1["No"] = "no"; +(function(Choice) { + Choice["Unknown"] = ""; + Choice["Yes"] = "yes"; + Choice["No"] = "no"; })(Choice || (Choice = { })); function f1() { diff --git a/crates/swc/tests/tsc-references/types/literal/stringEnumLiteralTypes2/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/types/literal/stringEnumLiteralTypes2/input.ts/es2015.2.minified/output.js index ffc4ae4446d..e06d6e85103 100644 --- a/crates/swc/tests/tsc-references/types/literal/stringEnumLiteralTypes2/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/types/literal/stringEnumLiteralTypes2/input.ts/es2015.2.minified/output.js @@ -1,3 +1,3 @@ -var Choice, Choice1; -(Choice1 = Choice || (Choice = { -})).Unknown = "", Choice1.Yes = "yes", Choice1.No = "no"; +var Choice, Choice; +(Choice = Choice || (Choice = { +})).Unknown = "", Choice.Yes = "yes", Choice.No = "no"; diff --git a/crates/swc/tests/tsc-references/types/literal/stringEnumLiteralTypes2/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/types/literal/stringEnumLiteralTypes2/input.ts/es5.1.normal/output.js index 504d107439a..b98fc097717 100644 --- a/crates/swc/tests/tsc-references/types/literal/stringEnumLiteralTypes2/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/types/literal/stringEnumLiteralTypes2/input.ts/es5.1.normal/output.js @@ -1,9 +1,9 @@ var // @strictNullChecks: true Choice; -(function(Choice1) { - Choice1["Unknown"] = ""; - Choice1["Yes"] = "yes"; - Choice1["No"] = "no"; +(function(Choice) { + Choice["Unknown"] = ""; + Choice["Yes"] = "yes"; + Choice["No"] = "no"; })(Choice || (Choice = { })); function f1() { diff --git a/crates/swc/tests/tsc-references/types/literal/stringEnumLiteralTypes2/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/types/literal/stringEnumLiteralTypes2/input.ts/es5.2.minified/output.js index ffc4ae4446d..e06d6e85103 100644 --- a/crates/swc/tests/tsc-references/types/literal/stringEnumLiteralTypes2/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/types/literal/stringEnumLiteralTypes2/input.ts/es5.2.minified/output.js @@ -1,3 +1,3 @@ -var Choice, Choice1; -(Choice1 = Choice || (Choice = { -})).Unknown = "", Choice1.Yes = "yes", Choice1.No = "no"; +var Choice, Choice; +(Choice = Choice || (Choice = { +})).Unknown = "", Choice.Yes = "yes", Choice.No = "no"; diff --git a/crates/swc/tests/tsc-references/types/literal/stringEnumLiteralTypes3/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/types/literal/stringEnumLiteralTypes3/input.ts/es2015.1.normal/output.js index 226922cee68..e4437f65629 100644 --- a/crates/swc/tests/tsc-references/types/literal/stringEnumLiteralTypes3/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/types/literal/stringEnumLiteralTypes3/input.ts/es2015.1.normal/output.js @@ -1,8 +1,8 @@ var Choice; -(function(Choice1) { - Choice1["Unknown"] = ""; - Choice1["Yes"] = "yes"; - Choice1["No"] = "no"; +(function(Choice) { + Choice["Unknown"] = ""; + Choice["Yes"] = "yes"; + Choice["No"] = "no"; })(Choice || (Choice = { })); function f1(a, b, c, d) { diff --git a/crates/swc/tests/tsc-references/types/literal/stringEnumLiteralTypes3/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/types/literal/stringEnumLiteralTypes3/input.ts/es2015.2.minified/output.js index ffc4ae4446d..e06d6e85103 100644 --- a/crates/swc/tests/tsc-references/types/literal/stringEnumLiteralTypes3/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/types/literal/stringEnumLiteralTypes3/input.ts/es2015.2.minified/output.js @@ -1,3 +1,3 @@ -var Choice, Choice1; -(Choice1 = Choice || (Choice = { -})).Unknown = "", Choice1.Yes = "yes", Choice1.No = "no"; +var Choice, Choice; +(Choice = Choice || (Choice = { +})).Unknown = "", Choice.Yes = "yes", Choice.No = "no"; diff --git a/crates/swc/tests/tsc-references/types/literal/stringEnumLiteralTypes3/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/types/literal/stringEnumLiteralTypes3/input.ts/es5.1.normal/output.js index 226922cee68..e4437f65629 100644 --- a/crates/swc/tests/tsc-references/types/literal/stringEnumLiteralTypes3/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/types/literal/stringEnumLiteralTypes3/input.ts/es5.1.normal/output.js @@ -1,8 +1,8 @@ var Choice; -(function(Choice1) { - Choice1["Unknown"] = ""; - Choice1["Yes"] = "yes"; - Choice1["No"] = "no"; +(function(Choice) { + Choice["Unknown"] = ""; + Choice["Yes"] = "yes"; + Choice["No"] = "no"; })(Choice || (Choice = { })); function f1(a, b, c, d) { diff --git a/crates/swc/tests/tsc-references/types/literal/stringEnumLiteralTypes3/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/types/literal/stringEnumLiteralTypes3/input.ts/es5.2.minified/output.js index ffc4ae4446d..e06d6e85103 100644 --- a/crates/swc/tests/tsc-references/types/literal/stringEnumLiteralTypes3/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/types/literal/stringEnumLiteralTypes3/input.ts/es5.2.minified/output.js @@ -1,3 +1,3 @@ -var Choice, Choice1; -(Choice1 = Choice || (Choice = { -})).Unknown = "", Choice1.Yes = "yes", Choice1.No = "no"; +var Choice, Choice; +(Choice = Choice || (Choice = { +})).Unknown = "", Choice.Yes = "yes", Choice.No = "no"; diff --git a/crates/swc/tests/tsc-references/types/localTypes/localTypes1/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/types/localTypes/localTypes1/input.ts/es2015.1.normal/output.js index 7aa8c8406f0..624212aa052 100644 --- a/crates/swc/tests/tsc-references/types/localTypes/localTypes1/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/types/localTypes/localTypes1/input.ts/es2015.1.normal/output.js @@ -1,5 +1,6 @@ // @target: es5 function f1() { + let E; (function(E) { E[E["A"] = 0] = "A"; E[E["B"] = 1] = "B"; @@ -17,6 +18,7 @@ function f1() { } function f2() { function g() { + let E; (function(E) { E[E["A"] = 0] = "A"; E[E["B"] = 1] = "B"; @@ -36,6 +38,7 @@ function f2() { } function f3(b) { if (true) { + let E; (function(E) { E[E["A"] = 0] = "A"; E[E["B"] = 1] = "B"; @@ -65,6 +68,7 @@ function f3(b) { } function f5() { var z1 = function() { + let E; (function(E) { E[E["A"] = 0] = "A"; E[E["B"] = 1] = "B"; @@ -76,6 +80,7 @@ function f5() { return new C(); }; var z2 = ()=>{ + let E; (function(E) { E[E["A"] = 0] = "A"; E[E["B"] = 1] = "B"; @@ -89,6 +94,7 @@ function f5() { } class A { m() { + let E; (function(E) { E[E["A"] = 0] = "A"; E[E["B"] = 1] = "B"; @@ -100,6 +106,7 @@ class A { return new C(); } get p() { + let E; (function(E) { E[E["A"] = 0] = "A"; E[E["B"] = 1] = "B"; @@ -111,12 +118,12 @@ class A { return new C(); } constructor(){ - var E1; + let E; (function(E) { E[E["A"] = 0] = "A"; E[E["B"] = 1] = "B"; E[E["C"] = 2] = "C"; - })(E1 || (E1 = { + })(E || (E = { })); class C { } diff --git a/crates/swc/tests/tsc-references/types/localTypes/localTypes1/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/types/localTypes/localTypes1/input.ts/es5.1.normal/output.js index 6566d4fe886..6d61cd6788a 100644 --- a/crates/swc/tests/tsc-references/types/localTypes/localTypes1/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/types/localTypes/localTypes1/input.ts/es5.1.normal/output.js @@ -85,6 +85,7 @@ function _createSuper(Derived) { } // @target: es5 function f1() { + var E; (function(E) { E[E["A"] = 0] = "A"; E[E["B"] = 1] = "B"; @@ -104,6 +105,7 @@ function f1() { } function f2() { var g = function g() { + var E; (function(E) { E[E["A"] = 0] = "A"; E[E["B"] = 1] = "B"; @@ -125,6 +127,7 @@ function f2() { } function f3(b) { if (true) { + var E; (function(E) { E[E["A"] = 0] = "A"; E[E["B"] = 1] = "B"; @@ -158,6 +161,7 @@ function f3(b) { } function f5() { var z1 = function z1() { + var E; (function(E) { E[E["A"] = 0] = "A"; E[E["B"] = 1] = "B"; @@ -171,6 +175,7 @@ function f5() { return new C(); }; var z2 = function() { + var E; (function(E) { E[E["A"] = 0] = "A"; E[E["B"] = 1] = "B"; @@ -188,12 +193,12 @@ var A = /*#__PURE__*/ function() { "use strict"; function A() { _classCallCheck(this, A); - var E1; + var E; (function(E) { E[E["A"] = 0] = "A"; E[E["B"] = 1] = "B"; E[E["C"] = 2] = "C"; - })(E1 || (E1 = { + })(E || (E = { })); var C = function C() { _classCallCheck(this, C); @@ -203,6 +208,7 @@ var A = /*#__PURE__*/ function() { { key: "m", value: function m() { + var E; (function(E) { E[E["A"] = 0] = "A"; E[E["B"] = 1] = "B"; @@ -218,6 +224,7 @@ var A = /*#__PURE__*/ function() { { key: "p", get: function get() { + var E; (function(E) { E[E["A"] = 0] = "A"; E[E["B"] = 1] = "B"; diff --git a/crates/swc/tests/tsc-references/types/localTypes/localTypes1/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/types/localTypes/localTypes1/input.ts/es5.2.minified/output.js index 61a7a638dae..933f5a4ec4b 100644 --- a/crates/swc/tests/tsc-references/types/localTypes/localTypes1/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/types/localTypes/localTypes1/input.ts/es5.2.minified/output.js @@ -22,9 +22,9 @@ var A = function() { var Constructor, protoProps, staticProps; function A() { var E; - _classCallCheck(this, A), (E = E1 || (E1 = { + _classCallCheck(this, A), (E = E || (E = { }))[E.A = 0] = "A", E[E.B = 1] = "B", E[E.C = 2] = "C"; - var E1, C = function() { + var E, C = function() { _classCallCheck(this, C); }; } @@ -32,9 +32,9 @@ var A = function() { { key: "m", value: function() { - var E2; - (E2 = E || (E = { - }))[E2.A = 0] = "A", E2[E2.B = 1] = "B", E2[E2.C = 2] = "C"; + var E, E; + (E = E || (E = { + }))[E.A = 0] = "A", E[E.B = 1] = "B", E[E.C = 2] = "C"; var C = function() { _classCallCheck(this, C); }; @@ -44,9 +44,9 @@ var A = function() { { key: "p", get: function() { - var E3; - (E3 = E || (E = { - }))[E3.A = 0] = "A", E3[E3.B = 1] = "B", E3[E3.C = 2] = "C"; + var E, E; + (E = E || (E = { + }))[E.A = 0] = "A", E[E.B = 1] = "B", E[E.C = 2] = "C"; var C = function() { _classCallCheck(this, C); }; diff --git a/crates/swc/tests/tsc-references/types/mapped/mappedTypeOverlappingStringEnumKeys/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/types/mapped/mappedTypeOverlappingStringEnumKeys/input.ts/es2015.1.normal/output.js index 6550c6c12f9..06bd6aa230e 100644 --- a/crates/swc/tests/tsc-references/types/mapped/mappedTypeOverlappingStringEnumKeys/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/types/mapped/mappedTypeOverlappingStringEnumKeys/input.ts/es2015.1.normal/output.js @@ -1,13 +1,13 @@ var // #37859 TerrestrialAnimalTypes; -(function(TerrestrialAnimalTypes1) { - TerrestrialAnimalTypes1["CAT"] = "cat"; - TerrestrialAnimalTypes1["DOG"] = "dog"; +(function(TerrestrialAnimalTypes) { + TerrestrialAnimalTypes["CAT"] = "cat"; + TerrestrialAnimalTypes["DOG"] = "dog"; })(TerrestrialAnimalTypes || (TerrestrialAnimalTypes = { })); var AlienAnimalTypes; -(function(AlienAnimalTypes1) { - AlienAnimalTypes1["CAT"] = "cat"; +(function(AlienAnimalTypes) { + AlienAnimalTypes["CAT"] = "cat"; })(AlienAnimalTypes || (AlienAnimalTypes = { })); const catMap = { diff --git a/crates/swc/tests/tsc-references/types/mapped/mappedTypeOverlappingStringEnumKeys/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/types/mapped/mappedTypeOverlappingStringEnumKeys/input.ts/es2015.2.minified/output.js index f47d8a8f592..377ac6bacea 100644 --- a/crates/swc/tests/tsc-references/types/mapped/mappedTypeOverlappingStringEnumKeys/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/types/mapped/mappedTypeOverlappingStringEnumKeys/input.ts/es2015.2.minified/output.js @@ -1,4 +1,4 @@ -var TerrestrialAnimalTypes, AlienAnimalTypes, TerrestrialAnimalTypes1; -(TerrestrialAnimalTypes1 = TerrestrialAnimalTypes || (TerrestrialAnimalTypes = { -})).CAT = "cat", TerrestrialAnimalTypes1.DOG = "dog", (AlienAnimalTypes || (AlienAnimalTypes = { +var TerrestrialAnimalTypes, AlienAnimalTypes, TerrestrialAnimalTypes, AlienAnimalTypes; +(TerrestrialAnimalTypes = TerrestrialAnimalTypes || (TerrestrialAnimalTypes = { +})).CAT = "cat", TerrestrialAnimalTypes.DOG = "dog", (AlienAnimalTypes = AlienAnimalTypes || (AlienAnimalTypes = { })).CAT = "cat", TerrestrialAnimalTypes.CAT, AlienAnimalTypes.CAT; diff --git a/crates/swc/tests/tsc-references/types/mapped/mappedTypeOverlappingStringEnumKeys/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/types/mapped/mappedTypeOverlappingStringEnumKeys/input.ts/es5.1.normal/output.js index c0d06e18f2e..e7539ccc2d3 100644 --- a/crates/swc/tests/tsc-references/types/mapped/mappedTypeOverlappingStringEnumKeys/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/types/mapped/mappedTypeOverlappingStringEnumKeys/input.ts/es5.1.normal/output.js @@ -1,13 +1,13 @@ var // #37859 TerrestrialAnimalTypes; -(function(TerrestrialAnimalTypes1) { - TerrestrialAnimalTypes1["CAT"] = "cat"; - TerrestrialAnimalTypes1["DOG"] = "dog"; +(function(TerrestrialAnimalTypes) { + TerrestrialAnimalTypes["CAT"] = "cat"; + TerrestrialAnimalTypes["DOG"] = "dog"; })(TerrestrialAnimalTypes || (TerrestrialAnimalTypes = { })); var AlienAnimalTypes; -(function(AlienAnimalTypes1) { - AlienAnimalTypes1["CAT"] = "cat"; +(function(AlienAnimalTypes) { + AlienAnimalTypes["CAT"] = "cat"; })(AlienAnimalTypes || (AlienAnimalTypes = { })); var catMap = { diff --git a/crates/swc/tests/tsc-references/types/mapped/mappedTypeOverlappingStringEnumKeys/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/types/mapped/mappedTypeOverlappingStringEnumKeys/input.ts/es5.2.minified/output.js index 311834408c0..377ac6bacea 100644 --- a/crates/swc/tests/tsc-references/types/mapped/mappedTypeOverlappingStringEnumKeys/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/types/mapped/mappedTypeOverlappingStringEnumKeys/input.ts/es5.2.minified/output.js @@ -1,4 +1,4 @@ -var TerrestrialAnimalTypes, TerrestrialAnimalTypes1, AlienAnimalTypes; -(TerrestrialAnimalTypes = TerrestrialAnimalTypes1 || (TerrestrialAnimalTypes1 = { -})).CAT = "cat", TerrestrialAnimalTypes.DOG = "dog", (AlienAnimalTypes || (AlienAnimalTypes = { -})).CAT = "cat", TerrestrialAnimalTypes1.CAT, AlienAnimalTypes.CAT; +var TerrestrialAnimalTypes, AlienAnimalTypes, TerrestrialAnimalTypes, AlienAnimalTypes; +(TerrestrialAnimalTypes = TerrestrialAnimalTypes || (TerrestrialAnimalTypes = { +})).CAT = "cat", TerrestrialAnimalTypes.DOG = "dog", (AlienAnimalTypes = AlienAnimalTypes || (AlienAnimalTypes = { +})).CAT = "cat", TerrestrialAnimalTypes.CAT, AlienAnimalTypes.CAT; diff --git a/crates/swc/tests/tsc-references/types/objectTypeLiteral/callSignatures/callSignatureWithoutReturnTypeAnnotationInference/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/types/objectTypeLiteral/callSignatures/callSignatureWithoutReturnTypeAnnotationInference/input.ts/es2015.1.normal/output.js index 104e695d6e1..cba45d96fb0 100644 --- a/crates/swc/tests/tsc-references/types/objectTypeLiteral/callSignatures/callSignatureWithoutReturnTypeAnnotationInference/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/types/objectTypeLiteral/callSignatures/callSignatureWithoutReturnTypeAnnotationInference/input.ts/es2015.1.normal/output.js @@ -98,12 +98,12 @@ function foo14() { } var r14 = foo14(); var e1; -(function(e11) { - e11[e11["A"] = 0] = "A"; +(function(e1) { + e1[e1["A"] = 0] = "A"; })(e1 || (e1 = { })); -(function(e12) { - e12.y = 1; +(function(e1) { + e1.y = 1; })(e1 || (e1 = { })); function foo15() { diff --git a/crates/swc/tests/tsc-references/types/objectTypeLiteral/callSignatures/callSignatureWithoutReturnTypeAnnotationInference/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/types/objectTypeLiteral/callSignatures/callSignatureWithoutReturnTypeAnnotationInference/input.ts/es2015.2.minified/output.js index a700deed583..77359120743 100644 --- a/crates/swc/tests/tsc-references/types/objectTypeLiteral/callSignatures/callSignatureWithoutReturnTypeAnnotationInference/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/types/objectTypeLiteral/callSignatures/callSignatureWithoutReturnTypeAnnotationInference/input.ts/es2015.2.minified/output.js @@ -1,4 +1,4 @@ -var M, e1, M1, e11; +var M, e1, M1, e1; function foo3() { return foo3(); } @@ -20,6 +20,6 @@ class c1 { } } (c1 || (c1 = { -})).x = 1, (e11 = e1 || (e1 = { -}))[e11.A = 0] = "A", (e1 || (e1 = { +})).x = 1, (e1 = e1 || (e1 = { +}))[e1.A = 0] = "A", (e1 || (e1 = { })).y = 1; diff --git a/crates/swc/tests/tsc-references/types/objectTypeLiteral/callSignatures/callSignatureWithoutReturnTypeAnnotationInference/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/types/objectTypeLiteral/callSignatures/callSignatureWithoutReturnTypeAnnotationInference/input.ts/es5.1.normal/output.js index bf6860808f2..aa8faaacf60 100644 --- a/crates/swc/tests/tsc-references/types/objectTypeLiteral/callSignatures/callSignatureWithoutReturnTypeAnnotationInference/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/types/objectTypeLiteral/callSignatures/callSignatureWithoutReturnTypeAnnotationInference/input.ts/es5.1.normal/output.js @@ -110,12 +110,12 @@ function foo14() { } var r14 = foo14(); var e1; -(function(e11) { - e11[e11["A"] = 0] = "A"; +(function(e1) { + e1[e1["A"] = 0] = "A"; })(e1 || (e1 = { })); -(function(e12) { - e12.y = 1; +(function(e1) { + e1.y = 1; })(e1 || (e1 = { })); function foo15() { diff --git a/crates/swc/tests/tsc-references/types/objectTypeLiteral/callSignatures/callSignatureWithoutReturnTypeAnnotationInference/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/types/objectTypeLiteral/callSignatures/callSignatureWithoutReturnTypeAnnotationInference/input.ts/es5.2.minified/output.js index a34eba97821..1f000927327 100644 --- a/crates/swc/tests/tsc-references/types/objectTypeLiteral/callSignatures/callSignatureWithoutReturnTypeAnnotationInference/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/types/objectTypeLiteral/callSignatures/callSignatureWithoutReturnTypeAnnotationInference/input.ts/es5.2.minified/output.js @@ -31,11 +31,11 @@ function m1() { }(M || (M = { })), (m1 || (m1 = { })).y = 2; -var M, e11, c1 = function(x) { +var M, e1, c1 = function(x) { "use strict"; _classCallCheck(this, c1); }; (c1 || (c1 = { -})).x = 1, (e1 = e11 || (e11 = { -}))[e1.A = 0] = "A", (e11 || (e11 = { +})).x = 1, (e1 = e1 || (e1 = { +}))[e1.A = 0] = "A", (e1 || (e1 = { })).y = 1; diff --git a/crates/swc/tests/tsc-references/types/primitives/boolean/invalidBooleanAssignments/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/types/primitives/boolean/invalidBooleanAssignments/input.ts/es2015.1.normal/output.js index f3599ac7fa2..2563b259790 100644 --- a/crates/swc/tests/tsc-references/types/primitives/boolean/invalidBooleanAssignments/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/types/primitives/boolean/invalidBooleanAssignments/input.ts/es2015.1.normal/output.js @@ -4,8 +4,8 @@ var b = x; var c = x; var d = x; var E; -(function(E1) { - E1[E1["A"] = 0] = "A"; +(function(E) { + E[E["A"] = 0] = "A"; })(E || (E = { })); var e = x; diff --git a/crates/swc/tests/tsc-references/types/primitives/boolean/invalidBooleanAssignments/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/types/primitives/boolean/invalidBooleanAssignments/input.ts/es2015.2.minified/output.js index 4faa0e0f6f4..73cfe1ba672 100644 --- a/crates/swc/tests/tsc-references/types/primitives/boolean/invalidBooleanAssignments/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/types/primitives/boolean/invalidBooleanAssignments/input.ts/es2015.2.minified/output.js @@ -1,4 +1,4 @@ -var E, E1, M; -(E = E1 || (E1 = { +var E, E, M; +(E = E || (E = { }))[E.A = 0] = "A", (M || (M = { })).a = 1, M = !0; diff --git a/crates/swc/tests/tsc-references/types/primitives/boolean/invalidBooleanAssignments/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/types/primitives/boolean/invalidBooleanAssignments/input.ts/es5.1.normal/output.js index 57f41131f29..e4e47470340 100644 --- a/crates/swc/tests/tsc-references/types/primitives/boolean/invalidBooleanAssignments/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/types/primitives/boolean/invalidBooleanAssignments/input.ts/es5.1.normal/output.js @@ -9,8 +9,8 @@ var b = x; var c = x; var d = x; var E; -(function(E1) { - E1[E1["A"] = 0] = "A"; +(function(E) { + E[E["A"] = 0] = "A"; })(E || (E = { })); var e = x; diff --git a/crates/swc/tests/tsc-references/types/primitives/boolean/invalidBooleanAssignments/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/types/primitives/boolean/invalidBooleanAssignments/input.ts/es5.2.minified/output.js index ecb1f91769f..fc9319d34b3 100644 --- a/crates/swc/tests/tsc-references/types/primitives/boolean/invalidBooleanAssignments/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/types/primitives/boolean/invalidBooleanAssignments/input.ts/es5.2.minified/output.js @@ -1,5 +1,5 @@ -var E, E1, M; -(E = E1 || (E1 = { +var E, E, M; +(E = E || (E = { }))[E.A = 0] = "A"; var C = function() { "use strict"; diff --git a/crates/swc/tests/tsc-references/types/primitives/enum/invalidEnumAssignments/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/types/primitives/enum/invalidEnumAssignments/input.ts/es2015.1.normal/output.js index e641ad4fcca..308222f46a2 100644 --- a/crates/swc/tests/tsc-references/types/primitives/enum/invalidEnumAssignments/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/types/primitives/enum/invalidEnumAssignments/input.ts/es2015.1.normal/output.js @@ -1,13 +1,13 @@ var E; -(function(E1) { - E1[E1["A"] = 0] = "A"; - E1[E1["B"] = 1] = "B"; +(function(E) { + E[E["A"] = 0] = "A"; + E[E["B"] = 1] = "B"; })(E || (E = { })); var E2; -(function(E21) { - E21[E21["A"] = 0] = "A"; - E21[E21["B"] = 1] = "B"; +(function(E2) { + E2[E2["A"] = 0] = "A"; + E2[E2["B"] = 1] = "B"; })(E2 || (E2 = { })); var e; diff --git a/crates/swc/tests/tsc-references/types/primitives/enum/invalidEnumAssignments/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/types/primitives/enum/invalidEnumAssignments/input.ts/es2015.2.minified/output.js index 61b4d5a21fc..eb412bc21f5 100644 --- a/crates/swc/tests/tsc-references/types/primitives/enum/invalidEnumAssignments/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/types/primitives/enum/invalidEnumAssignments/input.ts/es2015.2.minified/output.js @@ -1,4 +1,4 @@ -var E, E2, E1, E21; -(E1 = E || (E = { -}))[E1.A = 0] = "A", E1[E1.B = 1] = "B", (E21 = E2 || (E2 = { -}))[E21.A = 0] = "A", E21[E21.B = 1] = "B", E2.A, E.A; +var E, E2, E, E2; +(E = E || (E = { +}))[E.A = 0] = "A", E[E.B = 1] = "B", (E2 = E2 || (E2 = { +}))[E2.A = 0] = "A", E2[E2.B = 1] = "B", E2.A, E.A; diff --git a/crates/swc/tests/tsc-references/types/primitives/enum/invalidEnumAssignments/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/types/primitives/enum/invalidEnumAssignments/input.ts/es5.1.normal/output.js index e641ad4fcca..308222f46a2 100644 --- a/crates/swc/tests/tsc-references/types/primitives/enum/invalidEnumAssignments/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/types/primitives/enum/invalidEnumAssignments/input.ts/es5.1.normal/output.js @@ -1,13 +1,13 @@ var E; -(function(E1) { - E1[E1["A"] = 0] = "A"; - E1[E1["B"] = 1] = "B"; +(function(E) { + E[E["A"] = 0] = "A"; + E[E["B"] = 1] = "B"; })(E || (E = { })); var E2; -(function(E21) { - E21[E21["A"] = 0] = "A"; - E21[E21["B"] = 1] = "B"; +(function(E2) { + E2[E2["A"] = 0] = "A"; + E2[E2["B"] = 1] = "B"; })(E2 || (E2 = { })); var e; diff --git a/crates/swc/tests/tsc-references/types/primitives/enum/invalidEnumAssignments/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/types/primitives/enum/invalidEnumAssignments/input.ts/es5.2.minified/output.js index 61b4d5a21fc..eb412bc21f5 100644 --- a/crates/swc/tests/tsc-references/types/primitives/enum/invalidEnumAssignments/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/types/primitives/enum/invalidEnumAssignments/input.ts/es5.2.minified/output.js @@ -1,4 +1,4 @@ -var E, E2, E1, E21; -(E1 = E || (E = { -}))[E1.A = 0] = "A", E1[E1.B = 1] = "B", (E21 = E2 || (E2 = { -}))[E21.A = 0] = "A", E21[E21.B = 1] = "B", E2.A, E.A; +var E, E2, E, E2; +(E = E || (E = { +}))[E.A = 0] = "A", E[E.B = 1] = "B", (E2 = E2 || (E2 = { +}))[E2.A = 0] = "A", E2[E2.B = 1] = "B", E2.A, E.A; diff --git a/crates/swc/tests/tsc-references/types/primitives/enum/validEnumAssignments/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/types/primitives/enum/validEnumAssignments/input.ts/es2015.1.normal/output.js index c0a63543456..c7ab4d4a4de 100644 --- a/crates/swc/tests/tsc-references/types/primitives/enum/validEnumAssignments/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/types/primitives/enum/validEnumAssignments/input.ts/es2015.1.normal/output.js @@ -1,7 +1,7 @@ var E; -(function(E1) { - E1[E1["A"] = 0] = "A"; - E1[E1["B"] = 1] = "B"; +(function(E) { + E[E["A"] = 0] = "A"; + E[E["B"] = 1] = "B"; })(E || (E = { })); var n; diff --git a/crates/swc/tests/tsc-references/types/primitives/enum/validEnumAssignments/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/types/primitives/enum/validEnumAssignments/input.ts/es2015.2.minified/output.js index edf47d810b8..ea5a7566d62 100644 --- a/crates/swc/tests/tsc-references/types/primitives/enum/validEnumAssignments/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/types/primitives/enum/validEnumAssignments/input.ts/es2015.2.minified/output.js @@ -1,3 +1,3 @@ -var E, n, e, E1; -(E1 = E || (E = { -}))[E1.A = 0] = "A", E1[E1.B = 1] = "B", n = e, n = E.A, E.A, e = e, e = E.A, e = E.B, e = n, e = null, e = void 0, e = 1, e = 1, e = 1, e = -1; +var E, n, e, E; +(E = E || (E = { +}))[E.A = 0] = "A", E[E.B = 1] = "B", n = e, n = E.A, E.A, e = e, e = E.A, e = E.B, e = n, e = null, e = void 0, e = 1, e = 1, e = 1, e = -1; diff --git a/crates/swc/tests/tsc-references/types/primitives/enum/validEnumAssignments/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/types/primitives/enum/validEnumAssignments/input.ts/es5.1.normal/output.js index c0a63543456..c7ab4d4a4de 100644 --- a/crates/swc/tests/tsc-references/types/primitives/enum/validEnumAssignments/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/types/primitives/enum/validEnumAssignments/input.ts/es5.1.normal/output.js @@ -1,7 +1,7 @@ var E; -(function(E1) { - E1[E1["A"] = 0] = "A"; - E1[E1["B"] = 1] = "B"; +(function(E) { + E[E["A"] = 0] = "A"; + E[E["B"] = 1] = "B"; })(E || (E = { })); var n; diff --git a/crates/swc/tests/tsc-references/types/primitives/enum/validEnumAssignments/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/types/primitives/enum/validEnumAssignments/input.ts/es5.2.minified/output.js index edf47d810b8..ea5a7566d62 100644 --- a/crates/swc/tests/tsc-references/types/primitives/enum/validEnumAssignments/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/types/primitives/enum/validEnumAssignments/input.ts/es5.2.minified/output.js @@ -1,3 +1,3 @@ -var E, n, e, E1; -(E1 = E || (E = { -}))[E1.A = 0] = "A", E1[E1.B = 1] = "B", n = e, n = E.A, E.A, e = e, e = E.A, e = E.B, e = n, e = null, e = void 0, e = 1, e = 1, e = 1, e = -1; +var E, n, e, E; +(E = E || (E = { +}))[E.A = 0] = "A", E[E.B = 1] = "B", n = e, n = E.A, E.A, e = e, e = E.A, e = E.B, e = n, e = null, e = void 0, e = 1, e = 1, e = 1, e = -1; diff --git a/crates/swc/tests/tsc-references/types/primitives/null/validNullAssignments/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/types/primitives/null/validNullAssignments/input.ts/es2015.1.normal/output.js index 990c10f7a8c..78229d18dce 100644 --- a/crates/swc/tests/tsc-references/types/primitives/null/validNullAssignments/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/types/primitives/null/validNullAssignments/input.ts/es2015.1.normal/output.js @@ -5,8 +5,8 @@ var d = null; var e = null; e = null; // ok var E; -(function(E1) { - E1[E1["A"] = 0] = "A"; +(function(E) { + E[E["A"] = 0] = "A"; })(E || (E = { })); E.A = null; // error diff --git a/crates/swc/tests/tsc-references/types/primitives/null/validNullAssignments/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/types/primitives/null/validNullAssignments/input.ts/es2015.2.minified/output.js index e2b5195e1a3..d0bebcb257b 100644 --- a/crates/swc/tests/tsc-references/types/primitives/null/validNullAssignments/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/types/primitives/null/validNullAssignments/input.ts/es2015.2.minified/output.js @@ -1,4 +1,4 @@ -var E, M, E1; -(E1 = E || (E = { -}))[E1.A = 0] = "A", E.A = null, I = null, (M || (M = { +var E, M, E; +(E = E || (E = { +}))[E.A = 0] = "A", E.A = null, I = null, (M || (M = { })).x = 1, M = null; diff --git a/crates/swc/tests/tsc-references/types/primitives/null/validNullAssignments/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/types/primitives/null/validNullAssignments/input.ts/es5.1.normal/output.js index 1900735da45..ff50932910d 100644 --- a/crates/swc/tests/tsc-references/types/primitives/null/validNullAssignments/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/types/primitives/null/validNullAssignments/input.ts/es5.1.normal/output.js @@ -10,8 +10,8 @@ var d = null; var e = null; e = null; // ok var E; -(function(E1) { - E1[E1["A"] = 0] = "A"; +(function(E) { + E[E["A"] = 0] = "A"; })(E || (E = { })); E.A = null; // error diff --git a/crates/swc/tests/tsc-references/types/primitives/null/validNullAssignments/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/types/primitives/null/validNullAssignments/input.ts/es5.2.minified/output.js index d6618040a7a..0d8ed415cb5 100644 --- a/crates/swc/tests/tsc-references/types/primitives/null/validNullAssignments/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/types/primitives/null/validNullAssignments/input.ts/es5.2.minified/output.js @@ -1,6 +1,6 @@ -var E, M, E1; -(E1 = E || (E = { -}))[E1.A = 0] = "A", E.A = null; +var E, M, E; +(E = E || (E = { +}))[E.A = 0] = "A", E.A = null; var C = function() { "use strict"; !function(instance, Constructor) { diff --git a/crates/swc/tests/tsc-references/types/primitives/number/validNumberAssignments/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/types/primitives/number/validNumberAssignments/input.ts/es2015.1.normal/output.js index 1a99c80e3be..1805071de84 100644 --- a/crates/swc/tests/tsc-references/types/primitives/number/validNumberAssignments/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/types/primitives/number/validNumberAssignments/input.ts/es2015.1.normal/output.js @@ -3,8 +3,8 @@ var a = x; var b = x; var c = x; var E; -(function(E1) { - E1[E1["A"] = 0] = "A"; +(function(E) { + E[E["A"] = 0] = "A"; })(E || (E = { })); var d = x; diff --git a/crates/swc/tests/tsc-references/types/primitives/number/validNumberAssignments/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/types/primitives/number/validNumberAssignments/input.ts/es2015.2.minified/output.js index ff5094a3250..ed7528b1b1c 100644 --- a/crates/swc/tests/tsc-references/types/primitives/number/validNumberAssignments/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/types/primitives/number/validNumberAssignments/input.ts/es2015.2.minified/output.js @@ -1,3 +1,3 @@ -var E, E1; -(E1 = E || (E = { -}))[E1.A = 0] = "A", E.A; +var E, E; +(E = E || (E = { +}))[E.A = 0] = "A", E.A; diff --git a/crates/swc/tests/tsc-references/types/primitives/number/validNumberAssignments/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/types/primitives/number/validNumberAssignments/input.ts/es5.1.normal/output.js index 1a99c80e3be..1805071de84 100644 --- a/crates/swc/tests/tsc-references/types/primitives/number/validNumberAssignments/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/types/primitives/number/validNumberAssignments/input.ts/es5.1.normal/output.js @@ -3,8 +3,8 @@ var a = x; var b = x; var c = x; var E; -(function(E1) { - E1[E1["A"] = 0] = "A"; +(function(E) { + E[E["A"] = 0] = "A"; })(E || (E = { })); var d = x; diff --git a/crates/swc/tests/tsc-references/types/primitives/number/validNumberAssignments/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/types/primitives/number/validNumberAssignments/input.ts/es5.2.minified/output.js index ff5094a3250..ed7528b1b1c 100644 --- a/crates/swc/tests/tsc-references/types/primitives/number/validNumberAssignments/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/types/primitives/number/validNumberAssignments/input.ts/es5.2.minified/output.js @@ -1,3 +1,3 @@ -var E, E1; -(E1 = E || (E = { -}))[E1.A = 0] = "A", E.A; +var E, E; +(E = E || (E = { +}))[E.A = 0] = "A", E.A; diff --git a/crates/swc/tests/tsc-references/types/primitives/string/invalidStringAssignments/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/types/primitives/string/invalidStringAssignments/input.ts/es2015.1.normal/output.js index 5752bdd5ceb..398b561ddbd 100644 --- a/crates/swc/tests/tsc-references/types/primitives/string/invalidStringAssignments/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/types/primitives/string/invalidStringAssignments/input.ts/es2015.1.normal/output.js @@ -20,8 +20,8 @@ function i(a1) { } i = x; var E; -(function(E1) { - E1[E1["A"] = 0] = "A"; +(function(E) { + E[E["A"] = 0] = "A"; })(E || (E = { })); var j = x; diff --git a/crates/swc/tests/tsc-references/types/primitives/string/invalidStringAssignments/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/types/primitives/string/invalidStringAssignments/input.ts/es2015.2.minified/output.js index a747b8b5bb9..0fa0ea3bdd1 100644 --- a/crates/swc/tests/tsc-references/types/primitives/string/invalidStringAssignments/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/types/primitives/string/invalidStringAssignments/input.ts/es2015.2.minified/output.js @@ -1,4 +1,4 @@ -var M, E, E1; +var M, E, E; (M || (M = { -})).x = 1, M = "", (E1 = E || (E = { -}))[E1.A = 0] = "A"; +})).x = 1, M = "", (E = E || (E = { +}))[E.A = 0] = "A"; diff --git a/crates/swc/tests/tsc-references/types/primitives/string/invalidStringAssignments/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/types/primitives/string/invalidStringAssignments/input.ts/es5.1.normal/output.js index 43828db80cb..3325526c9b6 100644 --- a/crates/swc/tests/tsc-references/types/primitives/string/invalidStringAssignments/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/types/primitives/string/invalidStringAssignments/input.ts/es5.1.normal/output.js @@ -27,8 +27,8 @@ function i(a1) { } i = x; var E; -(function(E1) { - E1[E1["A"] = 0] = "A"; +(function(E) { + E[E["A"] = 0] = "A"; })(E || (E = { })); var j = x; diff --git a/crates/swc/tests/tsc-references/types/primitives/string/invalidStringAssignments/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/types/primitives/string/invalidStringAssignments/input.ts/es5.2.minified/output.js index bb756125684..1e8655c1773 100644 --- a/crates/swc/tests/tsc-references/types/primitives/string/invalidStringAssignments/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/types/primitives/string/invalidStringAssignments/input.ts/es5.2.minified/output.js @@ -1,9 +1,9 @@ -var M, E, E1, C = function() { +var M, E, E, C = function() { "use strict"; !function(instance, Constructor) { if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function"); }(this, C); }; (M || (M = { -})).x = 1, M = "", (E1 = E || (E = { -}))[E1.A = 0] = "A"; +})).x = 1, M = "", (E = E || (E = { +}))[E.A = 0] = "A"; diff --git a/crates/swc/tests/tsc-references/types/primitives/undefined/invalidUndefinedAssignments/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/types/primitives/undefined/invalidUndefinedAssignments/input.ts/es2015.1.normal/output.js index 6385ac58958..c13d952d05b 100644 --- a/crates/swc/tests/tsc-references/types/primitives/undefined/invalidUndefinedAssignments/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/types/primitives/undefined/invalidUndefinedAssignments/input.ts/es2015.1.normal/output.js @@ -1,7 +1,7 @@ var x; var E; -(function(E1) { - E1[E1["A"] = 0] = "A"; +(function(E) { + E[E["A"] = 0] = "A"; })(E || (E = { })); E = x; diff --git a/crates/swc/tests/tsc-references/types/primitives/undefined/invalidUndefinedAssignments/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/types/primitives/undefined/invalidUndefinedAssignments/input.ts/es2015.2.minified/output.js index 8f2f3a08f11..444bd7b9d0a 100644 --- a/crates/swc/tests/tsc-references/types/primitives/undefined/invalidUndefinedAssignments/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/types/primitives/undefined/invalidUndefinedAssignments/input.ts/es2015.2.minified/output.js @@ -1,4 +1,4 @@ -var x, E, M, E1; -(E1 = E || (E = { -}))[E1.A = 0] = "A", (E = x).A = x, I = x, (M || (M = { +var x, E, M, E; +(E = E || (E = { +}))[E.A = 0] = "A", (E = x).A = x, I = x, (M || (M = { })).x = 1, M = x; diff --git a/crates/swc/tests/tsc-references/types/primitives/undefined/invalidUndefinedAssignments/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/types/primitives/undefined/invalidUndefinedAssignments/input.ts/es5.1.normal/output.js index 6a968f8642f..c530f1a4764 100644 --- a/crates/swc/tests/tsc-references/types/primitives/undefined/invalidUndefinedAssignments/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/types/primitives/undefined/invalidUndefinedAssignments/input.ts/es5.1.normal/output.js @@ -5,8 +5,8 @@ function _classCallCheck(instance, Constructor) { } var x; var E; -(function(E1) { - E1[E1["A"] = 0] = "A"; +(function(E) { + E[E["A"] = 0] = "A"; })(E || (E = { })); E = x; diff --git a/crates/swc/tests/tsc-references/types/primitives/undefined/invalidUndefinedAssignments/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/types/primitives/undefined/invalidUndefinedAssignments/input.ts/es5.2.minified/output.js index b82b84064b1..52b76477c83 100644 --- a/crates/swc/tests/tsc-references/types/primitives/undefined/invalidUndefinedAssignments/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/types/primitives/undefined/invalidUndefinedAssignments/input.ts/es5.2.minified/output.js @@ -1,6 +1,6 @@ -(E = E1 || (E1 = { -}))[E.A = 0] = "A", (E1 = x).A = x; -var E, x, E1, M, C = function() { +(E = E || (E = { +}))[E.A = 0] = "A", (E = x).A = x; +var E, x, E, M, C = function() { "use strict"; !function(instance, Constructor) { if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function"); diff --git a/crates/swc/tests/tsc-references/types/primitives/undefined/invalidUndefinedValues/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/types/primitives/undefined/invalidUndefinedValues/input.ts/es2015.1.normal/output.js index 492098af4dd..290d65facad 100644 --- a/crates/swc/tests/tsc-references/types/primitives/undefined/invalidUndefinedValues/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/types/primitives/undefined/invalidUndefinedValues/input.ts/es2015.1.normal/output.js @@ -27,8 +27,8 @@ function f(a1) { } x = f; var E; -(function(E1) { - E1[E1["A"] = 0] = "A"; +(function(E) { + E[E["A"] = 0] = "A"; })(E || (E = { })); x = E; diff --git a/crates/swc/tests/tsc-references/types/primitives/undefined/invalidUndefinedValues/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/types/primitives/undefined/invalidUndefinedValues/input.ts/es2015.2.minified/output.js index 0e9f1e50f92..0842fba191a 100644 --- a/crates/swc/tests/tsc-references/types/primitives/undefined/invalidUndefinedValues/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/types/primitives/undefined/invalidUndefinedValues/input.ts/es2015.2.minified/output.js @@ -1,4 +1,4 @@ -var x, M, E, E1; +var x, M, E, E; x = 1, x = "", x = !0, x = void 0, x = null, x = class { }, x = void 0, x = void 0, (M || (M = { })).x = 1, x = M, x = { @@ -6,5 +6,5 @@ x = 1, x = "", x = !0, x = void 0, x = null, x = class { } }, x = function(a) { x = a; -}, (E1 = E || (E = { -}))[E1.A = 0] = "A", x = E, x = E.A; +}, (E = E || (E = { +}))[E.A = 0] = "A", x = E, x = E.A; diff --git a/crates/swc/tests/tsc-references/types/primitives/undefined/invalidUndefinedValues/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/types/primitives/undefined/invalidUndefinedValues/input.ts/es5.1.normal/output.js index fc8d93fd349..6fd719561ef 100644 --- a/crates/swc/tests/tsc-references/types/primitives/undefined/invalidUndefinedValues/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/types/primitives/undefined/invalidUndefinedValues/input.ts/es5.1.normal/output.js @@ -34,8 +34,8 @@ function f(a1) { } x = f; var E; -(function(E1) { - E1[E1["A"] = 0] = "A"; +(function(E) { + E[E["A"] = 0] = "A"; })(E || (E = { })); x = E; diff --git a/crates/swc/tests/tsc-references/types/primitives/undefined/invalidUndefinedValues/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/types/primitives/undefined/invalidUndefinedValues/input.ts/es5.2.minified/output.js index 4f78716c3f7..a397219b546 100644 --- a/crates/swc/tests/tsc-references/types/primitives/undefined/invalidUndefinedValues/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/types/primitives/undefined/invalidUndefinedValues/input.ts/es5.2.minified/output.js @@ -1,5 +1,5 @@ x = 1, x = "", x = !0, x = a, x = null; -var E, x, a, b, c, M, E1, C = function() { +var E, x, a, b, c, M, E, C = function() { "use strict"; !function(instance, Constructor) { if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function"); @@ -11,5 +11,5 @@ x = C, x = b, x = c, (M || (M = { } }, x = function(a1) { x = a1; -}, (E = E1 || (E1 = { -}))[E.A = 0] = "A", x = E1, x = E1.A; +}, (E = E || (E = { +}))[E.A = 0] = "A", x = E, x = E.A; diff --git a/crates/swc/tests/tsc-references/types/primitives/void/invalidVoidAssignments/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/types/primitives/void/invalidVoidAssignments/input.ts/es2015.1.normal/output.js index 5041ae1c169..e8b614e816c 100644 --- a/crates/swc/tests/tsc-references/types/primitives/void/invalidVoidAssignments/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/types/primitives/void/invalidVoidAssignments/input.ts/es2015.1.normal/output.js @@ -20,8 +20,8 @@ function i(a1) { } i = x; var E; -(function(E1) { - E1[E1["A"] = 0] = "A"; +(function(E) { + E[E["A"] = 0] = "A"; })(E || (E = { })); x = E; diff --git a/crates/swc/tests/tsc-references/types/primitives/void/invalidVoidAssignments/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/types/primitives/void/invalidVoidAssignments/input.ts/es2015.2.minified/output.js index 6475eedff35..6f0b26d67f9 100644 --- a/crates/swc/tests/tsc-references/types/primitives/void/invalidVoidAssignments/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/types/primitives/void/invalidVoidAssignments/input.ts/es2015.2.minified/output.js @@ -1,7 +1,7 @@ -var x, M, E, E1; +var x, M, E, E; (M || (M = { -})).x = 1, M = x, (E1 = E || (E = { -}))[E1.A = 0] = "A", x = E, x = E.A, x = { +})).x = 1, M = x, (E = E || (E = { +}))[E.A = 0] = "A", x = E, x = E.A, x = { f () { } }; diff --git a/crates/swc/tests/tsc-references/types/primitives/void/invalidVoidAssignments/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/types/primitives/void/invalidVoidAssignments/input.ts/es5.1.normal/output.js index ed1f9b87cfa..9f05fad0a7b 100644 --- a/crates/swc/tests/tsc-references/types/primitives/void/invalidVoidAssignments/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/types/primitives/void/invalidVoidAssignments/input.ts/es5.1.normal/output.js @@ -27,8 +27,8 @@ function i(a1) { } i = x; var E; -(function(E1) { - E1[E1["A"] = 0] = "A"; +(function(E) { + E[E["A"] = 0] = "A"; })(E || (E = { })); x = E; diff --git a/crates/swc/tests/tsc-references/types/primitives/void/invalidVoidAssignments/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/types/primitives/void/invalidVoidAssignments/input.ts/es5.2.minified/output.js index 7a117331a7e..5b2fefda16e 100644 --- a/crates/swc/tests/tsc-references/types/primitives/void/invalidVoidAssignments/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/types/primitives/void/invalidVoidAssignments/input.ts/es5.2.minified/output.js @@ -1,12 +1,12 @@ -var x, M, E, E1, C = function() { +var x, M, E, E, C = function() { "use strict"; !function(instance, Constructor) { if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function"); }(this, C); }; (M || (M = { -})).x = 1, M = x, (E1 = E || (E = { -}))[E1.A = 0] = "A", x = E, x = E.A, x = { +})).x = 1, M = x, (E = E || (E = { +}))[E.A = 0] = "A", x = E, x = E.A, x = { f: function() { } }; diff --git a/crates/swc/tests/tsc-references/types/primitives/void/invalidVoidValues/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/types/primitives/void/invalidVoidValues/input.ts/es2015.1.normal/output.js index 110bb02de64..0f018ee3904 100644 --- a/crates/swc/tests/tsc-references/types/primitives/void/invalidVoidValues/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/types/primitives/void/invalidVoidValues/input.ts/es2015.1.normal/output.js @@ -3,8 +3,8 @@ x = 1; x = ''; x = true; var E; -(function(E1) { - E1[E1["A"] = 0] = "A"; +(function(E) { + E[E["A"] = 0] = "A"; })(E || (E = { })); x = E; diff --git a/crates/swc/tests/tsc-references/types/primitives/void/invalidVoidValues/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/types/primitives/void/invalidVoidValues/input.ts/es2015.2.minified/output.js index 959b7b79c10..15b18ccac99 100644 --- a/crates/swc/tests/tsc-references/types/primitives/void/invalidVoidValues/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/types/primitives/void/invalidVoidValues/input.ts/es2015.2.minified/output.js @@ -1,6 +1,6 @@ -var x, E, a, b, M, E1; -x = 1, x = "", x = !0, (E1 = E || (E = { -}))[E1.A = 0] = "A", x = E, x = E.A, x = a, x = b, x = { +var x, E, a, b, M, E; +x = 1, x = "", x = !0, (E = E || (E = { +}))[E.A = 0] = "A", x = E, x = E.A, x = a, x = b, x = { f () { } }, (M || (M = { diff --git a/crates/swc/tests/tsc-references/types/primitives/void/invalidVoidValues/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/types/primitives/void/invalidVoidValues/input.ts/es5.1.normal/output.js index 2f59496a1a2..8a5ffb2353e 100644 --- a/crates/swc/tests/tsc-references/types/primitives/void/invalidVoidValues/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/types/primitives/void/invalidVoidValues/input.ts/es5.1.normal/output.js @@ -8,8 +8,8 @@ x = 1; x = ''; x = true; var E; -(function(E1) { - E1[E1["A"] = 0] = "A"; +(function(E) { + E[E["A"] = 0] = "A"; })(E || (E = { })); x = E; diff --git a/crates/swc/tests/tsc-references/types/primitives/void/invalidVoidValues/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/types/primitives/void/invalidVoidValues/input.ts/es5.2.minified/output.js index b61087ad87e..32e300fdb9f 100644 --- a/crates/swc/tests/tsc-references/types/primitives/void/invalidVoidValues/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/types/primitives/void/invalidVoidValues/input.ts/es5.2.minified/output.js @@ -1,6 +1,6 @@ -x = 1, x = "", x = !0, (E = E1 || (E1 = { -}))[E.A = 0] = "A", x = E1, x = E1.A; -var E, x, E1, a, b, M, C = function() { +x = 1, x = "", x = !0, (E = E || (E = { +}))[E.A = 0] = "A", x = E, x = E.A; +var E, x, E, a, b, M, C = function() { "use strict"; !function(instance, Constructor) { if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function"); diff --git a/crates/swc/tests/tsc-references/types/specifyingTypes/typeQueries/typeofANonExportedType/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/types/specifyingTypes/typeQueries/typeofANonExportedType/input.ts/es2015.1.normal/output.js index 3f506ca8e47..381c3a3d53c 100644 --- a/crates/swc/tests/tsc-references/types/specifyingTypes/typeQueries/typeofANonExportedType/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/types/specifyingTypes/typeQueries/typeofANonExportedType/input.ts/es2015.1.normal/output.js @@ -28,8 +28,8 @@ export var r7; export var r8; export var r9; var E; -(function(E1) { - E1[E1["A"] = 0] = "A"; +(function(E) { + E[E["A"] = 0] = "A"; })(E || (E = { })); export var r10; diff --git a/crates/swc/tests/tsc-references/types/specifyingTypes/typeQueries/typeofANonExportedType/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/types/specifyingTypes/typeQueries/typeofANonExportedType/input.ts/es2015.2.minified/output.js index 33d816c2e25..a5dd9e97113 100644 --- a/crates/swc/tests/tsc-references/types/specifyingTypes/typeQueries/typeofANonExportedType/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/types/specifyingTypes/typeQueries/typeofANonExportedType/input.ts/es2015.2.minified/output.js @@ -1,9 +1,9 @@ -var M, E, M1, E1, foo; +var M, E, M1, E, foo; function foo1() { } (M1 = M || (M = { })).foo = "", M1.C = class { -}, (E1 = E || (E = { -}))[E1.A = 0] = "A", (foo = foo1 || (foo1 = { +}, (E = E || (E = { +}))[E.A = 0] = "A", (foo = foo1 || (foo1 = { })).y = 1, foo.C = class { }; diff --git a/crates/swc/tests/tsc-references/types/specifyingTypes/typeQueries/typeofANonExportedType/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/types/specifyingTypes/typeQueries/typeofANonExportedType/input.ts/es5.1.normal/output.js index 9bad4f611af..0640c2d576d 100644 --- a/crates/swc/tests/tsc-references/types/specifyingTypes/typeQueries/typeofANonExportedType/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/types/specifyingTypes/typeQueries/typeofANonExportedType/input.ts/es5.1.normal/output.js @@ -37,8 +37,8 @@ export var r7; export var r8; export var r9; var E; -(function(E1) { - E1[E1["A"] = 0] = "A"; +(function(E) { + E[E["A"] = 0] = "A"; })(E || (E = { })); export var r10; diff --git a/crates/swc/tests/tsc-references/types/specifyingTypes/typeQueries/typeofANonExportedType/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/types/specifyingTypes/typeQueries/typeofANonExportedType/input.ts/es5.2.minified/output.js index 050233d6c10..453180f7d1c 100644 --- a/crates/swc/tests/tsc-references/types/specifyingTypes/typeQueries/typeofANonExportedType/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/types/specifyingTypes/typeQueries/typeofANonExportedType/input.ts/es5.2.minified/output.js @@ -1,7 +1,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function"); } -var M, E, E1, C = function() { +var M, E, E, C = function() { "use strict"; _classCallCheck(this, C); }; @@ -15,8 +15,8 @@ function foo() { }; M1.C = C1; }(M || (M = { -})), (E1 = E || (E = { -}))[E1.A = 0] = "A", (function(foo1) { +})), (E = E || (E = { +}))[E.A = 0] = "A", (function(foo1) { foo1.y = 1; var C2 = function() { "use strict"; diff --git a/crates/swc/tests/tsc-references/types/specifyingTypes/typeQueries/typeofAnExportedType/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/types/specifyingTypes/typeQueries/typeofAnExportedType/input.ts/es2015.1.normal/output.js index cca9b33ed8f..d05704e221d 100644 --- a/crates/swc/tests/tsc-references/types/specifyingTypes/typeQueries/typeofAnExportedType/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/types/specifyingTypes/typeQueries/typeofAnExportedType/input.ts/es2015.1.normal/output.js @@ -29,8 +29,8 @@ export var Z = M; export var r8; export var r9; export var E; -(function(E1) { - E1[E1["A"] = 0] = "A"; +(function(E) { + E[E["A"] = 0] = "A"; })(E || (E = { })); export var r10; diff --git a/crates/swc/tests/tsc-references/types/specifyingTypes/typeQueries/typeofAnExportedType/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/types/specifyingTypes/typeQueries/typeofAnExportedType/input.ts/es2015.2.minified/output.js index a2d6249cefd..a62ea253a5d 100644 --- a/crates/swc/tests/tsc-references/types/specifyingTypes/typeQueries/typeofAnExportedType/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/types/specifyingTypes/typeQueries/typeofAnExportedType/input.ts/es2015.2.minified/output.js @@ -1,5 +1,5 @@ -var M, E, foo, r1, r2, c, c2, r3, r4, r4b, i, i2, r5, r5, M1, r6, r7, r8, r9, E1, r10, r11, r12, r13, x = 1; -export { M1 as M, E1 as E }; +var M, E, foo, r1, r2, c, c2, r3, r4, r4b, i, i2, r5, r5, M1, r6, r7, r8, r9, E, r10, r11, r12, r13, x = 1; +export { M1 as M }; export var y = { foo: "" }; @@ -9,7 +9,7 @@ export class C { })).foo = "", M.C = class { }; export var Z = M1; -(E = E1 || (E1 = { +(E = E || (E = { }))[E.A = 0] = "A"; function foo1() { } diff --git a/crates/swc/tests/tsc-references/types/specifyingTypes/typeQueries/typeofAnExportedType/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/types/specifyingTypes/typeQueries/typeofAnExportedType/input.ts/es5.1.normal/output.js index 670aa987ff5..0b5c77df219 100644 --- a/crates/swc/tests/tsc-references/types/specifyingTypes/typeQueries/typeofAnExportedType/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/types/specifyingTypes/typeQueries/typeofAnExportedType/input.ts/es5.1.normal/output.js @@ -38,8 +38,8 @@ export var Z = M; export var r8; export var r9; export var E; -(function(E1) { - E1[E1["A"] = 0] = "A"; +(function(E) { + E[E["A"] = 0] = "A"; })(E || (E = { })); export var r10; diff --git a/crates/swc/tests/tsc-references/types/specifyingTypes/typeQueries/typeofAnExportedType/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/types/specifyingTypes/typeQueries/typeofAnExportedType/input.ts/es5.2.minified/output.js index feb1d6d65ce..e2e0048eb55 100644 --- a/crates/swc/tests/tsc-references/types/specifyingTypes/typeQueries/typeofAnExportedType/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/types/specifyingTypes/typeQueries/typeofAnExportedType/input.ts/es5.2.minified/output.js @@ -1,8 +1,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function"); } -var E, r1, r2, c, c2, r3, r4, r4b, i, i2, r5, r5, M, r6, r7, r8, r9, E1, r10, r11, r12, r13, x = 1; -export { E1 as E }; +export var E, r1, r2, c, c2, r3, r4, r4b, i, i2, r5, r5, M, r6, r7, r8, r9, E, r10, r11, r12, r13, x = 1; export var y = { foo: "" }; @@ -20,7 +19,7 @@ export var C = function() { }(M || (M = { })); export var Z = M; -(E = E1 || (E1 = { +(E = E || (E = { }))[E.A = 0] = "A"; export function foo() { } diff --git a/crates/swc/tests/tsc-references/types/specifyingTypes/typeReferences/nonGenericTypeReferenceWithTypeArguments/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/types/specifyingTypes/typeReferences/nonGenericTypeReferenceWithTypeArguments/input.ts/es2015.1.normal/output.js index 769e9e74e1e..43f1bc7add5 100644 --- a/crates/swc/tests/tsc-references/types/specifyingTypes/typeReferences/nonGenericTypeReferenceWithTypeArguments/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/types/specifyingTypes/typeReferences/nonGenericTypeReferenceWithTypeArguments/input.ts/es2015.1.normal/output.js @@ -13,6 +13,7 @@ function f() { class C { } ; + let E; (function(E) { })(E || (E = { })); diff --git a/crates/swc/tests/tsc-references/types/specifyingTypes/typeReferences/nonGenericTypeReferenceWithTypeArguments/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/types/specifyingTypes/typeReferences/nonGenericTypeReferenceWithTypeArguments/input.ts/es5.1.normal/output.js index 6e6c08e2fbb..0d9380c80d8 100644 --- a/crates/swc/tests/tsc-references/types/specifyingTypes/typeReferences/nonGenericTypeReferenceWithTypeArguments/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/types/specifyingTypes/typeReferences/nonGenericTypeReferenceWithTypeArguments/input.ts/es5.1.normal/output.js @@ -21,6 +21,7 @@ function f() { _classCallCheck(this, C); }; ; + var E; (function(E) { })(E || (E = { })); diff --git a/crates/swc/tests/tsc-references/types/tuple/castingTuple/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/types/tuple/castingTuple/input.ts/es2015.1.normal/output.js index 92254c2b043..24c1010e6e8 100644 --- a/crates/swc/tests/tsc-references/types/tuple/castingTuple/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/types/tuple/castingTuple/input.ts/es2015.1.normal/output.js @@ -12,13 +12,13 @@ class E extends A { class F extends A { } var E1; -(function(E11) { - E11[E11["one"] = 0] = "one"; +(function(E1) { + E1[E1["one"] = 0] = "one"; })(E1 || (E1 = { })); var E2; -(function(E21) { - E21[E21["one"] = 0] = "one"; +(function(E2) { + E2[E2["one"] = 0] = "one"; })(E2 || (E2 = { })); // no error diff --git a/crates/swc/tests/tsc-references/types/tuple/castingTuple/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/types/tuple/castingTuple/input.ts/es2015.2.minified/output.js index f712ffcb5d3..db6c02a71f6 100644 --- a/crates/swc/tests/tsc-references/types/tuple/castingTuple/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/types/tuple/castingTuple/input.ts/es2015.2.minified/output.js @@ -2,10 +2,10 @@ class C { } class D { } -(E1 = E11 || (E11 = { -}))[E1.one = 0] = "one", (E2 = E21 || (E21 = { +(E1 = E1 || (E1 = { +}))[E1.one = 0] = "one", (E2 = E2 || (E2 = { }))[E2.one = 0] = "one"; -var E1, E2, E11, E21, classCDATuple = [ +var E1, E2, E1, E2, classCDATuple = [ new C(), new D() ]; diff --git a/crates/swc/tests/tsc-references/types/tuple/castingTuple/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/types/tuple/castingTuple/input.ts/es5.1.normal/output.js index e15f330c347..dcfc0273195 100644 --- a/crates/swc/tests/tsc-references/types/tuple/castingTuple/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/types/tuple/castingTuple/input.ts/es5.1.normal/output.js @@ -103,13 +103,13 @@ var F = /*#__PURE__*/ function(A) { return F; }(A); var E1; -(function(E11) { - E11[E11["one"] = 0] = "one"; +(function(E1) { + E1[E1["one"] = 0] = "one"; })(E1 || (E1 = { })); var E2; -(function(E21) { - E21[E21["one"] = 0] = "one"; +(function(E2) { + E2[E2["one"] = 0] = "one"; })(E2 || (E2 = { })); // no error diff --git a/crates/swc/tests/tsc-references/types/tuple/castingTuple/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/types/tuple/castingTuple/input.ts/es5.2.minified/output.js index 17cf7d711b8..c6a8d9d755e 100644 --- a/crates/swc/tests/tsc-references/types/tuple/castingTuple/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/types/tuple/castingTuple/input.ts/es5.2.minified/output.js @@ -45,7 +45,7 @@ function _createSuper(Derived) { })(self); }; } -var E1, E2, E11, A = function() { +var E1, E2, E1, A = function() { "use strict"; _classCallCheck(this, A), this.a = 10; }, C = function() { @@ -71,10 +71,10 @@ var E1, E2, E11, A = function() { } return F; }(A); -(E11 = E1 || (E1 = { -}))[E11.one = 0] = "one", (E21 = E2 || (E2 = { -}))[E21.one = 0] = "one"; -var E21, classCDATuple = [ +(E1 = E1 || (E1 = { +}))[E1.one = 0] = "one", (E2 = E2 || (E2 = { +}))[E2.one = 0] = "one"; +var E2, classCDATuple = [ new C(), new D() ]; diff --git a/crates/swc/tests/tsc-references/types/typeAliases/typeAliases/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/types/typeAliases/typeAliases/input.ts/es2015.1.normal/output.js index 930000a0993..3149511eea5 100644 --- a/crates/swc/tests/tsc-references/types/typeAliases/typeAliases/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/types/typeAliases/typeAliases/input.ts/es2015.1.normal/output.js @@ -28,8 +28,8 @@ foo13(x13_1, x13_2); foo13(x13_2, x13_1); var x14; var E; -(function(E1) { - E1[E1["x"] = 10] = "x"; +(function(E) { + E[E["x"] = 10] = "x"; })(E || (E = { })); f15(E.x).toLowerCase(); diff --git a/crates/swc/tests/tsc-references/types/typeAliases/typeAliases/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/types/typeAliases/typeAliases/input.ts/es2015.2.minified/output.js index f094b340bab..ee93b3b0cde 100644 --- a/crates/swc/tests/tsc-references/types/typeAliases/typeAliases/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/types/typeAliases/typeAliases/input.ts/es2015.2.minified/output.js @@ -1,3 +1,3 @@ -var E, x13_1, x13_2, E1, x; -foo13(x13_1, x13_2), foo13(x13_2, x13_1), (E = E1 || (E1 = { -}))[E.x = 10] = "x", f15(E1.x).toLowerCase(), f16(x); +var E, x13_1, x13_2, E, x; +foo13(x13_1, x13_2), foo13(x13_2, x13_1), (E = E || (E = { +}))[E.x = 10] = "x", f15(E.x).toLowerCase(), f16(x); diff --git a/crates/swc/tests/tsc-references/types/typeAliases/typeAliases/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/types/typeAliases/typeAliases/input.ts/es5.1.normal/output.js index 8df4f256529..72fe155bda1 100644 --- a/crates/swc/tests/tsc-references/types/typeAliases/typeAliases/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/types/typeAliases/typeAliases/input.ts/es5.1.normal/output.js @@ -35,8 +35,8 @@ foo13(x13_1, x13_2); foo13(x13_2, x13_1); var x14; var E; -(function(E1) { - E1[E1["x"] = 10] = "x"; +(function(E) { + E[E["x"] = 10] = "x"; })(E || (E = { })); f15(E.x).toLowerCase(); diff --git a/crates/swc/tests/tsc-references/types/typeAliases/typeAliases/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/types/typeAliases/typeAliases/input.ts/es5.2.minified/output.js index 1b024c86d69..e7321d23295 100644 --- a/crates/swc/tests/tsc-references/types/typeAliases/typeAliases/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/types/typeAliases/typeAliases/input.ts/es5.2.minified/output.js @@ -1,8 +1,8 @@ -var E, x13_1, x13_2, E1, x, C7 = function() { +var E, x13_1, x13_2, E, x, C7 = function() { "use strict"; !function(instance, Constructor) { if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function"); }(this, C7); }; -foo13(x13_1, x13_2), foo13(x13_2, x13_1), (E = E1 || (E1 = { -}))[E.x = 10] = "x", f15(E1.x).toLowerCase(), f16(x); +foo13(x13_1, x13_2), foo13(x13_2, x13_1), (E = E || (E = { +}))[E.x = 10] = "x", f15(E.x).toLowerCase(), f16(x); diff --git a/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/anyAssignabilityInInheritance/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/anyAssignabilityInInheritance/input.ts/es2015.1.normal/output.js index d0bb4057a8b..a708abf037d 100644 --- a/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/anyAssignabilityInInheritance/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/anyAssignabilityInInheritance/input.ts/es2015.1.normal/output.js @@ -16,8 +16,8 @@ var r3 = foo3(a); // any var r3 = foo3(a); // any var r3 = foo3(a); // any var E; -(function(E1) { - E1[E1["A"] = 0] = "A"; +(function(E) { + E[E["A"] = 0] = "A"; })(E || (E = { })); var r3 = foo3(a); // any diff --git a/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/anyAssignabilityInInheritance/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/anyAssignabilityInInheritance/input.ts/es2015.2.minified/output.js index 46d480124d0..17ef92de451 100644 --- a/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/anyAssignabilityInInheritance/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/anyAssignabilityInInheritance/input.ts/es2015.2.minified/output.js @@ -1,8 +1,8 @@ -var a, E, E1; +var a, E, E; function f() { } -foo2(a), foo3(a), foo3(a), foo3(a), foo3(a), foo3(a), foo3(a), foo3(a), foo3(a), foo3(a), foo3(a), foo3(a), (E1 = E || (E = { -}))[E1.A = 0] = "A", foo3(a), (f || (f = { +foo2(a), foo3(a), foo3(a), foo3(a), foo3(a), foo3(a), foo3(a), foo3(a), foo3(a), foo3(a), foo3(a), foo3(a), (E = E || (E = { +}))[E.A = 0] = "A", foo3(a), (f || (f = { })).bar = 1, foo3(a); class CC { } diff --git a/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/anyAssignabilityInInheritance/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/anyAssignabilityInInheritance/input.ts/es5.1.normal/output.js index b370447f7bd..789a6244252 100644 --- a/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/anyAssignabilityInInheritance/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/anyAssignabilityInInheritance/input.ts/es5.1.normal/output.js @@ -25,8 +25,8 @@ var r3 = foo3(a); // any var r3 = foo3(a); // any var r3 = foo3(a); // any var E; -(function(E1) { - E1[E1["A"] = 0] = "A"; +(function(E) { + E[E["A"] = 0] = "A"; })(E || (E = { })); var r3 = foo3(a); // any diff --git a/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/anyAssignabilityInInheritance/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/anyAssignabilityInInheritance/input.ts/es5.2.minified/output.js index 68e052442c5..48d0b1d2c42 100644 --- a/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/anyAssignabilityInInheritance/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/anyAssignabilityInInheritance/input.ts/es5.2.minified/output.js @@ -13,10 +13,10 @@ var A2 = function() { }; function f() { } -foo3(a), foo3(a), foo3(a), (E1 = E || (E = { -}))[E1.A = 0] = "A", foo3(a), (f || (f = { +foo3(a), foo3(a), foo3(a), (E = E || (E = { +}))[E.A = 0] = "A", foo3(a), (f || (f = { })).bar = 1, foo3(a); -var a, E, E1, CC = function() { +var a, E, E, CC = function() { "use strict"; _classCallCheck(this, CC); }; diff --git a/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/anyAssignableToEveryType/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/anyAssignableToEveryType/input.ts/es2015.1.normal/output.js index 5022bc1c15d..187b7466773 100644 --- a/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/anyAssignableToEveryType/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/anyAssignableToEveryType/input.ts/es2015.1.normal/output.js @@ -4,8 +4,8 @@ class C { var ac; var ai; var E; -(function(E1) { - E1[E1["A"] = 0] = "A"; +(function(E) { + E[E["A"] = 0] = "A"; })(E || (E = { })); var ae; diff --git a/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/anyAssignableToEveryType/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/anyAssignableToEveryType/input.ts/es2015.2.minified/output.js index 52b1e98a3af..4dac4549ce1 100644 --- a/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/anyAssignableToEveryType/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/anyAssignableToEveryType/input.ts/es2015.2.minified/output.js @@ -1,3 +1,3 @@ -var E, E1; -(E = E1 || (E1 = { +var E, E; +(E = E || (E = { }))[E.A = 0] = "A"; diff --git a/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/anyAssignableToEveryType/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/anyAssignableToEveryType/input.ts/es5.1.normal/output.js index f9cb3a5de1c..37779b024d3 100644 --- a/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/anyAssignableToEveryType/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/anyAssignableToEveryType/input.ts/es5.1.normal/output.js @@ -11,8 +11,8 @@ var C = function C() { var ac; var ai; var E; -(function(E1) { - E1[E1["A"] = 0] = "A"; +(function(E) { + E[E["A"] = 0] = "A"; })(E || (E = { })); var ae; diff --git a/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/anyAssignableToEveryType/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/anyAssignableToEveryType/input.ts/es5.2.minified/output.js index 74f67cb635e..b3226de6741 100644 --- a/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/anyAssignableToEveryType/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/anyAssignableToEveryType/input.ts/es5.2.minified/output.js @@ -1,8 +1,8 @@ -var E, E1, C = function() { +var E, E, C = function() { "use strict"; !function(instance, Constructor) { if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function"); }(this, C); }; -(E1 = E || (E = { -}))[E1.A = 0] = "A"; +(E = E || (E = { +}))[E.A = 0] = "A"; diff --git a/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/anyAssignableToEveryType2/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/anyAssignableToEveryType2/input.ts/es2015.1.normal/output.js index b3f62a9d8f8..b9dceab40b3 100644 --- a/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/anyAssignableToEveryType2/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/anyAssignableToEveryType2/input.ts/es2015.1.normal/output.js @@ -3,8 +3,8 @@ class A { class A2 { } var E; -(function(E1) { - E1[E1["A"] = 0] = "A"; +(function(E) { + E[E["A"] = 0] = "A"; })(E || (E = { })); function f() { diff --git a/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/anyAssignableToEveryType2/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/anyAssignableToEveryType2/input.ts/es2015.2.minified/output.js index df33eeb3a94..a2e87ad744c 100644 --- a/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/anyAssignableToEveryType2/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/anyAssignableToEveryType2/input.ts/es2015.2.minified/output.js @@ -1,8 +1,8 @@ -var E, E1; +var E, E; function f() { } -(E1 = E || (E = { -}))[E1.A = 0] = "A", (f || (f = { +(E = E || (E = { +}))[E.A = 0] = "A", (f || (f = { })).bar = 1; class c { } diff --git a/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/anyAssignableToEveryType2/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/anyAssignableToEveryType2/input.ts/es5.1.normal/output.js index ed1f4d75df5..7d7a80f1b39 100644 --- a/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/anyAssignableToEveryType2/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/anyAssignableToEveryType2/input.ts/es5.1.normal/output.js @@ -12,8 +12,8 @@ var A2 = function A2() { _classCallCheck(this, A2); }; var E; -(function(E1) { - E1[E1["A"] = 0] = "A"; +(function(E) { + E[E["A"] = 0] = "A"; })(E || (E = { })); function f() { diff --git a/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/anyAssignableToEveryType2/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/anyAssignableToEveryType2/input.ts/es5.2.minified/output.js index e2381a729ad..6507a42018d 100644 --- a/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/anyAssignableToEveryType2/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/anyAssignableToEveryType2/input.ts/es5.2.minified/output.js @@ -1,7 +1,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function"); } -var E, E1, A = function() { +var E, E, A = function() { "use strict"; _classCallCheck(this, A); }, A2 = function() { @@ -10,8 +10,8 @@ var E, E1, A = function() { }; function f() { } -(E1 = E || (E = { -}))[E1.A = 0] = "A", (f || (f = { +(E = E || (E = { +}))[E.A = 0] = "A", (f || (f = { })).bar = 1; var c = function() { "use strict"; diff --git a/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures4/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures4/input.ts/es2015.1.normal/output.js index 3bbc8d35344..3a266be3fa3 100644 --- a/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures4/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures4/input.ts/es2015.1.normal/output.js @@ -9,7 +9,7 @@ var Errors; } class OtherDerived extends Base { } - var WithNonGenericSignaturesInBaseType; + let WithNonGenericSignaturesInBaseType; (function(WithNonGenericSignaturesInBaseType) { // target type with non-generic call signatures var a2; @@ -54,7 +54,7 @@ var Errors; b17 = a17; })(WithNonGenericSignaturesInBaseType || (WithNonGenericSignaturesInBaseType = { })); - var WithGenericSignaturesInBaseType; + let WithGenericSignaturesInBaseType; (function(WithGenericSignaturesInBaseType) { // target type has generic call signature var a2; diff --git a/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures4/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures4/input.ts/es2015.2.minified/output.js index b6ba3581c5c..bd7db5ed85f 100644 --- a/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures4/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures4/input.ts/es2015.2.minified/output.js @@ -1,8 +1,11 @@ var Errors; !function(Errors) { - var WithNonGenericSignaturesInBaseType, WithGenericSignaturesInBaseType, b2, b7, b8, b10, b11, b12, b15, b15a, b16, b17, b21, b3; + var b2, b7, b8, b10, b11, b12, b15, b15a, b16, b17, b21, b3; + let WithNonGenericSignaturesInBaseType; WithNonGenericSignaturesInBaseType || (WithNonGenericSignaturesInBaseType = { - }), b2 = b2, b7 = b7, b8 = b8, b10 = b10, b11 = b11, b12 = b12, b15 = b15, b15a = b15a, b16 = b16, b17 = b17, WithGenericSignaturesInBaseType || (WithGenericSignaturesInBaseType = { + }), b2 = b2, b7 = b7, b8 = b8, b10 = b10, b11 = b11, b12 = b12, b15 = b15, b15a = b15a, b16 = b16, b17 = b17; + let WithGenericSignaturesInBaseType; + WithGenericSignaturesInBaseType || (WithGenericSignaturesInBaseType = { }), b21 = b21, b3 = b3; }(Errors || (Errors = { })); diff --git a/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures4/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures4/input.ts/es2015.1.normal/output.js index 6c35b6f0f4f..4cd50f9ae00 100644 --- a/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures4/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures4/input.ts/es2015.1.normal/output.js @@ -9,7 +9,7 @@ var Errors; } class OtherDerived extends Base { } - var WithNonGenericSignaturesInBaseType; + let WithNonGenericSignaturesInBaseType; (function(WithNonGenericSignaturesInBaseType) { // target type with non-generic call signatures var a2; @@ -54,7 +54,7 @@ var Errors; b17 = a17; // error })(WithNonGenericSignaturesInBaseType || (WithNonGenericSignaturesInBaseType = { })); - var WithGenericSignaturesInBaseType; + let WithGenericSignaturesInBaseType; (function(WithGenericSignaturesInBaseType) { // target type has generic call signature var a2; diff --git a/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures4/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures4/input.ts/es2015.2.minified/output.js index b6ba3581c5c..bd7db5ed85f 100644 --- a/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures4/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures4/input.ts/es2015.2.minified/output.js @@ -1,8 +1,11 @@ var Errors; !function(Errors) { - var WithNonGenericSignaturesInBaseType, WithGenericSignaturesInBaseType, b2, b7, b8, b10, b11, b12, b15, b15a, b16, b17, b21, b3; + var b2, b7, b8, b10, b11, b12, b15, b15a, b16, b17, b21, b3; + let WithNonGenericSignaturesInBaseType; WithNonGenericSignaturesInBaseType || (WithNonGenericSignaturesInBaseType = { - }), b2 = b2, b7 = b7, b8 = b8, b10 = b10, b11 = b11, b12 = b12, b15 = b15, b15a = b15a, b16 = b16, b17 = b17, WithGenericSignaturesInBaseType || (WithGenericSignaturesInBaseType = { + }), b2 = b2, b7 = b7, b8 = b8, b10 = b10, b11 = b11, b12 = b12, b15 = b15, b15a = b15a, b16 = b16, b17 = b17; + let WithGenericSignaturesInBaseType; + WithGenericSignaturesInBaseType || (WithGenericSignaturesInBaseType = { }), b21 = b21, b3 = b3; }(Errors || (Errors = { })); diff --git a/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/enumAssignability/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/enumAssignability/input.ts/es2015.1.normal/output.js index 3bc873253e6..3991f8d3a4a 100644 --- a/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/enumAssignability/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/enumAssignability/input.ts/es2015.1.normal/output.js @@ -1,12 +1,12 @@ var // enums assignable to number, any, Object, errors unless otherwise noted E; -(function(E1) { - E1[E1["A"] = 0] = "A"; +(function(E) { + E[E["A"] = 0] = "A"; })(E || (E = { })); var F; -(function(F1) { - F1[F1["B"] = 0] = "B"; +(function(F) { + F[F["B"] = 0] = "B"; })(F || (F = { })); var e = E.A; diff --git a/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/enumAssignability/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/enumAssignability/input.ts/es2015.2.minified/output.js index 2010c58c52d..23983d411eb 100644 --- a/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/enumAssignability/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/enumAssignability/input.ts/es2015.2.minified/output.js @@ -1,5 +1,5 @@ -(E = E1 || (E1 = { -}))[E.A = 0] = "A", (F = F1 || (F1 = { +(E = E || (E = { +}))[E.A = 0] = "A", (F = F || (F = { }))[F.B = 0] = "B"; -var E, F, E1, F1, e = E1.A, f = F1.B; +var E, F, E, F, e = E.A, f = F.B; f = f, f = 1; diff --git a/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/enumAssignability/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/enumAssignability/input.ts/es5.1.normal/output.js index a22e45ee84d..8dceaada618 100644 --- a/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/enumAssignability/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/enumAssignability/input.ts/es5.1.normal/output.js @@ -5,13 +5,13 @@ function _classCallCheck(instance, Constructor) { } var // enums assignable to number, any, Object, errors unless otherwise noted E; -(function(E1) { - E1[E1["A"] = 0] = "A"; +(function(E) { + E[E["A"] = 0] = "A"; })(E || (E = { })); var F; -(function(F1) { - F1[F1["B"] = 0] = "B"; +(function(F) { + F[F["B"] = 0] = "B"; })(F || (F = { })); var e = E.A; diff --git a/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/enumAssignability/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/enumAssignability/input.ts/es5.2.minified/output.js index 5ab7ccb29e4..0ef61e2efba 100644 --- a/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/enumAssignability/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/enumAssignability/input.ts/es5.2.minified/output.js @@ -1,7 +1,7 @@ -(E = E1 || (E1 = { -}))[E.A = 0] = "A", (F = F1 || (F1 = { +(E = E || (E = { +}))[E.A = 0] = "A", (F = F || (F = { }))[F.B = 0] = "B"; -var E, F, E1, F1, Others, e = E1.A, f = F1.B; +var E, F, E, F, Others, e = E.A, f = F.B; f = f, f = 1, (function(Others) { var C = function() { "use strict"; diff --git a/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/enumAssignabilityInInheritance/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/enumAssignabilityInInheritance/input.ts/es2015.1.normal/output.js index f03a8c2a128..0c71d7cf873 100644 --- a/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/enumAssignabilityInInheritance/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/enumAssignabilityInInheritance/input.ts/es2015.1.normal/output.js @@ -1,7 +1,7 @@ var // enum is only a subtype of number, no types are subtypes of enum, all of these except the first are errors E; -(function(E1) { - E1[E1["A"] = 0] = "A"; +(function(E) { + E[E["A"] = 0] = "A"; })(E || (E = { })); var r = foo(E.A); // E @@ -23,8 +23,8 @@ var r4 = foo10(E.A); var r4 = foo11(E.A); var r4 = foo12(E.A); var E2; -(function(E21) { - E21[E21["A"] = 0] = "A"; +(function(E2) { + E2[E2["A"] = 0] = "A"; })(E2 || (E2 = { })); var r4 = foo13(E.A); diff --git a/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/enumAssignabilityInInheritance/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/enumAssignabilityInInheritance/input.ts/es2015.2.minified/output.js index 7509ab23fcc..6ae6cfa5f65 100644 --- a/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/enumAssignabilityInInheritance/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/enumAssignabilityInInheritance/input.ts/es2015.2.minified/output.js @@ -1,11 +1,11 @@ -var E, E1, E2, E21; +var E, E, E2, E2; function f() { } -(E = E1 || (E1 = { -}))[E.A = 0] = "A", foo(E1.A), foo(1), foo(null), foo2(E1.A), foo3(E1.A), foo4(E1.A), foo5(E1.A), foo6(E1.A), foo7(E1.A), foo8(E1.A), foo9(E1.A), foo10(E1.A), foo11(E1.A), foo12(E1.A), (E21 = E2 || (E2 = { -}))[E21.A = 0] = "A", foo13(E1.A), (f || (f = { -})).bar = 1, foo14(E1.A); +(E = E || (E = { +}))[E.A = 0] = "A", foo(E.A), foo(1), foo(null), foo2(E.A), foo3(E.A), foo4(E.A), foo5(E.A), foo6(E.A), foo7(E.A), foo8(E.A), foo9(E.A), foo10(E.A), foo11(E.A), foo12(E.A), (E2 = E2 || (E2 = { +}))[E2.A = 0] = "A", foo13(E.A), (f || (f = { +})).bar = 1, foo14(E.A); class CC { } (CC || (CC = { -})).bar = 1, foo15(E1.A), foo16(E1.A), foo16(E1.A); +})).bar = 1, foo15(E.A), foo16(E.A), foo16(E.A); diff --git a/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/enumAssignabilityInInheritance/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/enumAssignabilityInInheritance/input.ts/es5.1.normal/output.js index 2e4b5369212..71acee3973e 100644 --- a/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/enumAssignabilityInInheritance/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/enumAssignabilityInInheritance/input.ts/es5.1.normal/output.js @@ -5,8 +5,8 @@ function _classCallCheck(instance, Constructor) { } var // enum is only a subtype of number, no types are subtypes of enum, all of these except the first are errors E; -(function(E1) { - E1[E1["A"] = 0] = "A"; +(function(E) { + E[E["A"] = 0] = "A"; })(E || (E = { })); var r = foo(E.A); // E @@ -32,8 +32,8 @@ var r4 = foo10(E.A); var r4 = foo11(E.A); var r4 = foo12(E.A); var E2; -(function(E21) { - E21[E21["A"] = 0] = "A"; +(function(E2) { + E2[E2["A"] = 0] = "A"; })(E2 || (E2 = { })); var r4 = foo13(E.A); diff --git a/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/enumAssignabilityInInheritance/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/enumAssignabilityInInheritance/input.ts/es5.2.minified/output.js index 6bc3b5bf10d..9c8648f5797 100644 --- a/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/enumAssignabilityInInheritance/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/enumAssignabilityInInheritance/input.ts/es5.2.minified/output.js @@ -1,25 +1,25 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function"); } -(E = E1 || (E1 = { -}))[E.A = 0] = "A", foo(E1.A), foo(1), foo(null), foo2(E1.A), foo3(E1.A), foo4(E1.A), foo5(E1.A), foo6(E1.A), foo7(E1.A), foo8(E1.A); +(E = E || (E = { +}))[E.A = 0] = "A", foo(E.A), foo(1), foo(null), foo2(E.A), foo3(E.A), foo4(E.A), foo5(E.A), foo6(E.A), foo7(E.A), foo8(E.A); var A = function() { "use strict"; _classCallCheck(this, A); }; -foo9(E1.A); +foo9(E.A); var A2 = function() { "use strict"; _classCallCheck(this, A2); }; function f() { } -foo10(E1.A), foo11(E1.A), foo12(E1.A), (E21 = E2 || (E2 = { -}))[E21.A = 0] = "A", foo13(E1.A), (f || (f = { -})).bar = 1, foo14(E1.A); -var E, E1, E2, E21, CC = function() { +foo10(E.A), foo11(E.A), foo12(E.A), (E2 = E2 || (E2 = { +}))[E2.A = 0] = "A", foo13(E.A), (f || (f = { +})).bar = 1, foo14(E.A); +var E, E, E2, E2, CC = function() { "use strict"; _classCallCheck(this, CC); }; (CC || (CC = { -})).bar = 1, foo15(E1.A), foo16(E1.A), foo16(E1.A); +})).bar = 1, foo15(E.A), foo16(E.A), foo16(E.A); diff --git a/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/everyTypeAssignableToAny/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/everyTypeAssignableToAny/input.ts/es2015.1.normal/output.js index a740bf9807f..e57401fa945 100644 --- a/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/everyTypeAssignableToAny/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/everyTypeAssignableToAny/input.ts/es2015.1.normal/output.js @@ -4,8 +4,8 @@ class C { var ac; var ai; var E; -(function(E1) { - E1[E1["A"] = 0] = "A"; +(function(E) { + E[E["A"] = 0] = "A"; })(E || (E = { })); var ae; diff --git a/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/everyTypeAssignableToAny/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/everyTypeAssignableToAny/input.ts/es2015.2.minified/output.js index 47941337af4..4dac4549ce1 100644 --- a/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/everyTypeAssignableToAny/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/everyTypeAssignableToAny/input.ts/es2015.2.minified/output.js @@ -1,3 +1,3 @@ -var E, E1; -(E1 = E || (E = { -}))[E1.A = 0] = "A"; +var E, E; +(E = E || (E = { +}))[E.A = 0] = "A"; diff --git a/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/everyTypeAssignableToAny/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/everyTypeAssignableToAny/input.ts/es5.1.normal/output.js index b220c643469..19c1e167bf5 100644 --- a/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/everyTypeAssignableToAny/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/everyTypeAssignableToAny/input.ts/es5.1.normal/output.js @@ -11,8 +11,8 @@ var C = function C() { var ac; var ai; var E; -(function(E1) { - E1[E1["A"] = 0] = "A"; +(function(E) { + E[E["A"] = 0] = "A"; })(E || (E = { })); var ae; diff --git a/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/everyTypeAssignableToAny/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/everyTypeAssignableToAny/input.ts/es5.2.minified/output.js index 74f67cb635e..b3226de6741 100644 --- a/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/everyTypeAssignableToAny/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/everyTypeAssignableToAny/input.ts/es5.2.minified/output.js @@ -1,8 +1,8 @@ -var E, E1, C = function() { +var E, E, C = function() { "use strict"; !function(instance, Constructor) { if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function"); }(this, C); }; -(E1 = E || (E = { -}))[E1.A = 0] = "A"; +(E = E || (E = { +}))[E.A = 0] = "A"; diff --git a/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/nullAssignableToEveryType/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/nullAssignableToEveryType/input.ts/es2015.1.normal/output.js index 7d6906739d3..cf34e4601c7 100644 --- a/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/nullAssignableToEveryType/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/nullAssignableToEveryType/input.ts/es2015.1.normal/output.js @@ -3,8 +3,8 @@ class C { var ac; var ai; var E; -(function(E1) { - E1[E1["A"] = 0] = "A"; +(function(E) { + E[E["A"] = 0] = "A"; })(E || (E = { })); var ae; diff --git a/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/nullAssignableToEveryType/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/nullAssignableToEveryType/input.ts/es2015.2.minified/output.js index 52b1e98a3af..4dac4549ce1 100644 --- a/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/nullAssignableToEveryType/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/nullAssignableToEveryType/input.ts/es2015.2.minified/output.js @@ -1,3 +1,3 @@ -var E, E1; -(E = E1 || (E1 = { +var E, E; +(E = E || (E = { }))[E.A = 0] = "A"; diff --git a/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/nullAssignableToEveryType/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/nullAssignableToEveryType/input.ts/es5.1.normal/output.js index f5bbaa2c8c2..0ac07f2cda3 100644 --- a/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/nullAssignableToEveryType/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/nullAssignableToEveryType/input.ts/es5.1.normal/output.js @@ -10,8 +10,8 @@ var C = function C() { var ac; var ai; var E; -(function(E1) { - E1[E1["A"] = 0] = "A"; +(function(E) { + E[E["A"] = 0] = "A"; })(E || (E = { })); var ae; diff --git a/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/nullAssignableToEveryType/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/nullAssignableToEveryType/input.ts/es5.2.minified/output.js index 74f67cb635e..b3226de6741 100644 --- a/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/nullAssignableToEveryType/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/nullAssignableToEveryType/input.ts/es5.2.minified/output.js @@ -1,8 +1,8 @@ -var E, E1, C = function() { +var E, E, C = function() { "use strict"; !function(instance, Constructor) { if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function"); }(this, C); }; -(E1 = E || (E = { -}))[E1.A = 0] = "A"; +(E = E || (E = { +}))[E.A = 0] = "A"; diff --git a/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/numberAssignableToEnum/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/numberAssignableToEnum/input.ts/es2015.1.normal/output.js index c9c12990036..cefe0f1649e 100644 --- a/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/numberAssignableToEnum/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/numberAssignableToEnum/input.ts/es2015.1.normal/output.js @@ -1,6 +1,6 @@ var E; -(function(E1) { - E1[E1["A"] = 0] = "A"; +(function(E) { + E[E["A"] = 0] = "A"; })(E || (E = { })); var n; diff --git a/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/numberAssignableToEnum/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/numberAssignableToEnum/input.ts/es2015.2.minified/output.js index 54aeb81c169..d582b5a4a25 100644 --- a/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/numberAssignableToEnum/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/numberAssignableToEnum/input.ts/es2015.2.minified/output.js @@ -1,3 +1,3 @@ -var E, n, E1; -(E1 = E || (E = { -}))[E1.A = 0] = "A", n = n; +var E, n, E; +(E = E || (E = { +}))[E.A = 0] = "A", n = n; diff --git a/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/numberAssignableToEnum/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/numberAssignableToEnum/input.ts/es5.1.normal/output.js index c9c12990036..cefe0f1649e 100644 --- a/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/numberAssignableToEnum/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/numberAssignableToEnum/input.ts/es5.1.normal/output.js @@ -1,6 +1,6 @@ var E; -(function(E1) { - E1[E1["A"] = 0] = "A"; +(function(E) { + E[E["A"] = 0] = "A"; })(E || (E = { })); var n; diff --git a/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/numberAssignableToEnum/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/numberAssignableToEnum/input.ts/es5.2.minified/output.js index 54aeb81c169..d582b5a4a25 100644 --- a/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/numberAssignableToEnum/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/numberAssignableToEnum/input.ts/es5.2.minified/output.js @@ -1,3 +1,3 @@ -var E, n, E1; -(E1 = E || (E = { -}))[E1.A = 0] = "A", n = n; +var E, n, E; +(E = E || (E = { +}))[E.A = 0] = "A", n = n; diff --git a/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/undefinedAssignableToEveryType/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/undefinedAssignableToEveryType/input.ts/es2015.1.normal/output.js index aa63803fc67..550ef7d2fe7 100644 --- a/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/undefinedAssignableToEveryType/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/undefinedAssignableToEveryType/input.ts/es2015.1.normal/output.js @@ -3,8 +3,8 @@ class C { var ac; var ai; var E; -(function(E1) { - E1[E1["A"] = 0] = "A"; +(function(E) { + E[E["A"] = 0] = "A"; })(E || (E = { })); var ae; diff --git a/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/undefinedAssignableToEveryType/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/undefinedAssignableToEveryType/input.ts/es2015.2.minified/output.js index 52b1e98a3af..4dac4549ce1 100644 --- a/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/undefinedAssignableToEveryType/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/undefinedAssignableToEveryType/input.ts/es2015.2.minified/output.js @@ -1,3 +1,3 @@ -var E, E1; -(E = E1 || (E1 = { +var E, E; +(E = E || (E = { }))[E.A = 0] = "A"; diff --git a/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/undefinedAssignableToEveryType/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/undefinedAssignableToEveryType/input.ts/es5.1.normal/output.js index e3585efb8be..04a965730b5 100644 --- a/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/undefinedAssignableToEveryType/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/undefinedAssignableToEveryType/input.ts/es5.1.normal/output.js @@ -10,8 +10,8 @@ var C = function C() { var ac; var ai; var E; -(function(E1) { - E1[E1["A"] = 0] = "A"; +(function(E) { + E[E["A"] = 0] = "A"; })(E || (E = { })); var ae; diff --git a/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/undefinedAssignableToEveryType/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/undefinedAssignableToEveryType/input.ts/es5.2.minified/output.js index 74f67cb635e..b3226de6741 100644 --- a/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/undefinedAssignableToEveryType/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/types/typeRelationships/assignmentCompatibility/undefinedAssignableToEveryType/input.ts/es5.2.minified/output.js @@ -1,8 +1,8 @@ -var E, E1, C = function() { +var E, E, C = function() { "use strict"; !function(instance, Constructor) { if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function"); }(this, C); }; -(E1 = E || (E = { -}))[E1.A = 0] = "A"; +(E = E || (E = { +}))[E.A = 0] = "A"; diff --git a/crates/swc/tests/tsc-references/types/typeRelationships/bestCommonType/bestCommonTypeOfTuple/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/types/typeRelationships/bestCommonType/bestCommonTypeOfTuple/input.ts/es2015.1.normal/output.js index 98d72073c14..a3bc98c01d2 100644 --- a/crates/swc/tests/tsc-references/types/typeRelationships/bestCommonType/bestCommonTypeOfTuple/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/types/typeRelationships/bestCommonType/bestCommonTypeOfTuple/input.ts/es2015.1.normal/output.js @@ -8,13 +8,13 @@ function f3(x) { return true; } var E1; -(function(E11) { - E11[E11["one"] = 0] = "one"; +(function(E1) { + E1[E1["one"] = 0] = "one"; })(E1 || (E1 = { })); var E2; -(function(E21) { - E21[E21["two"] = 0] = "two"; +(function(E2) { + E2[E2["two"] = 0] = "two"; })(E2 || (E2 = { })); var t1; diff --git a/crates/swc/tests/tsc-references/types/typeRelationships/bestCommonType/bestCommonTypeOfTuple/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/types/typeRelationships/bestCommonType/bestCommonTypeOfTuple/input.ts/es2015.2.minified/output.js index c9ae71c687c..5a0c2351171 100644 --- a/crates/swc/tests/tsc-references/types/typeRelationships/bestCommonType/bestCommonTypeOfTuple/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/types/typeRelationships/bestCommonType/bestCommonTypeOfTuple/input.ts/es2015.2.minified/output.js @@ -1,6 +1,6 @@ -var E1, E2, E11, E21, t1, t2, t3, t4; -(E1 = E11 || (E11 = { -}))[E1.one = 0] = "one", (E2 = E21 || (E21 = { +var E1, E2, E1, E2, t1, t2, t3, t4; +(E1 = E1 || (E1 = { +}))[E1.one = 0] = "one", (E2 = E2 || (E2 = { }))[E2.two = 0] = "two", t1 = [ function(x) { return "foo"; @@ -9,13 +9,13 @@ var E1, E2, E11, E21, t1, t2, t3, t4; return 10; } ], t2 = [ - E11.one, - E21.two + E1.one, + E2.two ], t3 = [ 5, void 0 ], t4 = [ - E11.one, - E21.two, + E1.one, + E2.two, 20 ], t1[2], t2[2], t3[2], t4[3]; diff --git a/crates/swc/tests/tsc-references/types/typeRelationships/bestCommonType/bestCommonTypeOfTuple/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/types/typeRelationships/bestCommonType/bestCommonTypeOfTuple/input.ts/es5.1.normal/output.js index 98d72073c14..a3bc98c01d2 100644 --- a/crates/swc/tests/tsc-references/types/typeRelationships/bestCommonType/bestCommonTypeOfTuple/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/types/typeRelationships/bestCommonType/bestCommonTypeOfTuple/input.ts/es5.1.normal/output.js @@ -8,13 +8,13 @@ function f3(x) { return true; } var E1; -(function(E11) { - E11[E11["one"] = 0] = "one"; +(function(E1) { + E1[E1["one"] = 0] = "one"; })(E1 || (E1 = { })); var E2; -(function(E21) { - E21[E21["two"] = 0] = "two"; +(function(E2) { + E2[E2["two"] = 0] = "two"; })(E2 || (E2 = { })); var t1; diff --git a/crates/swc/tests/tsc-references/types/typeRelationships/bestCommonType/bestCommonTypeOfTuple/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/types/typeRelationships/bestCommonType/bestCommonTypeOfTuple/input.ts/es5.2.minified/output.js index c9ae71c687c..5a0c2351171 100644 --- a/crates/swc/tests/tsc-references/types/typeRelationships/bestCommonType/bestCommonTypeOfTuple/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/types/typeRelationships/bestCommonType/bestCommonTypeOfTuple/input.ts/es5.2.minified/output.js @@ -1,6 +1,6 @@ -var E1, E2, E11, E21, t1, t2, t3, t4; -(E1 = E11 || (E11 = { -}))[E1.one = 0] = "one", (E2 = E21 || (E21 = { +var E1, E2, E1, E2, t1, t2, t3, t4; +(E1 = E1 || (E1 = { +}))[E1.one = 0] = "one", (E2 = E2 || (E2 = { }))[E2.two = 0] = "two", t1 = [ function(x) { return "foo"; @@ -9,13 +9,13 @@ var E1, E2, E11, E21, t1, t2, t3, t4; return 10; } ], t2 = [ - E11.one, - E21.two + E1.one, + E2.two ], t3 = [ 5, void 0 ], t4 = [ - E11.one, - E21.two, + E1.one, + E2.two, 20 ], t1[2], t2[2], t3[2], t4[3]; diff --git a/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/enumIsNotASubtypeOfAnythingButNumber/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/enumIsNotASubtypeOfAnythingButNumber/input.ts/es2015.1.normal/output.js index 307cb730c6c..a5c74686679 100644 --- a/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/enumIsNotASubtypeOfAnythingButNumber/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/enumIsNotASubtypeOfAnythingButNumber/input.ts/es2015.1.normal/output.js @@ -1,7 +1,7 @@ var // enums are only subtypes of number, any and no other types E; -(function(E1) { - E1[E1["A"] = 0] = "A"; +(function(E) { + E[E["A"] = 0] = "A"; })(E || (E = { })); class A { @@ -9,8 +9,8 @@ class A { class A2 { } var E2; -(function(E21) { - E21[E21["A"] = 0] = "A"; +(function(E2) { + E2[E2["A"] = 0] = "A"; })(E2 || (E2 = { })); function f() { diff --git a/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/enumIsNotASubtypeOfAnythingButNumber/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/enumIsNotASubtypeOfAnythingButNumber/input.ts/es2015.2.minified/output.js index 76ccc74aec7..52b7e57538e 100644 --- a/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/enumIsNotASubtypeOfAnythingButNumber/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/enumIsNotASubtypeOfAnythingButNumber/input.ts/es2015.2.minified/output.js @@ -1,9 +1,9 @@ -var E, E2, E1, E21; +var E, E2, E, E2; function f() { } -(E1 = E || (E = { -}))[E1.A = 0] = "A", (E21 = E2 || (E2 = { -}))[E21.A = 0] = "A", (f || (f = { +(E = E || (E = { +}))[E.A = 0] = "A", (E2 = E2 || (E2 = { +}))[E2.A = 0] = "A", (f || (f = { })).bar = 1; class c { } diff --git a/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/enumIsNotASubtypeOfAnythingButNumber/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/enumIsNotASubtypeOfAnythingButNumber/input.ts/es5.1.normal/output.js index c4534175879..6c6e3522cc3 100644 --- a/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/enumIsNotASubtypeOfAnythingButNumber/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/enumIsNotASubtypeOfAnythingButNumber/input.ts/es5.1.normal/output.js @@ -5,8 +5,8 @@ function _classCallCheck(instance, Constructor) { } var // enums are only subtypes of number, any and no other types E; -(function(E1) { - E1[E1["A"] = 0] = "A"; +(function(E) { + E[E["A"] = 0] = "A"; })(E || (E = { })); var A = function A() { @@ -18,8 +18,8 @@ var A2 = function A2() { _classCallCheck(this, A2); }; var E2; -(function(E21) { - E21[E21["A"] = 0] = "A"; +(function(E2) { + E2[E2["A"] = 0] = "A"; })(E2 || (E2 = { })); function f() { diff --git a/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/enumIsNotASubtypeOfAnythingButNumber/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/enumIsNotASubtypeOfAnythingButNumber/input.ts/es5.2.minified/output.js index 1e2be045421..b5c64ffecb3 100644 --- a/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/enumIsNotASubtypeOfAnythingButNumber/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/enumIsNotASubtypeOfAnythingButNumber/input.ts/es5.2.minified/output.js @@ -1,9 +1,9 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function"); } -(E = E1 || (E1 = { +(E = E || (E = { }))[E.A = 0] = "A"; -var E, E1, E2, E21, A = function() { +var E, E, E2, E2, A = function() { "use strict"; _classCallCheck(this, A); }, A2 = function() { @@ -12,8 +12,8 @@ var E, E1, E2, E21, A = function() { }; function f() { } -(E21 = E2 || (E2 = { -}))[E21.A = 0] = "A", (f || (f = { +(E2 = E2 || (E2 = { +}))[E2.A = 0] = "A", (f || (f = { })).bar = 1; var c = function() { "use strict"; diff --git a/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/nullIsSubtypeOfEverythingButUndefined/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/nullIsSubtypeOfEverythingButUndefined/input.ts/es2015.1.normal/output.js index 6cb09258302..c55c20b43c8 100644 --- a/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/nullIsSubtypeOfEverythingButUndefined/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/nullIsSubtypeOfEverythingButUndefined/input.ts/es2015.1.normal/output.js @@ -44,8 +44,8 @@ var c2; var r12 = true ? c2 : null; var r12 = true ? null : c2; var E; -(function(E1) { - E1[E1["A"] = 0] = "A"; +(function(E) { + E[E["A"] = 0] = "A"; })(E || (E = { })); var r13 = true ? E : null; diff --git a/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/nullIsSubtypeOfEverythingButUndefined/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/nullIsSubtypeOfEverythingButUndefined/input.ts/es2015.2.minified/output.js index 04898585c2a..ef919fe3a0e 100644 --- a/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/nullIsSubtypeOfEverythingButUndefined/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/nullIsSubtypeOfEverythingButUndefined/input.ts/es2015.2.minified/output.js @@ -1,8 +1,8 @@ -var E, E1; +var E, E; function f() { } -new Date(), (E1 = E || (E = { -}))[E1.A = 0] = "A", E.A, (f || (f = { +new Date(), (E = E || (E = { +}))[E.A = 0] = "A", E.A, (f || (f = { })).bar = 1; class c { } diff --git a/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/nullIsSubtypeOfEverythingButUndefined/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/nullIsSubtypeOfEverythingButUndefined/input.ts/es5.1.normal/output.js index 25f2ffa8e20..edc3520304c 100644 --- a/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/nullIsSubtypeOfEverythingButUndefined/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/nullIsSubtypeOfEverythingButUndefined/input.ts/es5.1.normal/output.js @@ -53,8 +53,8 @@ var c2; var r12 = true ? c2 : null; var r12 = true ? null : c2; var E; -(function(E1) { - E1[E1["A"] = 0] = "A"; +(function(E) { + E[E["A"] = 0] = "A"; })(E || (E = { })); var r13 = true ? E : null; diff --git a/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/nullIsSubtypeOfEverythingButUndefined/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/nullIsSubtypeOfEverythingButUndefined/input.ts/es5.2.minified/output.js index b6d57507ac8..a0b43bfe47e 100644 --- a/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/nullIsSubtypeOfEverythingButUndefined/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/nullIsSubtypeOfEverythingButUndefined/input.ts/es5.2.minified/output.js @@ -11,10 +11,10 @@ var C1 = function() { }; function f() { } -(E1 = E || (E = { -}))[E1.A = 0] = "A", (f || (f = { +(E = E || (E = { +}))[E.A = 0] = "A", (f || (f = { })).bar = 1; -var E, E1, c = function() { +var E, E, c = function() { "use strict"; _classCallCheck(this, c); }; diff --git a/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/stringLiteralTypeIsSubtypeOfString/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/stringLiteralTypeIsSubtypeOfString/input.ts/es2015.1.normal/output.js index 9cd6b389d2a..6dfbf7cdcbc 100644 --- a/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/stringLiteralTypeIsSubtypeOfString/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/stringLiteralTypeIsSubtypeOfString/input.ts/es2015.1.normal/output.js @@ -87,8 +87,8 @@ function f12(x) { function f13(x) { } var E; -(function(E1) { - E1[E1["A"] = 0] = "A"; +(function(E) { + E[E["A"] = 0] = "A"; })(E || (E = { })); function f14(x) { diff --git a/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/stringLiteralTypeIsSubtypeOfString/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/stringLiteralTypeIsSubtypeOfString/input.ts/es2015.2.minified/output.js index 47941337af4..4dac4549ce1 100644 --- a/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/stringLiteralTypeIsSubtypeOfString/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/stringLiteralTypeIsSubtypeOfString/input.ts/es2015.2.minified/output.js @@ -1,3 +1,3 @@ -var E, E1; -(E1 = E || (E = { -}))[E1.A = 0] = "A"; +var E, E; +(E = E || (E = { +}))[E.A = 0] = "A"; diff --git a/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/stringLiteralTypeIsSubtypeOfString/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/stringLiteralTypeIsSubtypeOfString/input.ts/es5.1.normal/output.js index 33d15fb1689..d80862f5c27 100644 --- a/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/stringLiteralTypeIsSubtypeOfString/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/stringLiteralTypeIsSubtypeOfString/input.ts/es5.1.normal/output.js @@ -176,8 +176,8 @@ function f12(x) { function f13(x) { } var E; -(function(E1) { - E1[E1["A"] = 0] = "A"; +(function(E) { + E[E["A"] = 0] = "A"; })(E || (E = { })); function f14(x) { diff --git a/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/stringLiteralTypeIsSubtypeOfString/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/stringLiteralTypeIsSubtypeOfString/input.ts/es5.2.minified/output.js index 4b1fc473255..102d28d3694 100644 --- a/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/stringLiteralTypeIsSubtypeOfString/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/stringLiteralTypeIsSubtypeOfString/input.ts/es5.2.minified/output.js @@ -4,7 +4,7 @@ function _defineProperties(target, props) { descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor); } } -var E, E1, C = function() { +var E, E, C = function() { "use strict"; var Constructor, protoProps, staticProps; function C() { @@ -136,5 +136,5 @@ var E, E1, C = function() { } ], _defineProperties(Constructor.prototype, protoProps), staticProps && _defineProperties(Constructor, staticProps), C; }(); -(E = E1 || (E1 = { +(E = E || (E = { }))[E.A = 0] = "A"; diff --git a/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/subtypesOfAny/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/subtypesOfAny/input.ts/es2015.1.normal/output.js index b3f62a9d8f8..b9dceab40b3 100644 --- a/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/subtypesOfAny/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/subtypesOfAny/input.ts/es2015.1.normal/output.js @@ -3,8 +3,8 @@ class A { class A2 { } var E; -(function(E1) { - E1[E1["A"] = 0] = "A"; +(function(E) { + E[E["A"] = 0] = "A"; })(E || (E = { })); function f() { diff --git a/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/subtypesOfAny/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/subtypesOfAny/input.ts/es2015.2.minified/output.js index df33eeb3a94..a2e87ad744c 100644 --- a/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/subtypesOfAny/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/subtypesOfAny/input.ts/es2015.2.minified/output.js @@ -1,8 +1,8 @@ -var E, E1; +var E, E; function f() { } -(E1 = E || (E = { -}))[E1.A = 0] = "A", (f || (f = { +(E = E || (E = { +}))[E.A = 0] = "A", (f || (f = { })).bar = 1; class c { } diff --git a/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/subtypesOfAny/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/subtypesOfAny/input.ts/es5.1.normal/output.js index ed1f4d75df5..7d7a80f1b39 100644 --- a/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/subtypesOfAny/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/subtypesOfAny/input.ts/es5.1.normal/output.js @@ -12,8 +12,8 @@ var A2 = function A2() { _classCallCheck(this, A2); }; var E; -(function(E1) { - E1[E1["A"] = 0] = "A"; +(function(E) { + E[E["A"] = 0] = "A"; })(E || (E = { })); function f() { diff --git a/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/subtypesOfAny/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/subtypesOfAny/input.ts/es5.2.minified/output.js index e2381a729ad..6507a42018d 100644 --- a/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/subtypesOfAny/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/subtypesOfAny/input.ts/es5.2.minified/output.js @@ -1,7 +1,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function"); } -var E, E1, A = function() { +var E, E, A = function() { "use strict"; _classCallCheck(this, A); }, A2 = function() { @@ -10,8 +10,8 @@ var E, E1, A = function() { }; function f() { } -(E1 = E || (E = { -}))[E1.A = 0] = "A", (f || (f = { +(E = E || (E = { +}))[E.A = 0] = "A", (f || (f = { })).bar = 1; var c = function() { "use strict"; diff --git a/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameter/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameter/input.ts/es2015.1.normal/output.js index 82fd119d988..b550934df1e 100644 --- a/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameter/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameter/input.ts/es2015.1.normal/output.js @@ -12,8 +12,8 @@ class C1 { class C2 { } var E; -(function(E1) { - E1[E1["A"] = 0] = "A"; +(function(E) { + E[E["A"] = 0] = "A"; })(E || (E = { })); function f() { diff --git a/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameter/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameter/input.ts/es2015.2.minified/output.js index df33eeb3a94..a2e87ad744c 100644 --- a/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameter/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameter/input.ts/es2015.2.minified/output.js @@ -1,8 +1,8 @@ -var E, E1; +var E, E; function f() { } -(E1 = E || (E = { -}))[E1.A = 0] = "A", (f || (f = { +(E = E || (E = { +}))[E.A = 0] = "A", (f || (f = { })).bar = 1; class c { } diff --git a/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameter/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameter/input.ts/es5.1.normal/output.js index 12c3c049105..3b3e6feca84 100644 --- a/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameter/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameter/input.ts/es5.1.normal/output.js @@ -96,8 +96,8 @@ var C2 = function C2() { _classCallCheck(this, C2); }; var E; -(function(E1) { - E1[E1["A"] = 0] = "A"; +(function(E) { + E[E["A"] = 0] = "A"; })(E || (E = { })); function f() { diff --git a/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameter/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameter/input.ts/es5.2.minified/output.js index 90731b223a1..68e946ed516 100644 --- a/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameter/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameter/input.ts/es5.2.minified/output.js @@ -11,7 +11,7 @@ function _setPrototypeOf(o, p) { return o.__proto__ = p, o; }, _setPrototypeOf(o, p); } -var E, E1, _typeof = function(obj) { +var E, E, _typeof = function(obj) { return obj && "undefined" != typeof Symbol && obj.constructor === Symbol ? "symbol" : typeof obj; }, C3 = function() { "use strict"; @@ -65,8 +65,8 @@ var E, E1, _typeof = function(obj) { }; function f() { } -(E1 = E || (E = { -}))[E1.A = 0] = "A", (f || (f = { +(E = E || (E = { +}))[E.A = 0] = "A", (f || (f = { })).bar = 1; var c = function() { "use strict"; diff --git a/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints2/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints2/input.ts/es2015.1.normal/output.js index 61ceef3a906..b644f0f365c 100644 --- a/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints2/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints2/input.ts/es2015.1.normal/output.js @@ -30,8 +30,8 @@ class C1 { class C2 { } var E; -(function(E1) { - E1[E1["A"] = 0] = "A"; +(function(E) { + E[E["A"] = 0] = "A"; })(E || (E = { })); function f() { diff --git a/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints2/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints2/input.ts/es2015.2.minified/output.js index df33eeb3a94..a2e87ad744c 100644 --- a/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints2/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints2/input.ts/es2015.2.minified/output.js @@ -1,8 +1,8 @@ -var E, E1; +var E, E; function f() { } -(E1 = E || (E = { -}))[E1.A = 0] = "A", (f || (f = { +(E = E || (E = { +}))[E.A = 0] = "A", (f || (f = { })).bar = 1; class c { } diff --git a/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints2/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints2/input.ts/es5.1.normal/output.js index 98647ab4c8d..a17521d950e 100644 --- a/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints2/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints2/input.ts/es5.1.normal/output.js @@ -39,8 +39,8 @@ var C2 = function C2() { _classCallCheck(this, C2); }; var E; -(function(E1) { - E1[E1["A"] = 0] = "A"; +(function(E) { + E[E["A"] = 0] = "A"; })(E || (E = { })); function f() { diff --git a/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints2/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints2/input.ts/es5.2.minified/output.js index 48eaff5cea6..c7cb0708913 100644 --- a/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints2/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints2/input.ts/es5.2.minified/output.js @@ -1,7 +1,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function"); } -var E, E1, C1 = function() { +var E, E, C1 = function() { "use strict"; _classCallCheck(this, C1); }, C2 = function() { @@ -10,8 +10,8 @@ var E, E1, C1 = function() { }; function f() { } -(E1 = E || (E = { -}))[E1.A = 0] = "A", (f || (f = { +(E = E || (E = { +}))[E.A = 0] = "A", (f || (f = { })).bar = 1; var c = function() { "use strict"; diff --git a/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/subtypesOfUnion/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/subtypesOfUnion/input.ts/es2015.1.normal/output.js index e33b3f621b5..1c6e8937aaa 100644 --- a/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/subtypesOfUnion/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/subtypesOfUnion/input.ts/es2015.1.normal/output.js @@ -1,7 +1,7 @@ var E; -(function(E1) { - E1[E1["e1"] = 0] = "e1"; - E1[E1["e2"] = 1] = "e2"; +(function(E) { + E[E["e1"] = 0] = "e1"; + E[E["e2"] = 1] = "e2"; })(E || (E = { })); class A { diff --git a/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/subtypesOfUnion/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/subtypesOfUnion/input.ts/es2015.2.minified/output.js index 9f5130d2b74..2eec6bd9537 100644 --- a/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/subtypesOfUnion/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/subtypesOfUnion/input.ts/es2015.2.minified/output.js @@ -1,8 +1,8 @@ -var E, E1; +var E, E; function f() { } -(E1 = E || (E = { -}))[E1.e1 = 0] = "e1", E1[E1.e2 = 1] = "e2", (f || (f = { +(E = E || (E = { +}))[E.e1 = 0] = "e1", E[E.e2 = 1] = "e2", (f || (f = { })).bar = 1; class c { } diff --git a/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/subtypesOfUnion/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/subtypesOfUnion/input.ts/es5.1.normal/output.js index a23d860a48d..cca4cf1c187 100644 --- a/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/subtypesOfUnion/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/subtypesOfUnion/input.ts/es5.1.normal/output.js @@ -4,9 +4,9 @@ function _classCallCheck(instance, Constructor) { } } var E; -(function(E1) { - E1[E1["e1"] = 0] = "e1"; - E1[E1["e2"] = 1] = "e2"; +(function(E) { + E[E["e1"] = 0] = "e1"; + E[E["e2"] = 1] = "e2"; })(E || (E = { })); var A = function A() { diff --git a/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/subtypesOfUnion/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/subtypesOfUnion/input.ts/es5.2.minified/output.js index ff45c4a6179..df032a577cd 100644 --- a/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/subtypesOfUnion/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/subtypesOfUnion/input.ts/es5.2.minified/output.js @@ -1,9 +1,9 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function"); } -(E = E1 || (E1 = { +(E = E || (E = { }))[E.e1 = 0] = "e1", E[E.e2 = 1] = "e2"; -var E, E1, A = function() { +var E, E, A = function() { "use strict"; _classCallCheck(this, A); }, A2 = function() { diff --git a/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/undefinedIsSubtypeOfEverything/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/undefinedIsSubtypeOfEverything/input.ts/es2015.1.normal/output.js index fcbf717185b..569d98bb7c6 100644 --- a/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/undefinedIsSubtypeOfEverything/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/undefinedIsSubtypeOfEverything/input.ts/es2015.1.normal/output.js @@ -32,8 +32,8 @@ class D9 extends Base { class D10 extends Base { } var E; -(function(E1) { - E1[E1["A"] = 0] = "A"; +(function(E) { + E[E["A"] = 0] = "A"; })(E || (E = { })); class D11 extends Base { diff --git a/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/undefinedIsSubtypeOfEverything/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/undefinedIsSubtypeOfEverything/input.ts/es2015.2.minified/output.js index df33eeb3a94..a2e87ad744c 100644 --- a/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/undefinedIsSubtypeOfEverything/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/undefinedIsSubtypeOfEverything/input.ts/es2015.2.minified/output.js @@ -1,8 +1,8 @@ -var E, E1; +var E, E; function f() { } -(E1 = E || (E = { -}))[E1.A = 0] = "A", (f || (f = { +(E = E || (E = { +}))[E.A = 0] = "A", (f || (f = { })).bar = 1; class c { } diff --git a/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/undefinedIsSubtypeOfEverything/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/undefinedIsSubtypeOfEverything/input.ts/es5.1.normal/output.js index 28b8ea93d54..6ee4a810d26 100644 --- a/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/undefinedIsSubtypeOfEverything/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/undefinedIsSubtypeOfEverything/input.ts/es5.1.normal/output.js @@ -224,8 +224,8 @@ var D10 = /*#__PURE__*/ function(Base) { return D10; }(Base); var E; -(function(E1) { - E1[E1["A"] = 0] = "A"; +(function(E) { + E[E["A"] = 0] = "A"; })(E || (E = { })); var D11 = /*#__PURE__*/ function(Base) { diff --git a/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/undefinedIsSubtypeOfEverything/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/undefinedIsSubtypeOfEverything/input.ts/es5.2.minified/output.js index 50c51106ee8..dd80336202b 100644 --- a/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/undefinedIsSubtypeOfEverything/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/undefinedIsSubtypeOfEverything/input.ts/es5.2.minified/output.js @@ -45,7 +45,7 @@ function _createSuper(Derived) { })(self); }; } -var E, E1, Base = function() { +var E, E, Base = function() { "use strict"; _classCallCheck(this, Base); }, D0 = function(Base1) { @@ -169,8 +169,8 @@ var E, E1, Base = function() { } return D10; }(Base); -(E1 = E || (E = { -}))[E1.A = 0] = "A"; +(E = E || (E = { +}))[E.A = 0] = "A"; var D11 = function(Base16) { "use strict"; _inherits(D11, Base16); diff --git a/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/unionSubtypeIfEveryConstituentTypeIsSubtype/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/unionSubtypeIfEveryConstituentTypeIsSubtype/input.ts/es2015.1.normal/output.js index 7a374a26f5a..7df7acf387b 100644 --- a/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/unionSubtypeIfEveryConstituentTypeIsSubtype/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/unionSubtypeIfEveryConstituentTypeIsSubtype/input.ts/es2015.1.normal/output.js @@ -1,7 +1,7 @@ var e; -(function(e1) { - e1[e1["e1"] = 0] = "e1"; - e1[e1["e2"] = 1] = "e2"; +(function(e) { + e[e["e1"] = 0] = "e1"; + e[e["e2"] = 1] = "e2"; })(e || (e = { })); class A { @@ -9,8 +9,8 @@ class A { class A2 { } var E2; -(function(E21) { - E21[E21["A"] = 0] = "A"; +(function(E2) { + E2[E2["A"] = 0] = "A"; })(E2 || (E2 = { })); function f() { diff --git a/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/unionSubtypeIfEveryConstituentTypeIsSubtype/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/unionSubtypeIfEveryConstituentTypeIsSubtype/input.ts/es2015.2.minified/output.js index 8b1b508caaa..b3c301fab3b 100644 --- a/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/unionSubtypeIfEveryConstituentTypeIsSubtype/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/unionSubtypeIfEveryConstituentTypeIsSubtype/input.ts/es2015.2.minified/output.js @@ -1,9 +1,9 @@ -var e, E2, e1, E21; +var e, E2, e, E2; function f() { } -(e1 = e || (e = { -}))[e1.e1 = 0] = "e1", e1[e1.e2 = 1] = "e2", (E21 = E2 || (E2 = { -}))[E21.A = 0] = "A", (f || (f = { +(e = e || (e = { +}))[e.e1 = 0] = "e1", e[e.e2 = 1] = "e2", (E2 = E2 || (E2 = { +}))[E2.A = 0] = "A", (f || (f = { })).bar = 1; class c { } diff --git a/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/unionSubtypeIfEveryConstituentTypeIsSubtype/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/unionSubtypeIfEveryConstituentTypeIsSubtype/input.ts/es5.1.normal/output.js index 1d2d190f0c9..bccc95a7fce 100644 --- a/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/unionSubtypeIfEveryConstituentTypeIsSubtype/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/unionSubtypeIfEveryConstituentTypeIsSubtype/input.ts/es5.1.normal/output.js @@ -4,9 +4,9 @@ function _classCallCheck(instance, Constructor) { } } var e; -(function(e1) { - e1[e1["e1"] = 0] = "e1"; - e1[e1["e2"] = 1] = "e2"; +(function(e) { + e[e["e1"] = 0] = "e1"; + e[e["e2"] = 1] = "e2"; })(e || (e = { })); var A = function A() { @@ -18,8 +18,8 @@ var A2 = function A2() { _classCallCheck(this, A2); }; var E2; -(function(E21) { - E21[E21["A"] = 0] = "A"; +(function(E2) { + E2[E2["A"] = 0] = "A"; })(E2 || (E2 = { })); function f() { diff --git a/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/unionSubtypeIfEveryConstituentTypeIsSubtype/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/unionSubtypeIfEveryConstituentTypeIsSubtype/input.ts/es5.2.minified/output.js index 488ad443d28..28c6465b3cd 100644 --- a/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/unionSubtypeIfEveryConstituentTypeIsSubtype/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/types/typeRelationships/subtypesAndSuperTypes/unionSubtypeIfEveryConstituentTypeIsSubtype/input.ts/es5.2.minified/output.js @@ -1,9 +1,9 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function"); } -(e = e1 || (e1 = { +(e = e || (e = { }))[e.e1 = 0] = "e1", e[e.e2 = 1] = "e2"; -var e, e1, E2, E21, A = function() { +var e, e, E2, E2, A = function() { "use strict"; _classCallCheck(this, A); }, A2 = function() { @@ -12,8 +12,8 @@ var e, e1, E2, E21, A = function() { }; function f() { } -(E21 = E2 || (E2 = { -}))[E21.A = 0] = "A", (f || (f = { +(E2 = E2 || (E2 = { +}))[E2.A = 0] = "A", (f || (f = { })).bar = 1; var c = function() { "use strict"; diff --git a/crates/swc/tests/tsc-references/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentity2/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentity2/input.ts/es2015.1.normal/output.js index 2e6446f3588..45d6f21011b 100644 --- a/crates/swc/tests/tsc-references/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentity2/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentity2/input.ts/es2015.1.normal/output.js @@ -7,8 +7,8 @@ class C { } var a; var E; -(function(E1) { - E1[E1["A"] = 0] = "A"; +(function(E) { + E[E["A"] = 0] = "A"; })(E || (E = { })); var b = { diff --git a/crates/swc/tests/tsc-references/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentity2/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentity2/input.ts/es2015.2.minified/output.js index c3e488e7257..ed7528b1b1c 100644 --- a/crates/swc/tests/tsc-references/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentity2/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentity2/input.ts/es2015.2.minified/output.js @@ -1,3 +1,3 @@ -var E, E1; -(E = E1 || (E1 = { -}))[E.A = 0] = "A", E1.A; +var E, E; +(E = E || (E = { +}))[E.A = 0] = "A", E.A; diff --git a/crates/swc/tests/tsc-references/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentity2/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentity2/input.ts/es5.1.normal/output.js index 9407105ea54..189bea9353f 100644 --- a/crates/swc/tests/tsc-references/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentity2/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentity2/input.ts/es5.1.normal/output.js @@ -17,8 +17,8 @@ var C = function C() { }; var a; var E; -(function(E1) { - E1[E1["A"] = 0] = "A"; +(function(E) { + E[E["A"] = 0] = "A"; })(E || (E = { })); var b = { diff --git a/crates/swc/tests/tsc-references/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentity2/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentity2/input.ts/es5.2.minified/output.js index 8751a41830c..c62d467d01d 100644 --- a/crates/swc/tests/tsc-references/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentity2/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentity2/input.ts/es5.2.minified/output.js @@ -1,7 +1,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function"); } -var E, E1, A = function() { +var E, E, A = function() { "use strict"; _classCallCheck(this, A); }, B = function() { @@ -11,5 +11,5 @@ var E, E1, A = function() { "use strict"; _classCallCheck(this, C); }; -(E1 = E || (E = { -}))[E1.A = 0] = "A", E.A; +(E = E || (E = { +}))[E.A = 0] = "A", E.A; diff --git a/crates/swc/tests/tsc-references/types/typeRelationships/typeAndMemberIdentity/primtiveTypesAreIdentical/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/types/typeRelationships/typeAndMemberIdentity/primtiveTypesAreIdentical/input.ts/es2015.1.normal/output.js index 7240d1a7a39..96458b6ab13 100644 --- a/crates/swc/tests/tsc-references/types/typeRelationships/typeAndMemberIdentity/primtiveTypesAreIdentical/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/types/typeRelationships/typeAndMemberIdentity/primtiveTypesAreIdentical/input.ts/es2015.1.normal/output.js @@ -9,8 +9,8 @@ function foo4(x) { function foo5(x) { } var E; -(function(E1) { - E1[E1["A"] = 0] = "A"; +(function(E) { + E[E["A"] = 0] = "A"; })(E || (E = { })); function foo6(x) { diff --git a/crates/swc/tests/tsc-references/types/typeRelationships/typeAndMemberIdentity/primtiveTypesAreIdentical/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/types/typeRelationships/typeAndMemberIdentity/primtiveTypesAreIdentical/input.ts/es2015.2.minified/output.js index 47941337af4..4dac4549ce1 100644 --- a/crates/swc/tests/tsc-references/types/typeRelationships/typeAndMemberIdentity/primtiveTypesAreIdentical/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/types/typeRelationships/typeAndMemberIdentity/primtiveTypesAreIdentical/input.ts/es2015.2.minified/output.js @@ -1,3 +1,3 @@ -var E, E1; -(E1 = E || (E = { -}))[E1.A = 0] = "A"; +var E, E; +(E = E || (E = { +}))[E.A = 0] = "A"; diff --git a/crates/swc/tests/tsc-references/types/typeRelationships/typeAndMemberIdentity/primtiveTypesAreIdentical/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/types/typeRelationships/typeAndMemberIdentity/primtiveTypesAreIdentical/input.ts/es5.1.normal/output.js index 7240d1a7a39..96458b6ab13 100644 --- a/crates/swc/tests/tsc-references/types/typeRelationships/typeAndMemberIdentity/primtiveTypesAreIdentical/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/types/typeRelationships/typeAndMemberIdentity/primtiveTypesAreIdentical/input.ts/es5.1.normal/output.js @@ -9,8 +9,8 @@ function foo4(x) { function foo5(x) { } var E; -(function(E1) { - E1[E1["A"] = 0] = "A"; +(function(E) { + E[E["A"] = 0] = "A"; })(E || (E = { })); function foo6(x) { diff --git a/crates/swc/tests/tsc-references/types/typeRelationships/typeAndMemberIdentity/primtiveTypesAreIdentical/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/types/typeRelationships/typeAndMemberIdentity/primtiveTypesAreIdentical/input.ts/es5.2.minified/output.js index 47941337af4..4dac4549ce1 100644 --- a/crates/swc/tests/tsc-references/types/typeRelationships/typeAndMemberIdentity/primtiveTypesAreIdentical/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/types/typeRelationships/typeAndMemberIdentity/primtiveTypesAreIdentical/input.ts/es5.2.minified/output.js @@ -1,3 +1,3 @@ -var E, E1; -(E1 = E || (E = { -}))[E1.A = 0] = "A"; +var E, E; +(E = E || (E = { +}))[E.A = 0] = "A"; diff --git a/crates/swc/tests/tsc-references/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2/input.ts/es2015.1.normal/output.js index 5b4211cdf60..dc2ed0ce2db 100644 --- a/crates/swc/tests/tsc-references/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2/input.ts/es2015.1.normal/output.js @@ -29,22 +29,22 @@ var onlyT; , (b)=>b ); // valid, T is inferred to be Date } - var E1; + let E; (function(E) { E[E["A"] = 0] = "A"; - })(E1 || (E1 = { + })(E || (E = { })); - var F1; + let F; (function(F) { F[F["A"] = 0] = "A"; - })(F1 || (F1 = { + })(F || (F = { })); function foo3(x, a, b) { var r; return r; } - var r71 = foo3(E1.A, (x)=>E1.A - , (x)=>F1.A + var r71 = foo3(E.A, (x)=>E.A + , (x)=>F.A ); // error })(onlyT || (onlyT = { })); @@ -76,10 +76,12 @@ var TU; , (b)=>b ); } + let E; (function(E) { E[E["A"] = 0] = "A"; })(E || (E = { })); + let F; (function(F) { F[F["A"] = 0] = "A"; })(F || (F = { diff --git a/crates/swc/tests/tsc-references/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2/input.ts/es2015.2.minified/output.js index edfdf0907e4..65ec8287cb1 100644 --- a/crates/swc/tests/tsc-references/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2/input.ts/es2015.2.minified/output.js @@ -1,24 +1,24 @@ var onlyT, TU; !function(onlyT) { - var E, F, E1, F1; - (function(a, b) { - })((x)=>1 - , (x)=>"" - ), (E1 = E || (E = { - }))[E1.A = 0] = "A", (F1 = F || (F = { - }))[F1.A = 0] = "A", (function(x, a, b) { + var E, F; + let E; + (E = E || (E = { + }))[E.A = 0] = "A"; + let F; + (F = F || (F = { + }))[F.A = 0] = "A", (function(x, a, b) { })(E.A, (x)=>E.A , (x)=>F.A ); }(onlyT || (onlyT = { })), (function(TU) { - var E2, F2; - (function(a, b) { - })((x)=>1 - , (x)=>"" - ), (E2 = E || (E = { - }))[E2.A = 0] = "A", (F2 = F || (F = { - }))[F2.A = 0] = "A", (function(x, a, b) { + var E, F; + let E; + (E = E || (E = { + }))[E.A = 0] = "A"; + let F; + (F = F || (F = { + }))[F.A = 0] = "A", (function(x, a, b) { })(E.A, (x)=>E.A , (x)=>F.A ); diff --git a/crates/swc/tests/tsc-references/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2/input.ts/es5.1.normal/output.js index a9dca67d73b..67bc93f6370 100644 --- a/crates/swc/tests/tsc-references/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2/input.ts/es5.1.normal/output.js @@ -41,20 +41,20 @@ var onlyT; }, function(x) { return ''; }); - var E1; + var E; (function(E) { E[E["A"] = 0] = "A"; - })(E1 || (E1 = { + })(E || (E = { })); - var F1; + var F; (function(F) { F[F["A"] = 0] = "A"; - })(F1 || (F1 = { + })(F || (F = { })); - var r71 = foo3(E1.A, function(x) { - return E1.A; + var r71 = foo3(E.A, function(x) { + return E.A; }, function(x) { - return F1.A; + return F.A; }); // error })(onlyT || (onlyT = { })); @@ -98,10 +98,12 @@ var TU; }, function(x) { return ''; }); + var E; (function(E) { E[E["A"] = 0] = "A"; })(E || (E = { })); + var F; (function(F) { F[F["A"] = 0] = "A"; })(F || (F = { diff --git a/crates/swc/tests/tsc-references/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2/input.ts/es5.2.minified/output.js index 8e19855f942..05499f8cc93 100644 --- a/crates/swc/tests/tsc-references/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2/input.ts/es5.2.minified/output.js @@ -1,14 +1,14 @@ var onlyT, TU; !function(onlyT) { - var E, F, E1, F1; + var E, F, E, F; (function(a, b) { })(function(x) { return 1; }, function(x) { return ""; - }), (E1 = E || (E = { - }))[E1.A = 0] = "A", (F1 = F || (F = { - }))[F1.A = 0] = "A", (function(x, a, b) { + }), (E = E || (E = { + }))[E.A = 0] = "A", (F = F || (F = { + }))[F.A = 0] = "A", (function(x, a, b) { })(E.A, function(x) { return E.A; }, function(x) { @@ -16,15 +16,15 @@ var onlyT, TU; }); }(onlyT || (onlyT = { })), (function(TU) { - var E2, F2; + var E, F, E, F; (function(a, b) { })(function(x) { return 1; }, function(x) { return ""; - }), (E2 = E || (E = { - }))[E2.A = 0] = "A", (F2 = F || (F = { - }))[F2.A = 0] = "A", (function(x, a, b) { + }), (E = E || (E = { + }))[E.A = 0] = "A", (F = F || (F = { + }))[F.A = 0] = "A", (function(x, a, b) { })(E.A, function(x) { return E.A; }, function(x) { diff --git a/crates/swc/tests/tsc-references/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments3/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments3/input.ts/es2015.1.normal/output.js index be2027af844..26554856fdb 100644 --- a/crates/swc/tests/tsc-references/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments3/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments3/input.ts/es2015.1.normal/output.js @@ -23,13 +23,13 @@ var r5 = foo(new Object(), (x)=>'' , (x)=>'' ); // Object => Object var E; -(function(E1) { - E1[E1["A"] = 0] = "A"; +(function(E) { + E[E["A"] = 0] = "A"; })(E || (E = { })); var F; -(function(F1) { - F1[F1["A"] = 0] = "A"; +(function(F) { + F[F["A"] = 0] = "A"; })(F || (F = { })); var r6 = foo(E.A, (x)=>E.A diff --git a/crates/swc/tests/tsc-references/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments3/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments3/input.ts/es2015.2.minified/output.js index fb939d7d153..2abf6d899e1 100644 --- a/crates/swc/tests/tsc-references/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments3/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments3/input.ts/es2015.2.minified/output.js @@ -1,4 +1,4 @@ -var E, F, x, E1, F1; +var E, F, x, E, F; function foo(x, a, b) { } function foo2(x, a, b) { @@ -15,9 +15,9 @@ foo("", (x)=>"" , (x)=>"" ), foo(new Object(), (x)=>"" , (x)=>"" -), (E1 = E || (E = { -}))[E1.A = 0] = "A", (F1 = F || (F = { -}))[F1.A = 0] = "A", foo(E.A, (x)=>E.A +), (E = E || (E = { +}))[E.A = 0] = "A", (F = F || (F = { +}))[F.A = 0] = "A", foo(E.A, (x)=>E.A , (x)=>F.A ), foo2("", (x)=>"" , (x)=>null diff --git a/crates/swc/tests/tsc-references/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments3/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments3/input.ts/es5.1.normal/output.js index 28d13df1ff7..b6b00901ea6 100644 --- a/crates/swc/tests/tsc-references/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments3/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments3/input.ts/es5.1.normal/output.js @@ -35,13 +35,13 @@ var r5 = foo(new Object(), function(x) { return ''; }); // Object => Object var E; -(function(E1) { - E1[E1["A"] = 0] = "A"; +(function(E) { + E[E["A"] = 0] = "A"; })(E || (E = { })); var F; -(function(F1) { - F1[F1["A"] = 0] = "A"; +(function(F) { + F[F["A"] = 0] = "A"; })(F || (F = { })); var r6 = foo(E.A, function(x) { diff --git a/crates/swc/tests/tsc-references/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments3/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments3/input.ts/es5.2.minified/output.js index afa864ef2b6..ea9c97affcd 100644 --- a/crates/swc/tests/tsc-references/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments3/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments3/input.ts/es5.2.minified/output.js @@ -1,4 +1,4 @@ -var E, F, x, E1, F1; +var E, F, x, E, F; function foo(x, a, b) { } function foo2(x, a, b) { @@ -27,9 +27,9 @@ foo("", function(x) { return ""; }, function(x) { return ""; -}), (E1 = E || (E = { -}))[E1.A = 0] = "A", (F1 = F || (F = { -}))[F1.A = 0] = "A", foo(E.A, function(x) { +}), (E = E || (E = { +}))[E.A = 0] = "A", (F = F || (F = { +}))[F.A = 0] = "A", foo(E.A, function(x) { return E.A; }, function(x) { return F.A; diff --git a/crates/swc/tests/tsc-references/types/unknown/unknownType2/input.ts/es2015.1.normal/output.js b/crates/swc/tests/tsc-references/types/unknown/unknownType2/input.ts/es2015.1.normal/output.js index 80d573d18ca..368008bf192 100644 --- a/crates/swc/tests/tsc-references/types/unknown/unknownType2/input.ts/es2015.1.normal/output.js +++ b/crates/swc/tests/tsc-references/types/unknown/unknownType2/input.ts/es2015.1.normal/output.js @@ -49,17 +49,17 @@ if (u === aFunction) { let uFunction = u; } var NumberEnum; -(function(NumberEnum1) { - NumberEnum1[NumberEnum1["A"] = 0] = "A"; - NumberEnum1[NumberEnum1["B"] = 1] = "B"; - NumberEnum1[NumberEnum1["C"] = 2] = "C"; +(function(NumberEnum) { + NumberEnum[NumberEnum["A"] = 0] = "A"; + NumberEnum[NumberEnum["B"] = 1] = "B"; + NumberEnum[NumberEnum["C"] = 2] = "C"; })(NumberEnum || (NumberEnum = { })); var StringEnum; -(function(StringEnum1) { - StringEnum1["A"] = "A"; - StringEnum1["B"] = "B"; - StringEnum1["C"] = "C"; +(function(StringEnum) { + StringEnum["A"] = "A"; + StringEnum["B"] = "B"; + StringEnum["C"] = "C"; })(StringEnum || (StringEnum = { })); if (u === NumberEnum || u === StringEnum) { diff --git a/crates/swc/tests/tsc-references/types/unknown/unknownType2/input.ts/es2015.2.minified/output.js b/crates/swc/tests/tsc-references/types/unknown/unknownType2/input.ts/es2015.2.minified/output.js index 4e9b394a4ce..dcd4c50af2f 100644 --- a/crates/swc/tests/tsc-references/types/unknown/unknownType2/input.ts/es2015.2.minified/output.js +++ b/crates/swc/tests/tsc-references/types/unknown/unknownType2/input.ts/es2015.2.minified/output.js @@ -1,5 +1,5 @@ -var NumberEnum, StringEnum, NumberEnum1, StringEnum1; +var NumberEnum, StringEnum, NumberEnum, StringEnum; const u = void 0; -5 === u && u.toString(10), !0 === u || !1 === u, void 0 === u, null === u, u === symb, 42 !== u, 42 !== u, 42 == u, !0 == u, u == Object, u === aString, u === aBoolean, u === aNumber, u === anObject, u === anObjectLiteral, u === aUnion, u === anIntersection, u === aFunction, (NumberEnum1 = NumberEnum || (NumberEnum = { -}))[NumberEnum1.A = 0] = "A", NumberEnum1[NumberEnum1.B = 1] = "B", NumberEnum1[NumberEnum1.C = 2] = "C", (StringEnum1 = StringEnum || (StringEnum = { -})).A = "A", StringEnum1.B = "B", StringEnum1.C = "C", u === NumberEnum || u === StringEnum, u === NumberEnum.A, u === StringEnum.B; +5 === u && u.toString(10), !0 === u || !1 === u, void 0 === u, null === u, u === symb, 42 !== u, 42 !== u, 42 == u, !0 == u, u == Object, u === aString, u === aBoolean, u === aNumber, u === anObject, u === anObjectLiteral, u === aUnion, u === anIntersection, u === aFunction, (NumberEnum = NumberEnum || (NumberEnum = { +}))[NumberEnum.A = 0] = "A", NumberEnum[NumberEnum.B = 1] = "B", NumberEnum[NumberEnum.C = 2] = "C", (StringEnum = StringEnum || (StringEnum = { +})).A = "A", StringEnum.B = "B", StringEnum.C = "C", u === NumberEnum || u === StringEnum, u === NumberEnum.A, u === StringEnum.B; diff --git a/crates/swc/tests/tsc-references/types/unknown/unknownType2/input.ts/es5.1.normal/output.js b/crates/swc/tests/tsc-references/types/unknown/unknownType2/input.ts/es5.1.normal/output.js index 72de41130cf..3ba378a2ce7 100644 --- a/crates/swc/tests/tsc-references/types/unknown/unknownType2/input.ts/es5.1.normal/output.js +++ b/crates/swc/tests/tsc-references/types/unknown/unknownType2/input.ts/es5.1.normal/output.js @@ -50,17 +50,17 @@ if (u === aFunction) { var uFunction = u; } var NumberEnum; -(function(NumberEnum1) { - NumberEnum1[NumberEnum1["A"] = 0] = "A"; - NumberEnum1[NumberEnum1["B"] = 1] = "B"; - NumberEnum1[NumberEnum1["C"] = 2] = "C"; +(function(NumberEnum) { + NumberEnum[NumberEnum["A"] = 0] = "A"; + NumberEnum[NumberEnum["B"] = 1] = "B"; + NumberEnum[NumberEnum["C"] = 2] = "C"; })(NumberEnum || (NumberEnum = { })); var StringEnum; -(function(StringEnum1) { - StringEnum1["A"] = "A"; - StringEnum1["B"] = "B"; - StringEnum1["C"] = "C"; +(function(StringEnum) { + StringEnum["A"] = "A"; + StringEnum["B"] = "B"; + StringEnum["C"] = "C"; })(StringEnum || (StringEnum = { })); if (u === NumberEnum || u === StringEnum) { diff --git a/crates/swc/tests/tsc-references/types/unknown/unknownType2/input.ts/es5.2.minified/output.js b/crates/swc/tests/tsc-references/types/unknown/unknownType2/input.ts/es5.2.minified/output.js index 20fa34bbac2..4b9417427eb 100644 --- a/crates/swc/tests/tsc-references/types/unknown/unknownType2/input.ts/es5.2.minified/output.js +++ b/crates/swc/tests/tsc-references/types/unknown/unknownType2/input.ts/es5.2.minified/output.js @@ -1,4 +1,4 @@ -var NumberEnum, StringEnum, NumberEnum1, StringEnum1, u = void 0; -5 === u && u.toString(10), !0 === u || !1 === u, void 0 === u, null === u, u === symb, 42 !== u, 42 !== u, 42 == u, !0 == u, u == Object, u === aString, u === aBoolean, u === aNumber, u === anObject, u === anObjectLiteral, u === aUnion, u === anIntersection, u === aFunction, (NumberEnum = NumberEnum1 || (NumberEnum1 = { -}))[NumberEnum.A = 0] = "A", NumberEnum[NumberEnum.B = 1] = "B", NumberEnum[NumberEnum.C = 2] = "C", (StringEnum = StringEnum1 || (StringEnum1 = { -})).A = "A", StringEnum.B = "B", StringEnum.C = "C", u === NumberEnum1 || u === StringEnum1, u === NumberEnum1.A, u === StringEnum1.B; +var NumberEnum, StringEnum, NumberEnum, StringEnum, u = void 0; +5 === u && u.toString(10), !0 === u || !1 === u, void 0 === u, null === u, u === symb, 42 !== u, 42 !== u, 42 == u, !0 == u, u == Object, u === aString, u === aBoolean, u === aNumber, u === anObject, u === anObjectLiteral, u === aUnion, u === anIntersection, u === aFunction, (NumberEnum = NumberEnum || (NumberEnum = { +}))[NumberEnum.A = 0] = "A", NumberEnum[NumberEnum.B = 1] = "B", NumberEnum[NumberEnum.C = 2] = "C", (StringEnum = StringEnum || (StringEnum = { +})).A = "A", StringEnum.B = "B", StringEnum.C = "C", u === NumberEnum || u === StringEnum, u === NumberEnum.A, u === StringEnum.B; diff --git a/crates/swc_bundler/tests/common/mod.rs b/crates/swc_bundler/tests/common/mod.rs index 086776b8f6b..b715f10c8f6 100644 --- a/crates/swc_bundler/tests/common/mod.rs +++ b/crates/swc_bundler/tests/common/mod.rs @@ -17,6 +17,7 @@ use swc_common::{ }; use swc_ecma_ast::EsVersion; use swc_ecma_parser::{lexer::Lexer, Parser, StringInput, Syntax, TsConfig}; +use swc_ecma_transforms_base::resolver::resolver_with_mark; use swc_ecma_transforms_react::react; use swc_ecma_transforms_typescript::strip; use swc_ecma_visit::FoldWith; @@ -129,15 +130,17 @@ impl Load for Loader { err.into_diagnostic(&handler).emit(); panic!("failed to parse") }); - let module = - module - .fold_with(&mut strip()) - .fold_with(&mut react::( - self.cm.clone(), - None, - Default::default(), - top_level_mark, - )); + + let mark = Mark::fresh(Mark::root()); + let module = module + .fold_with(&mut resolver_with_mark(mark)) + .fold_with(&mut strip(mark)) + .fold_with(&mut react::( + self.cm.clone(), + None, + Default::default(), + top_level_mark, + )); Ok(ModuleData { fm, diff --git a/crates/swc_ecma_minifier/src/compress/optimize/if_return.rs b/crates/swc_ecma_minifier/src/compress/optimize/if_return.rs index bc7c437fa15..a0c2e10ec30 100644 --- a/crates/swc_ecma_minifier/src/compress/optimize/if_return.rs +++ b/crates/swc_ecma_minifier/src/compress/optimize/if_return.rs @@ -200,6 +200,9 @@ where match s { Stmt::Decl(Decl::Var(v)) => { if v.decls.iter().all(|v| v.init.is_none()) { + if last_idx == 0 { + break; + } last_idx -= 1; continue; } diff --git a/crates/swc_ecma_transforms/tests/decorators.rs b/crates/swc_ecma_transforms/tests/decorators.rs index 3bd3c465509..212b7ec7b77 100644 --- a/crates/swc_ecma_transforms/tests/decorators.rs +++ b/crates/swc_ecma_transforms/tests/decorators.rs @@ -7,6 +7,7 @@ use swc_common::{chain, Mark}; use swc_ecma_parser::{EsConfig, Syntax, TsConfig}; +use swc_ecma_transforms::resolver_with_mark; use swc_ecma_transforms_base::resolver::resolver; use swc_ecma_transforms_compat::{ es2015::{classes, function_name}, @@ -43,25 +44,30 @@ fn tr() -> impl Fold { } fn ts_transform() -> impl Fold { - chain!( - decorators(Config { - legacy: true, - ..Default::default() - }), - simple_strip(), - ) -} - -fn simple_strip() -> impl Fold { - strip::strip_with_config(strip::Config { - no_empty_export: true, + simple_strip(Config { + legacy: true, ..Default::default() }) } +fn simple_strip(config: Config) -> impl Fold { + let mark = Mark::fresh(Mark::root()); + chain!( + decorators(config), + resolver_with_mark(mark), + strip::strip_with_config( + strip::Config { + no_empty_export: true, + ..Default::default() + }, + mark + ), + ) +} + /// Folder for `transformation_*` tests fn transformation() -> impl Fold { - chain!(decorators(Default::default()), simple_strip(),) + simple_strip(Default::default()) } // transformation_declaration @@ -77,7 +83,7 @@ class A {} let A = _decorate([dec()], function (_initialize) { - class A { + class A1 { constructor() { _initialize(this); } @@ -85,7 +91,7 @@ let A = _decorate([dec()], function (_initialize) { } return { - F: A, + F: A1, d: [] }; }); @@ -118,7 +124,7 @@ class B extends A { let B = _decorate([dec], function (_initialize, _A) { - class B extends _A { + class B1 extends _A { constructor() { const foo = () => { super(); @@ -148,7 +154,7 @@ let B = _decorate([dec], function (_initialize, _A) { } return { - F: B, + F: B1, d: [] }; }, A); @@ -199,7 +205,7 @@ class B extends A { let B = _decorate([dec], function (_initialize, _A) { - class B extends _A { + class B1 extends _A { constructor() { super(); @@ -209,7 +215,7 @@ let B = _decorate([dec], function (_initialize, _A) { } return { - F: B, + F: B1, d: [] }; }, A); @@ -544,7 +550,7 @@ class Sub extends Super { let Sub = _decorate([decorator(parameter)], function (_initialize, _Super) { - class Sub extends _Super { + class Sub1 extends _Super { constructor() { var _temp; @@ -554,7 +560,7 @@ let Sub = _decorate([decorator(parameter)], function (_initialize, _Super) { } return { - F: Sub, + F: Sub1, d: [] }; }, Super); @@ -601,7 +607,7 @@ class A { let A = _decorate([dec(a, b, ...c)], function (_initialize) { - class A { + class A1 { constructor() { _initialize(this); } @@ -609,7 +615,7 @@ let A = _decorate([dec(a, b, ...c)], function (_initialize) { } return { - F: A, + F: A1, d: [{ kind: "method", decorators: [dec(a, b, ...c)], @@ -725,7 +731,7 @@ class B extends A { let B = _decorate([dec], function (_initialize, _A) { - class B extends _A { + class B1 extends _A { constructor() { var _temp; @@ -735,7 +741,7 @@ let B = _decorate([dec], function (_initialize, _A) { } return { - F: B, + F: B1, d: [] }; }, A); @@ -775,7 +781,7 @@ export default @dec() class Foo {} "#, r#" let Foo = _decorate([dec()], function (_initialize) { - class Foo { + class Foo1 { constructor() { _initialize(this); } @@ -783,7 +789,7 @@ let Foo = _decorate([dec()], function (_initialize) { } return { - F: Foo, + F: Foo1, d: [] }; }); @@ -1174,7 +1180,7 @@ test!( let A = _decorate([dec], function (_initialize, _B) { - class A extends _B { + class A1 extends _B { constructor(...args) { super(...args); @@ -1184,7 +1190,7 @@ let A = _decorate([dec], function (_initialize, _B) { } return { - F: A, + F: A1, d: [] }; }, B); @@ -1205,7 +1211,7 @@ async function g() { "#, r#" async function g() { - let A = _decorate([dec], function (_initialize, _super) { + let A1 = _decorate([dec], function (_initialize, _super) { class A extends _super { @@ -1239,7 +1245,7 @@ function* g() { "#, r#" function* g() { - let A = _decorate([dec], function (_initialize, _super) { + let A1 = _decorate([dec], function (_initialize, _super) { class A extends _super { @@ -1433,7 +1439,7 @@ class B extends A { let B = _decorate([dec], function (_initialize, _A) { - class B extends _A { + class B1 extends _A { constructor() { super(); @@ -1445,7 +1451,7 @@ let B = _decorate([dec], function (_initialize, _A) { } return { - F: B, + F: B1, d: [] }; }, A); @@ -2040,13 +2046,10 @@ expect(typeof Parent.prototype.child).toBe("function"); // legacy_regression_10264 test!( syntax(true), - |_| chain!( - decorators(decorators::Config { - legacy: true, - ..Default::default() - }), - simple_strip() - ), + |_| simple_strip(decorators::Config { + legacy: true, + ..Default::default() + }), legacy_regression_10264, r#" function myDecorator(decoratee) {} @@ -4288,13 +4291,10 @@ test!( decorators: true, ..Default::default() }), - |_| chain!( - decorators(Config { - legacy: true, - ..Default::default() - }), - simple_strip() - ), + |_| simple_strip(Config { + legacy: true, + ..Default::default() + }), issue_823_1, "import {Debounce} from 'lodash-decorators'; class Person { @@ -4328,14 +4328,13 @@ test!( decorators: true, ..Default::default() }), - |_| chain!( - decorators(Config { + |_| { + simple_strip(Config { legacy: true, ..Default::default() - }), - simple_strip(), + }) // classes(Some(t.comments.clone())), - ), + }, issue_823_2, "import {Debounce} from 'lodash-decorators'; class Person { @@ -4371,11 +4370,10 @@ test!( ..Default::default() }), |t| chain!( - decorators(Config { + simple_strip(Config { legacy: true, ..Default::default() }), - simple_strip(), classes(Some(t.comments.clone())), ), issue_823_3, @@ -4396,10 +4394,10 @@ var _class1, _dec; import { Debounce } from 'lodash-decorators'; let Person = ((_class1 = (_class = function() { 'use strict'; - function Person() { - _classCallCheck(this, Person); + function Person1() { + _classCallCheck(this, Person1); } - _createClass(Person, [ + _createClass(Person1, [ { key: 'save', value: function save() { @@ -4407,7 +4405,7 @@ let Person = ((_class1 = (_class = function() { } } ]); - return Person; + return Person1; }(), _class.debounceTime = 500, _class)) || _class1, _dec = Debounce(_class1.debounceTime), \ _applyDecoratedDescriptor(_class1.prototype, 'save', [ _dec @@ -4623,11 +4621,10 @@ test!( ts(), |_| chain!( inlining::inlining(inlining::Config {}), - decorators(Config { + simple_strip(Config { legacy: true, ..Default::default() }), - simple_strip(), ), issue_879_1, "export default class X { @@ -5991,16 +5988,11 @@ test_exec!( decorators: true, ..Default::default() }), - |_| { - chain!( - decorators(Config { - legacy: true, - emit_metadata: true, - ..Default::default() - }), - strip() - ) - }, + |_| simple_strip(Config { + legacy: true, + emit_metadata: true, + ..Default::default() + }), issue_1362_1, " const { IsString } = require('class-validator'); diff --git a/crates/swc_ecma_transforms_base/src/resolver/mod.rs b/crates/swc_ecma_transforms_base/src/resolver/mod.rs index d6367f7d013..743c4f79c6a 100644 --- a/crates/swc_ecma_transforms_base/src/resolver/mod.rs +++ b/crates/swc_ecma_transforms_base/src/resolver/mod.rs @@ -377,7 +377,6 @@ impl<'a> VisitMut for Resolver<'a> { typed_ref!(visit_mut_ts_array_type, TsArrayType); typed_ref!(visit_mut_ts_conditional_type, TsConditionalType); - typed_ref!(visit_mut_ts_entity_name, TsEntityName); typed_ref!( visit_mut_ts_type_param_instantiation, TsTypeParamInstantiation @@ -387,7 +386,6 @@ impl<'a> VisitMut for Resolver<'a> { typed_ref!(visit_mut_ts_type_operator, TsTypeOperator); typed_ref!(visit_mut_ts_type, TsType); typed_ref!(visit_mut_ts_type_ann, TsTypeAnn); - typed_ref!(visit_mut_ts_type_assertion, TsTypeAssertion); typed!( visit_mut_ts_union_or_intersection_type, TsUnionOrIntersectionType @@ -400,31 +398,22 @@ impl<'a> VisitMut for Resolver<'a> { typed_ref!(visit_mut_ts_intersection_type, TsIntersectionType); typed_ref!(visit_mut_ts_type_ref, TsTypeRef); typed_decl!(visit_mut_ts_type_param_decl, TsTypeParamDecl); - typed!(visit_mut_ts_enum_member, TsEnumMember); typed!(visit_mut_ts_fn_param, TsFnParam); typed!(visit_mut_ts_indexed_access_type, TsIndexedAccessType); typed!(visit_mut_ts_index_signature, TsIndexSignature); typed!(visit_mut_ts_interface_body, TsInterfaceBody); - typed!(visit_mut_ts_module_ref, TsModuleRef); typed!(visit_mut_ts_parenthesized_type, TsParenthesizedType); typed!(visit_mut_ts_type_lit, TsTypeLit); typed!(visit_mut_ts_type_element, TsTypeElement); - typed!(visit_mut_ts_module_block, TsModuleBlock); - typed!(visit_mut_ts_namespace_body, TsNamespaceBody); typed!(visit_mut_ts_optional_type, TsOptionalType); - typed!(visit_mut_ts_param_prop, TsParamProp); typed!(visit_mut_ts_rest_type, TsRestType); typed!(visit_mut_ts_type_predicate, TsTypePredicate); typed_ref!(visit_mut_ts_this_type_or_ident, TsThisTypeOrIdent); typed_ref!(visit_mut_ts_expr_with_type_args, TsExprWithTypeArgs); fn visit_mut_import_decl(&mut self, n: &mut ImportDecl) { - if n.type_only { - if !self.handle_types { - return; - } - } - + // Always resolve the import declaration identifiers even if it's type only. + // We need to analyze these identifiers for type stripping purposes. self.ident_type = IdentType::Binding; self.in_type = n.type_only; n.visit_mut_children_with(self); @@ -933,6 +922,22 @@ impl<'a> VisitMut for Resolver<'a> { stmts.visit_mut_children_with(self) } + fn visit_mut_ts_as_expr(&mut self, n: &mut TsAsExpr) { + if self.handle_types { + n.type_ann.visit_mut_with(self); + } + + n.expr.visit_mut_with(self); + } + + fn visit_mut_ts_type_assertion(&mut self, n: &mut TsTypeAssertion) { + if self.handle_types { + n.type_ann.visit_mut_with(self); + } + + n.expr.visit_mut_with(self); + } + fn visit_mut_ts_call_signature_decl(&mut self, n: &mut TsCallSignatureDecl) { if !self.handle_types { return; @@ -994,12 +999,7 @@ impl<'a> VisitMut for Resolver<'a> { } fn visit_mut_ts_enum_decl(&mut self, decl: &mut TsEnumDecl) { - if !self.handle_types { - return; - } - - self.in_type = false; - self.modify(&mut decl.id, None); + self.modify(&mut decl.id, Some(VarDeclKind::Let)); decl.members.visit_mut_with(self); } @@ -1039,12 +1039,16 @@ impl<'a> VisitMut for Resolver<'a> { } fn visit_mut_ts_interface_decl(&mut self, n: &mut TsInterfaceDecl) { + // always resolve the identifier for type stripping purposes + let old_in_type = self.in_type; + self.in_type = true; + self.modify(&mut n.id, None); + if !self.handle_types { + self.in_type = old_in_type; return; } - self.in_type = true; - self.modify(&mut n.id, None); let child_mark = Mark::fresh(Mark::root()); // Child folder let mut child = Resolver::new( @@ -1056,6 +1060,7 @@ impl<'a> VisitMut for Resolver<'a> { n.type_params.visit_mut_with(&mut child); n.extends.visit_mut_with(&mut child); n.body.visit_mut_with(&mut child); + self.in_type = old_in_type; } fn visit_mut_ts_mapped_type(&mut self, n: &mut TsMappedType) { @@ -1102,7 +1107,7 @@ impl<'a> VisitMut for Resolver<'a> { fn visit_mut_ts_module_decl(&mut self, decl: &mut TsModuleDecl) { match &mut decl.id { TsModuleName::Ident(i) => { - self.modify(i, None); + self.modify(i, Some(VarDeclKind::Let)); } TsModuleName::Str(_) => {} } @@ -1119,21 +1124,12 @@ impl<'a> VisitMut for Resolver<'a> { } fn visit_mut_ts_namespace_decl(&mut self, n: &mut TsNamespaceDecl) { - if !self.handle_types { - return; - } - - self.in_type = true; - self.modify(&mut n.id, None); + self.modify(&mut n.id, Some(VarDeclKind::Let)); n.body.visit_mut_with(self); } fn visit_mut_ts_param_prop_param(&mut self, n: &mut TsParamPropParam) { - if !self.handle_types { - return; - } - self.in_type = false; self.ident_type = IdentType::Binding; n.visit_mut_children_with(self) @@ -1163,11 +1159,6 @@ impl<'a> VisitMut for Resolver<'a> { } fn visit_mut_ts_qualified_name(&mut self, n: &mut TsQualifiedName) { - if !self.handle_types { - return; - } - - self.in_type = true; self.ident_type = IdentType::Ref; n.left.visit_mut_with(self) @@ -1190,12 +1181,16 @@ impl<'a> VisitMut for Resolver<'a> { } fn visit_mut_ts_type_alias_decl(&mut self, n: &mut TsTypeAliasDecl) { + // always resolve the identifier for type stripping purposes + let old_in_type = self.in_type; + self.in_type = true; + self.modify(&mut n.id, None); + if !self.handle_types { + self.in_type = old_in_type; return; } - self.in_type = true; - self.modify(&mut n.id, None); let child_mark = Mark::fresh(Mark::root()); // Child folder let mut child = Resolver::new( @@ -1206,6 +1201,7 @@ impl<'a> VisitMut for Resolver<'a> { n.type_params.visit_mut_with(&mut child); n.type_ann.visit_mut_with(&mut child); + self.in_type = old_in_type; } fn visit_mut_ts_type_param(&mut self, param: &mut TsTypeParam) { @@ -1318,11 +1314,6 @@ impl VisitMut for Hoister<'_, '_> { if self.resolver.handle_types { match decl { - Decl::TsEnum(e) => { - self.resolver.in_type = true; - self.resolver.modify(&mut e.id, None); - } - Decl::TsInterface(i) => { self.resolver.in_type = true; self.resolver.modify(&mut i.id, None); diff --git a/crates/swc_ecma_transforms_module/tests/common_js.rs b/crates/swc_ecma_transforms_module/tests/common_js.rs index b2ac8812ed1..d8e1f0a0eb3 100644 --- a/crates/swc_ecma_transforms_module/tests/common_js.rs +++ b/crates/swc_ecma_transforms_module/tests/common_js.rs @@ -99,7 +99,7 @@ test!( let scope = Rc::new(RefCell::new(Scope::default())); chain!( resolver_with_mark(mark), - // Optional::new(typescript::strip(), syntax.typescript()), + // Optional::new(typescript::strip(mark), syntax.typescript()), import_analyzer(Rc::clone(&scope)), inject_helpers(), common_js(mark, Default::default(), Some(scope)), diff --git a/crates/swc_ecma_transforms_optimization/tests/simplify.rs b/crates/swc_ecma_transforms_optimization/tests/simplify.rs index 3763e50f2ab..40aa06b8dfb 100644 --- a/crates/swc_ecma_transforms_optimization/tests/simplify.rs +++ b/crates/swc_ecma_transforms_optimization/tests/simplify.rs @@ -3,7 +3,10 @@ use std::{cell::RefCell, rc::Rc}; use swc_common::{chain, Mark}; use swc_ecma_parser::{EsConfig, Syntax, TsConfig}; -use swc_ecma_transforms_base::{helpers::inject_helpers, resolver::resolver}; +use swc_ecma_transforms_base::{ + helpers::inject_helpers, + resolver::{resolver, resolver_with_mark}, +}; use swc_ecma_transforms_compat::{es2015, es2016, es2017, es2018, es2022::class_properties, es3}; use swc_ecma_transforms_module::{ common_js::common_js, import_analysis::import_analyzer, util::Scope, @@ -469,12 +472,15 @@ test!( decorators: true, ..Default::default() }), - |_| chain!( - strip(), - resolver(), - dce(Default::default()), - inlining(Default::default()) - ), + |_| { + let mark = Mark::fresh(Mark::root()); + chain!( + resolver_with_mark(mark), + strip(mark), + dce(Default::default()), + inlining(Default::default()) + ) + }, issue_1156_1, " interface D { @@ -536,10 +542,12 @@ test!( ..Default::default() }), |t| { + let mark = Mark::fresh(Mark::root()); let scope = Rc::new(RefCell::new(Scope::default())); chain!( - strip(), decorators(Default::default()), + resolver_with_mark(mark), + strip(mark), class_properties(class_properties::Config { loose: false }), simplifier(Default::default()), es2018(Default::default()), diff --git a/crates/swc_ecma_transforms_optimization/tests/simplify_dce.rs b/crates/swc_ecma_transforms_optimization/tests/simplify_dce.rs index ad59b3687ea..5cf6928c13d 100644 --- a/crates/swc_ecma_transforms_optimization/tests/simplify_dce.rs +++ b/crates/swc_ecma_transforms_optimization/tests/simplify_dce.rs @@ -1,6 +1,6 @@ -use swc_common::{chain, pass::Repeat}; +use swc_common::{chain, pass::Repeat, Mark}; use swc_ecma_parser::{EsConfig, Syntax, TsConfig}; -use swc_ecma_transforms_base::resolver::resolver; +use swc_ecma_transforms_base::resolver::{resolver, resolver_with_mark}; use swc_ecma_transforms_optimization::simplify::dce::dce; use swc_ecma_transforms_proposal::decorators; use swc_ecma_transforms_testing::test; @@ -413,15 +413,18 @@ test!( decorators: true, ..Default::default() }), - |_| chain!( - resolver(), - strip(), - decorators(decorators::Config { - legacy: true, - emit_metadata: false - }), - tr() - ), + |_| { + let mark = Mark::fresh(Mark::root()); + chain!( + decorators(decorators::Config { + legacy: true, + emit_metadata: false + }), + resolver_with_mark(mark), + strip(mark), + tr() + ) + }, issue_898_2, "export default class X { @whatever @@ -460,15 +463,18 @@ test!( decorators: true, ..Default::default() }), - |_| chain!( - resolver(), - strip(), - decorators(decorators::Config { - legacy: true, - emit_metadata: false - }), - tr() - ), + |_| { + let mark = Mark::fresh(Mark::root()); + chain!( + decorators(decorators::Config { + legacy: true, + emit_metadata: false + }), + resolver_with_mark(mark), + strip(mark), + tr() + ) + }, issue_1111, " const a = 1; @@ -534,7 +540,10 @@ test!( decorators: true, ..Default::default() }), - |_| chain!(strip(), resolver(), tr()), + |_| { + let mark = Mark::fresh(Mark::root()); + chain!(resolver_with_mark(mark), strip(mark), tr()) + }, issue_1156_1, " export interface D { @@ -569,7 +578,10 @@ test!( decorators: true, ..Default::default() }), - |_| chain!(strip(), resolver(), tr(),), + |_| { + let mark = Mark::fresh(Mark::root()); + chain!(resolver_with_mark(mark), strip(mark), tr(),) + }, issue_1156_2, " interface D { @@ -630,7 +642,10 @@ test!( decorators: true, ..Default::default() }), - |_| chain!(strip(), resolver(), tr(),), + |_| { + let mark = Mark::fresh(Mark::root()); + chain!(resolver_with_mark(mark), strip(mark), tr(),) + }, issue_1156_3, " function d() { @@ -663,7 +678,10 @@ test!( decorators: true, ..Default::default() }), - |_| chain!(strip(), resolver(), tr(),), + |_| { + let mark = Mark::fresh(Mark::root()); + chain!(resolver_with_mark(mark), strip(mark), tr(),) + }, issue_1156_4, " interface D { diff --git a/crates/swc_ecma_transforms_optimization/tests/simplify_inlining.rs b/crates/swc_ecma_transforms_optimization/tests/simplify_inlining.rs index 62f7d40f26a..0884b24c575 100644 --- a/crates/swc_ecma_transforms_optimization/tests/simplify_inlining.rs +++ b/crates/swc_ecma_transforms_optimization/tests/simplify_inlining.rs @@ -1,18 +1,21 @@ //! Copied from https://github.com/google/closure-compiler/blob/6ca3b62990064488074a1a8931b9e8dc39b148b3/test/com/google/javascript/jscomp/InlineVariablesTest.java -use swc_common::chain; +use swc_common::{chain, Mark}; use swc_ecma_parser::{Syntax, TsConfig}; -use swc_ecma_transforms_base::resolver::resolver; +use swc_ecma_transforms_base::resolver::{resolver, resolver_with_mark}; use swc_ecma_transforms_optimization::simplify::inlining::inlining; use swc_ecma_transforms_testing::test; use swc_ecma_transforms_typescript::strip; use swc_ecma_visit::Fold; -fn simple_strip() -> impl Fold { - strip::strip_with_config(strip::Config { - no_empty_export: true, - ..Default::default() - }) +fn simple_strip(mark: Mark) -> impl Fold { + strip::strip_with_config( + strip::Config { + no_empty_export: true, + ..Default::default() + }, + mark, + ) } macro_rules! to { @@ -2150,7 +2153,14 @@ test!( decorators: true, ..Default::default() }), - |_| chain!(simple_strip(), resolver(), inlining(Default::default())), + |_| { + let mark = Mark::fresh(Mark::root()); + chain!( + resolver_with_mark(mark), + simple_strip(mark), + inlining(Default::default()) + ) + }, issue_1156_1, " export interface D { @@ -2185,7 +2195,14 @@ test!( decorators: true, ..Default::default() }), - |_| chain!(simple_strip(), resolver(), inlining(Default::default())), + |_| { + let mark = Mark::fresh(Mark::root()); + chain!( + resolver_with_mark(mark), + simple_strip(mark), + inlining(Default::default()) + ) + }, issue_1156_2, " interface D { @@ -2246,7 +2263,14 @@ test!( decorators: true, ..Default::default() }), - |_| chain!(simple_strip(), resolver(), inlining(Default::default())), + |_| { + let mark = Mark::fresh(Mark::root()); + chain!( + resolver_with_mark(mark), + simple_strip(mark), + inlining(Default::default()) + ) + }, deno_8180_1, r#" var Status; @@ -2290,7 +2314,14 @@ test!( decorators: true, ..Default::default() }), - |_| chain!(simple_strip(), resolver(), inlining(Default::default())), + |_| { + let mark = Mark::fresh(Mark::root()); + chain!( + resolver_with_mark(mark), + simple_strip(mark), + inlining(Default::default()) + ) + }, deno_8189_1, " let A, I = null; diff --git a/crates/swc_ecma_transforms_typescript/benches/compat.rs b/crates/swc_ecma_transforms_typescript/benches/compat.rs index 0babf2c3c08..521146f4a16 100644 --- a/crates/swc_ecma_transforms_typescript/benches/compat.rs +++ b/crates/swc_ecma_transforms_typescript/benches/compat.rs @@ -5,7 +5,7 @@ extern crate test; use swc_common::{chain, comments::SingleThreadedComments, sync::Lrc, FileName, Mark, SourceMap}; use swc_ecma_ast::Module; use swc_ecma_parser::{lexer::Lexer, Parser, StringInput, Syntax}; -use swc_ecma_transforms_base::helpers; +use swc_ecma_transforms_base::{helpers, resolver::resolver_with_mark}; use swc_ecma_transforms_typescript::strip; use swc_ecma_visit::{Fold, FoldWith}; use test::Bencher; @@ -33,7 +33,10 @@ where let _ = ::testing::run_test(false, |cm, _| { let module = module(cm); - let module = module.fold_with(&mut strip()); + let mark = Mark::fresh(Mark::root()); + let module = module + .fold_with(&mut resolver_with_mark(mark)) + .fold_with(&mut strip(mark)); b.iter(|| { let module = module.clone(); @@ -67,13 +70,16 @@ fn common_typescript(b: &mut Bencher) { let _ = ::testing::run_test(false, |cm, _| { let module = module(cm); - let module = module.fold_with(&mut strip()); + let mark = Mark::fresh(Mark::root()); + let module = module + .fold_with(&mut resolver_with_mark(mark)) + .fold_with(&mut strip(mark)); b.iter(|| { let module = module.clone(); let _ = helpers::HELPERS.set(&Default::default(), || { - test::black_box(module.fold_with(&mut strip())); + test::black_box(module.fold_with(&mut strip(mark))); }); }); diff --git a/crates/swc_ecma_transforms_typescript/examples/ts_to_js.rs b/crates/swc_ecma_transforms_typescript/examples/ts_to_js.rs index f6ffd9c6c7c..ed76b35e3b3 100644 --- a/crates/swc_ecma_transforms_typescript/examples/ts_to_js.rs +++ b/crates/swc_ecma_transforms_typescript/examples/ts_to_js.rs @@ -8,11 +8,11 @@ use swc_common::{ comments::SingleThreadedComments, errors::{ColorConfig, Handler}, sync::Lrc, - SourceMap, + Mark, SourceMap, }; use swc_ecma_codegen::{text_writer::JsWriter, Emitter}; use swc_ecma_parser::{lexer::Lexer, Parser, StringInput, Syntax, TsConfig}; -use swc_ecma_transforms_base::fixer::fixer; +use swc_ecma_transforms_base::{fixer::fixer, hygiene::hygiene, resolver::resolver_with_mark}; use swc_ecma_transforms_typescript::strip; use swc_ecma_visit::FoldWith; @@ -57,10 +57,21 @@ fn main() { .map_err(|e| e.into_diagnostic(&handler).emit()) .expect("failed to parse module."); - // Remove typescript types - let module = module.fold_with(&mut strip()); + let top_level_mark = Mark::fresh(Mark::root()); - // Ensure that we have eenough parenthesis. + // Optionally transforms decorators here before the resolver pass + // as it might produce runtime declarations. + + // Conduct identifier scope analysis + let module = module.fold_with(&mut resolver_with_mark(top_level_mark)); + + // Remove typescript types + let module = module.fold_with(&mut strip(top_level_mark)); + + // Fix up any identifiers with the same name, but different contexts + let module = module.fold_with(&mut hygiene()); + + // Ensure that we have enough parenthesis. let module = module.fold_with(&mut fixer(Some(&comments))); let mut buf = vec![]; diff --git a/crates/swc_ecma_transforms_typescript/src/strip.rs b/crates/swc_ecma_transforms_typescript/src/strip.rs index 6bb136552ef..423d21857e5 100644 --- a/crates/swc_ecma_transforms_typescript/src/strip.rs +++ b/crates/swc_ecma_transforms_typescript/src/strip.rs @@ -78,11 +78,12 @@ pub struct Config { pub pragma_frag: Option, } -pub fn strip_with_config(config: Config) -> impl Fold + VisitMut { +pub fn strip_with_config(config: Config, top_level_mark: Mark) -> impl Fold + VisitMut { as_folder(Strip { config, comments: NoopComments, jsx: None, + top_level_ctxt: SyntaxContext::empty().apply_mark(top_level_mark), non_top_level: Default::default(), scope: Default::default(), is_side_effect_import: Default::default(), @@ -97,8 +98,8 @@ pub fn strip_with_config(config: Config) -> impl Fold + VisitMut { /// /// See the `examples` directory of the crate to see how you can transpile a /// typescript file to a javascript file. -pub fn strip() -> impl Fold + VisitMut { - strip_with_config(Default::default()) +pub fn strip(top_level_mark: Mark) -> impl Fold + VisitMut { + strip_with_config(Default::default(), top_level_mark) } /// [strip], but aware of jsx. @@ -145,6 +146,7 @@ where pragma_id, pragma_frag_id, }), + top_level_ctxt: SyntaxContext::empty().apply_mark(top_level_mark), non_top_level: Default::default(), scope: Default::default(), is_side_effect_import: Default::default(), @@ -189,18 +191,19 @@ where jsx: Option, non_top_level: bool, + top_level_ctxt: SyntaxContext, scope: Scope, is_side_effect_import: bool, is_type_only_export: bool, uninitialized_vars: Vec, - /// Names of top-level declarations. - /// This is used to prevent emittnig a variable with same name multiple + /// Names of declarations. + /// This is used to prevent emitting a variable with same name multiple /// name. /// - /// If an identifier is in this list, thre [VisitMut] impl should not add a - /// varaible with it. + /// If an identifier is in this list, the [VisitMut] impl should not add a + /// variable with it. /// /// This field is filled by [Visit] impl and [VisitMut] impl. decl_names: AHashSet, @@ -1299,7 +1302,11 @@ where var.map(|var| { Decl::Var(VarDecl { span: module_span, - kind: VarDeclKind::Var, + kind: if module_name.span.ctxt != self.top_level_ctxt { + VarDeclKind::Let + } else { + VarDeclKind::Var + }, declare: false, decls: vec![var], }) @@ -1758,7 +1765,11 @@ where if let Some(var) = self.create_uninit_var(e.span, e.id.to_id()) { stmts.push(Stmt::Decl(Decl::Var(VarDecl { span: DUMMY_SP, - kind: VarDeclKind::Var, + kind: if e.id.span.ctxt != self.top_level_ctxt { + VarDeclKind::Let + } else { + VarDeclKind::Var + }, declare: false, decls: vec![var], }))); @@ -2077,7 +2088,11 @@ where span: e.span, decl: Decl::Var(VarDecl { span: DUMMY_SP, - kind: VarDeclKind::Var, + kind: if e.id.span.ctxt != self.top_level_ctxt { + VarDeclKind::Let + } else { + VarDeclKind::Var + }, declare: false, decls: vec![var], }), @@ -2087,7 +2102,7 @@ where self.handle_enum(e, &mut stmts) } ModuleItem::Stmt(Stmt::Decl(Decl::TsEnum(e))) => { - // var Foo; + // let Foo; // (function (Foo) { // Foo[Foo["a"] = 0] = "a"; // })(Foo || (Foo = {})); @@ -2096,7 +2111,11 @@ where stmts.push( Stmt::Decl(Decl::Var(VarDecl { span: DUMMY_SP, - kind: VarDeclKind::Var, + kind: if e.id.span.ctxt != self.top_level_ctxt { + VarDeclKind::Let + } else { + VarDeclKind::Var + }, declare: false, decls: vec![var], })) diff --git a/crates/swc_ecma_transforms_typescript/tests/fixture/issue-1653/output.js b/crates/swc_ecma_transforms_typescript/tests/fixture/issue-1653/output.js index 2680cdd1c0f..01e02b6e341 100644 --- a/crates/swc_ecma_transforms_typescript/tests/fixture/issue-1653/output.js +++ b/crates/swc_ecma_transforms_typescript/tests/fixture/issue-1653/output.js @@ -1,6 +1,6 @@ var X; (function(X1) { - var Z1; + let Z1; (function(Z) { Z.foo = 0; })(Z1 || (Z1 = { @@ -9,10 +9,12 @@ var X; })(X || (X = { })); var Y; -(function(Y) { +(function(Y1) { + let Z2; (function(Z) { Z.bar = 1; - })(Z1 || (Z1 = { + })(Z2 || (Z2 = { })); + Y1.Z = Z2; })(Y || (Y = { })); diff --git a/crates/swc_ecma_transforms_typescript/tests/fixture/issue-2234/output.js b/crates/swc_ecma_transforms_typescript/tests/fixture/issue-2234/output.js index 98fc1153e63..61b4871a0a6 100644 --- a/crates/swc_ecma_transforms_typescript/tests/fixture/issue-2234/output.js +++ b/crates/swc_ecma_transforms_typescript/tests/fixture/issue-2234/output.js @@ -1,6 +1,6 @@ var Shapes; (function(Shapes1) { - var Polygons1; + let Polygons1; (function(Polygons) { class Triangle { } diff --git a/crates/swc_ecma_transforms_typescript/tests/fixture/next/server/render/1/output.js b/crates/swc_ecma_transforms_typescript/tests/fixture/next/server/render/1/output.js index a076b4889b5..fc8505fbb0a 100644 --- a/crates/swc_ecma_transforms_typescript/tests/fixture/next/server/render/1/output.js +++ b/crates/swc_ecma_transforms_typescript/tests/fixture/next/server/render/1/output.js @@ -248,7 +248,7 @@ export async function renderToHTML(req, res, pathname, query, renderOpts) { }; } }; - let props; + let props1; const ampState = { ampFirst: pageConfig.amp === true, hasQuery: Boolean(query.amp), @@ -256,7 +256,7 @@ export async function renderToHTML(req, res, pathname, query, renderOpts) { }; const inAmpMode = isInAmpMode(ampState); const reactLoadableModules = []; - let head = defaultHead(inAmpMode); + let head1 = defaultHead(inAmpMode); let scriptLoader = { }; const nextExport = !isSSG && (renderOpts.nextExport || dev && (isAutoExport || isFallback)); @@ -266,7 +266,7 @@ export async function renderToHTML(req, res, pathname, query, renderOpts) { { - head = state; + head1 = state; }, updateScripts: (scripts)=>{ scriptLoader = scripts; @@ -293,17 +293,17 @@ export async function renderToHTML(req, res, pathname, query, renderOpts) { ; - props = await loadGetInitialProps(App, { + props1 = await loadGetInitialProps(App, { AppTree: ctx.AppTree, Component, router, ctx }); if ((isSSG || getServerSideProps) && isPreview) { - props.__N_PREVIEW = true; + props1.__N_PREVIEW = true; } if (isSSG) { - props[STATIC_PROPS_ID] = true; + props1[STATIC_PROPS_ID] = true; } if (isSSG && !isFallback) { let data; @@ -384,16 +384,16 @@ export async function renderToHTML(req, res, pathname, query, renderOpts) { } else { data.revalidate = false; } - props.pageProps = Object.assign({ - }, props.pageProps, "props" in data ? data.props : undefined); + props1.pageProps = Object.assign({ + }, props1.pageProps, "props" in data ? data.props : undefined); renderOpts.revalidate = "revalidate" in data ? data.revalidate : undefined; - renderOpts.pageData = props; + renderOpts.pageData = props1; if (renderOpts.isNotFound) { return null; } } if (getServerSideProps) { - props[SERVER_PROPS_ID] = true; + props1[SERVER_PROPS_ID] = true; } if (getServerSideProps && !isFallback) { let data; @@ -471,19 +471,19 @@ export async function renderToHTML(req, res, pathname, query, renderOpts) { if ((dev || isBuildTimeSSG) && !isSerializableProps(pathname, "getServerSideProps", data.props)) { throw new Error("invariant: getServerSideProps did not return valid props. Please report this."); } - props.pageProps = Object.assign({ - }, props.pageProps, data.props); - renderOpts.pageData = props; + props1.pageProps = Object.assign({ + }, props1.pageProps, data.props); + renderOpts.pageData = props1; } - if (!isSSG && !getServerSideProps && process.env.NODE_ENV !== "production" && Object.keys(props?.pageProps || { + if (!isSSG && !getServerSideProps && process.env.NODE_ENV !== "production" && Object.keys(props1?.pageProps || { }).includes("url")) { console.warn(`The prop \`url\` is a reserved prop in Next.js for legacy reasons and will be overridden on page ${pathname}\n` + `See more info here: https://nextjs.org/docs/messages/reserved-page-prop`); } if (isDataReq && !isSSG || renderOpts.isRedirect) { - return RenderResult.fromStatic(JSON.stringify(props)); + return RenderResult.fromStatic(JSON.stringify(props1)); } if (isFallback) { - props.pageProps = { + props1.pageProps = { }; } if (isResSent(res) && !isSSG) return null; @@ -515,21 +515,21 @@ export async function renderToHTML(req, res, pathname, query, renderOpts) { const html = ReactDOMServer.renderToString(); return { html, - head + head: head1 }; } - if (dev && (props.router || props.Component)) { + if (dev && (props1.router || props1.Component)) { throw new Error(`'router' and 'Component' can not be returned in getInitialProps from _app.js https://nextjs.org/docs/messages/cant-override-next-props`); } const { App: EnhancedApp , Component: EnhancedComponent } = enhanceComponents(options, App, Component); const html = ReactDOMServer.renderToString( - + ); return { html, - head + head: head1 }; }; const documentCtx = { @@ -555,7 +555,7 @@ export async function renderToHTML(req, res, pathname, query, renderOpts) { } else { const content = ctx.err && ErrorDebug ? : - + ; const bodyResult = concurrentFeatures ? await renderToStream(content, generateStaticHTML) : piperFromArray([ @@ -565,7 +565,7 @@ export async function renderToHTML(req, res, pathname, query, renderOpts) { bodyResult, documentElement: ()=>Document() , - head, + head: head1, headTags: [], styles: jsxStyleRegistry.styles() }; @@ -590,9 +590,9 @@ export async function renderToHTML(req, res, pathname, query, renderOpts) { const docComponentsRendered = { }; const { assetPrefix , buildId , customServer , defaultLocale , disableOptimizedLoading , domainLocales , locale , locales , runtimeConfig } = renderOpts; - const htmlProps = { + const htmlProps1 = { __NEXT_DATA__: { - props, + props: props1, page: pathname, query, buildId, @@ -637,9 +637,9 @@ export async function renderToHTML(req, res, pathname, query, renderOpts) { }; const documentHTML = ReactDOMServer.renderToStaticMarkup( - + - {documentResult.documentElement(htmlProps)} + {documentResult.documentElement(htmlProps1)} diff --git a/crates/swc_ecma_transforms_typescript/tests/strip.rs b/crates/swc_ecma_transforms_typescript/tests/strip.rs index 19573d33329..71a2a58a196 100644 --- a/crates/swc_ecma_transforms_typescript/tests/strip.rs +++ b/crates/swc_ecma_transforms_typescript/tests/strip.rs @@ -1,8 +1,8 @@ use std::path::PathBuf; -use swc_common::chain; +use swc_common::{chain, pass::Optional, Mark}; use swc_ecma_parser::{Syntax, TsConfig}; -use swc_ecma_transforms_base::resolver::resolver; +use swc_ecma_transforms_base::resolver::resolver_with_mark; use swc_ecma_transforms_compat::{ es2015::{block_scoping, destructuring, parameters}, es2017::async_to_generator, @@ -14,32 +14,28 @@ use swc_ecma_transforms_typescript::{strip, strip::strip_with_config}; use swc_ecma_visit::Fold; fn tr() -> impl Fold { - strip_with_config(strip::Config { - no_empty_export: true, - ..Default::default() - }) + tr_config(None, None) } -test!( - Syntax::Typescript(Default::default()), - |_| chain!( - strip(), - resolver(), - parameters(parameters::Config { - ignore_function_length: true - }), - destructuring(destructuring::Config { loose: false }), - block_scoping(), - ), - fn_len_default_assignment_with_types, - "export function transformFileSync( - filename: string, - opts?: Object = {}, - ): string {}", - "export function transformFileSync(filename, opts) { - if (opts === void 0) opts = {}; - }" -); +fn tr_config( + config: Option, + decorators_config: Option, +) -> impl Fold { + let mark = Mark::fresh(Mark::root()); + let has_decorators = decorators_config.is_some(); + let config = config.unwrap_or_else(|| strip::Config { + no_empty_export: true, + ..Default::default() + }); + chain!( + Optional::new( + decorators(decorators_config.unwrap_or_default()), + has_decorators, + ), + resolver_with_mark(mark), + strip_with_config(config, mark), + ) +} macro_rules! to { ($name:ident, $from:expr, $to:expr) => { @@ -64,7 +60,7 @@ macro_rules! test_with_config { decorators: true, ..Default::default() }), - |_| strip_with_config($config), + |_| tr_config(Some($config), None), $name, $from, $to, @@ -73,6 +69,26 @@ macro_rules! test_with_config { }; } +test!( + Syntax::Typescript(Default::default()), + |_| chain!( + tr(), + parameters(parameters::Config { + ignore_function_length: true + }), + destructuring(destructuring::Config { loose: false }), + block_scoping(), + ), + fn_len_default_assignment_with_types, + "export function transformFileSync( + filename: string, + opts?: Object = {}, + ): string {}", + "export function transformFileSync(filename, opts) { + if (opts === void 0) opts = {}; + }" +); + to!( constructor_01, "class Foo { @@ -237,7 +253,7 @@ const dict = {};" test!( ::swc_ecma_parser::Syntax::Typescript(Default::default()), - |_| chain!(tr(), resolver()), + |_| tr(), issue_392_2, " import { PlainObject } from 'simplytyped'; @@ -452,6 +468,16 @@ to!( export default MyType;" ); +to!( + issue_685_4, + " + interface MyType { + other: number; + } + export default MyType;", + "" +); + to!( ts_enum_str_init, "enum FlexSize { @@ -705,7 +731,7 @@ to!( } });"#, r#"Deno.test("[ws] WebSocket should act as asyncIterator", async ()=>{ - var Frames; + let Frames; (function(Frames) { Frames[Frames["ping"] = 0] = "ping"; Frames[Frames["hello"] = 1] = "hello"; @@ -3139,11 +3165,14 @@ test!( ..Default::default() }), |_| { - strip_with_config(strip::Config { - no_empty_export: true, - import_not_used_as_values: strip::ImportsNotUsedAsValues::Preserve, - ..Default::default() - }) + tr_config( + Some(strip::Config { + no_empty_export: true, + import_not_used_as_values: strip::ImportsNotUsedAsValues::Preserve, + ..Default::default() + }), + None, + ) }, deno_7413_3, " @@ -3272,11 +3301,14 @@ test!( Syntax::Typescript(TsConfig { ..Default::default() }), - |_| strip_with_config(strip::Config { - use_define_for_class_fields: true, - no_empty_export: true, - ..Default::default() - }), + |_| tr_config( + Some(strip::Config { + use_define_for_class_fields: true, + no_empty_export: true, + ..Default::default() + }), + None + ), compile_to_class_constructor_collision_ignores_types, r#" class C { @@ -3305,7 +3337,7 @@ test!( decorators: true, ..Default::default() }), - |_| chain!(resolver(), decorators(Default::default()), tr()), + |_| tr_config(None, Some(Default::default())), issue_367, " @@ -3325,13 +3357,13 @@ class A { }", "import { bind } from 'some'; let A = _decorate([], function(_initialize) { - class A{ + class A1{ constructor(){ _initialize(this); } } return { - F: A, + F: A1, d: [{ kind: 'get', decorators: [bind], @@ -3419,7 +3451,6 @@ to!( util1.objectValues = (obj) => { }; })(util || (util = {})); - " ); @@ -3482,7 +3513,7 @@ to!( " var Test; (function(Test1) { - var DummyValues; + let DummyValues; (function(DummyValues) { DummyValues['A'] = 'A'; DummyValues['B'] = 'B'; @@ -4222,6 +4253,95 @@ to!( })(Color || (Color = {}));" ); +to!( + issue_2886_enum_namespace_block_scoping, + " +export enum Enum { + test = 1 +} +namespace Namespace { + export enum Enum { + test = 1 + } + export enum Enum { + test2 = 1 + } +} +{ + enum Enum { + test = 1 + } + namespace Namespace { + export enum Enum { + test = 1 + } + } +} +{ + enum Enum { + test = 1 + } + namespace Namespace { + export enum Enum { + test = 1 + } + } +} +", + r#" +export var Enum; +(function (Enum) { + Enum[Enum["test"] = 1] = "test"; +})(Enum || (Enum = {})); +var Namespace; +(function(Namespace1) { + let Enum; + (function(Enum) { + Enum[Enum["test"] = 1] = "test"; + })(Enum || (Enum = { + })); + (function(Enum) { + Enum[Enum["test2"] = 1] = "test2"; + })(Enum || (Enum = { + })); + Namespace1.Enum = Enum; +})(Namespace || (Namespace = { +})); +{ + let Enum; + (function (Enum) { + Enum[Enum["test"] = 1] = "test"; + })(Enum || (Enum = {})); + let Namespace2; + (function(Namespace) { + let Enum; + (function(Enum) { + Enum[Enum["test"] = 1] = "test"; + })(Enum || (Enum = { + })); + Namespace.Enum = Enum; + })(Namespace2 || (Namespace2 = { + })); +} +{ + let Enum; + (function (Enum) { + Enum[Enum["test"] = 1] = "test"; + })(Enum || (Enum = {})); + let Namespace3; + (function(Namespace) { + let Enum; + (function(Enum) { + Enum[Enum["test"] = 1] = "test"; + })(Enum || (Enum = { + })); + Namespace.Enum = Enum; + })(Namespace3 || (Namespace3 = { + })); +} + "# +); + #[testing::fixture("tests/fixture/**/input.ts")] #[testing::fixture("tests/fixture/**/input.tsx")] fn exec(input: PathBuf) { diff --git a/crates/swc_ecma_transforms_typescript/tests/strip_correctness.rs b/crates/swc_ecma_transforms_typescript/tests/strip_correctness.rs index 7b1d4a34061..4ad9a3c24ca 100644 --- a/crates/swc_ecma_transforms_typescript/tests/strip_correctness.rs +++ b/crates/swc_ecma_transforms_typescript/tests/strip_correctness.rs @@ -3,11 +3,11 @@ use std::{ path::PathBuf, sync::{Arc, RwLock}, }; -use swc_common::FileName; +use swc_common::{FileName, Mark}; use swc_ecma_ast::*; use swc_ecma_codegen::{self, Emitter}; use swc_ecma_parser::{lexer::Lexer, EsConfig, Parser, StringInput, Syntax, TsConfig}; -use swc_ecma_transforms_base::fixer::fixer; +use swc_ecma_transforms_base::{fixer::fixer, hygiene::hygiene, resolver::resolver_with_mark}; use swc_ecma_transforms_typescript::{strip, strip::strip_with_config}; use swc_ecma_visit::{Fold, FoldWith}; @@ -123,11 +123,17 @@ fn identity(entry: PathBuf) { let module = parser .parse_typescript_module() .map(|p| { - p.fold_with(&mut strip_with_config(strip::Config { - no_empty_export: true, - ..Default::default() - })) - .fold_with(&mut fixer(None)) + let mark = Mark::fresh(Mark::root()); + p.fold_with(&mut resolver_with_mark(mark)) + .fold_with(&mut strip_with_config( + strip::Config { + no_empty_export: true, + ..Default::default() + }, + mark, + )) + .fold_with(&mut hygiene()) + .fold_with(&mut fixer(None)) }) .map_err(|e| { eprintln!("failed to parse as typescript module"); diff --git a/crates/swc_estree_compat/benches/babelify.rs b/crates/swc_estree_compat/benches/babelify.rs index 9e1527cf08a..fc2768b82fe 100644 --- a/crates/swc_estree_compat/benches/babelify.rs +++ b/crates/swc_estree_compat/benches/babelify.rs @@ -5,10 +5,10 @@ extern crate test; use std::{hint::black_box, io::stderr, sync::Arc}; use swc::config::IsModule; -use swc_common::{errors::Handler, FileName, FilePathMapping, SourceFile, SourceMap}; +use swc_common::{errors::Handler, FileName, FilePathMapping, Mark, SourceFile, SourceMap}; use swc_ecma_ast::{EsVersion, Program}; use swc_ecma_parser::Syntax; -use swc_ecma_transforms::{compat::es2020, typescript}; +use swc_ecma_transforms::{compat::es2020, resolver_with_mark, typescript}; use swc_ecma_visit::FoldWith; use swc_estree_compat::babelify::{Babelify, Context}; use test::Bencher; @@ -54,8 +54,10 @@ fn babelify_only(b: &mut Bencher) { let handler = Handler::with_emitter_writer(Box::new(stderr()), Some(c.cm.clone())); let module = c.run_transform(&handler, false, || { + let mark = Mark::fresh(Mark::root()); module - .fold_with(&mut typescript::strip()) + .fold_with(&mut resolver_with_mark(mark)) + .fold_with(&mut typescript::strip(mark)) .fold_with(&mut es2020(Default::default())) }); diff --git a/crates/swc_node_bundler/benches/bench.rs b/crates/swc_node_bundler/benches/bench.rs index 2bb88dcc98e..7368ea2afe8 100644 --- a/crates/swc_node_bundler/benches/bench.rs +++ b/crates/swc_node_bundler/benches/bench.rs @@ -14,10 +14,10 @@ use std::{ use swc::resolver::NodeResolver; use swc_atoms::js_word; use swc_bundler::{Bundler, Load, ModuleData, ModuleRecord}; -use swc_common::{sync::Lrc, FileName, SourceMap, Span, GLOBALS}; +use swc_common::{sync::Lrc, FileName, Mark, SourceMap, Span, GLOBALS}; use swc_ecma_ast::*; use swc_ecma_parser::{lexer::Lexer, Parser, StringInput, Syntax, TsConfig}; -use swc_ecma_transforms::typescript::strip; +use swc_ecma_transforms::{resolver_with_mark, typescript::strip}; use swc_ecma_visit::FoldWith; use test::Bencher; @@ -88,7 +88,11 @@ impl Load for Loader { let mut parser = Parser::new_from(lexer); let module = parser.parse_module().unwrap(); - let module = module.fold_with(&mut strip()); + + let mark = Mark::fresh(Mark::root()); + let module = module + .fold_with(&mut resolver_with_mark(mark)) + .fold_with(&mut strip(mark)); Ok(ModuleData { fm, module,