diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2021-02-23 14:55:08 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-23 22:55:08 +0800 |
commit | d68d155f93a355a9f6f0451150186b7fad8c58b8 (patch) | |
tree | e3cba7df7cd9d2221ff2b97ea30d8c9a07e7bba1 /test/compress/exports.js | |
parent | e535f1918915251681df6ffe80a56d56672685ea (diff) | |
download | tracifyjs-d68d155f93a355a9f6f0451150186b7fad8c58b8.tar.gz tracifyjs-d68d155f93a355a9f6f0451150186b7fad8c58b8.zip |
support `class` literals (#4658)
Diffstat (limited to 'test/compress/exports.js')
-rw-r--r-- | test/compress/exports.js | 44 |
1 files changed, 38 insertions, 6 deletions
diff --git a/test/compress/exports.js b/test/compress/exports.js index 24c1d8c0..d3a4ffce 100644 --- a/test/compress/exports.js +++ b/test/compress/exports.js @@ -17,22 +17,25 @@ var_defs: { defuns: { input: { + export class A {} export function e() {} export function* f(a) {} export async function g(b, c) {} export async function* h({}, ...[]) {} } - expect_exact: "export function e(){}export function*f(a){}export async function g(b,c){}export async function*h({},...[]){}" + expect_exact: "export class A{}export function e(){}export function*f(a){}export async function g(b,c){}export async function*h({},...[]){}" } defaults: { input: { export default 42; + export default async; export default (x, y) => x * x; + export default class {}; export default function*(a, b) {}; export default async function f({ c }, ...[ d ]) {}; } - expect_exact: "export default 42;export default(x,y)=>x*x;export default function*(a,b){}export default async function f({c:c},...[d]){}" + expect_exact: "export default 42;export default async;export default(x,y)=>x*x;export default class{}export default function*(a,b){}export default async function f({c:c},...[d]){}" } defaults_parenthesis_1: { @@ -88,18 +91,22 @@ drop_unused: { input: { export default 42; export default (x, y) => x * x; - export default function*(a, b) {}; - export default async function f({ c }, ...[ d ]) {}; + export default class A extends B { get p() { h() } } + export default function*(a, b) {} + export default async function f({ c }, ...[ d ]) {} export var e; export function g(x, [ y ], ...z) {} + function h() {} } expect: { export default 42; export default (x, y) => x * x; - export default function*(a, b) {}; - export default async function({}) {}; + export default class extends B { get p() { h() } } + export default function*(a, b) {} + export default async function({}) {} export var e; export function g(x, []) {} + function h() {} } } @@ -195,3 +202,28 @@ hoist_exports: { export { f as bbb, o as ccc, c as fff }; } } + +keep_return_values: { + options = { + booleans: true, + evaluate: true, + reduce_vars: true, + toplevel: true, + } + input: { + export default function() { + return []; + } + export default function f() { + return null; + } + } + expect: { + export default function() { + return []; + } + export default function f() { + return null; + } + } +} |