2023-01-12 09:54:36 +03:00
|
|
|
use std::path::PathBuf;
|
|
|
|
|
2022-08-12 16:39:26 +03:00
|
|
|
use swc_common::{chain, comments::SingleThreadedComments, Mark};
|
2019-12-24 16:53:48 +03:00
|
|
|
use swc_ecma_parser::Syntax;
|
2022-04-26 10:38:50 +03:00
|
|
|
use swc_ecma_transforms_base::resolver;
|
2021-08-13 13:03:04 +03:00
|
|
|
use swc_ecma_transforms_compat::{
|
2021-12-02 04:04:01 +03:00
|
|
|
es2015::{
|
|
|
|
arrow, block_scoping, classes, destructuring, parameters, parameters::Config, spread,
|
|
|
|
},
|
2021-08-13 13:03:04 +03:00
|
|
|
es2017::async_to_generator,
|
|
|
|
};
|
2023-01-12 09:54:36 +03:00
|
|
|
use swc_ecma_transforms_testing::{test, test_exec, test_fixture};
|
2020-07-23 20:18:22 +03:00
|
|
|
use swc_ecma_visit::Fold;
|
2019-12-24 16:53:48 +03:00
|
|
|
|
2019-12-09 15:02:51 +03:00
|
|
|
fn syntax() -> Syntax {
|
2020-05-07 12:17:57 +03:00
|
|
|
Default::default()
|
2019-12-09 15:02:51 +03:00
|
|
|
}
|
2018-11-28 06:24:08 +03:00
|
|
|
|
2021-12-02 04:04:01 +03:00
|
|
|
fn tr(c: Config) -> impl Fold {
|
2022-04-26 10:38:50 +03:00
|
|
|
let unresolved_mark = Mark::new();
|
|
|
|
let top_level_mark = Mark::new();
|
|
|
|
|
2020-05-07 12:17:57 +03:00
|
|
|
chain!(
|
2022-04-26 10:38:50 +03:00
|
|
|
resolver(unresolved_mark, top_level_mark, false),
|
2022-06-25 07:55:59 +03:00
|
|
|
parameters(c, unresolved_mark),
|
2021-01-05 08:29:52 +03:00
|
|
|
destructuring(destructuring::Config { loose: false }),
|
2022-07-13 13:29:03 +03:00
|
|
|
block_scoping(unresolved_mark),
|
2020-05-07 12:17:57 +03:00
|
|
|
)
|
2018-11-28 06:24:08 +03:00
|
|
|
}
|
|
|
|
|
2019-02-21 16:21:48 +03:00
|
|
|
test!(
|
2020-05-07 12:17:57 +03:00
|
|
|
syntax(),
|
2021-12-02 04:04:01 +03:00
|
|
|
|_| tr(Default::default()),
|
2020-05-07 12:17:57 +03:00
|
|
|
issue_254,
|
2023-10-30 04:38:59 +03:00
|
|
|
"export const someFunction = (update = false, action = {}) => {}"
|
2019-02-21 16:21:48 +03:00
|
|
|
);
|
|
|
|
|
2019-02-18 05:15:04 +03:00
|
|
|
test!(
|
2020-05-07 12:17:57 +03:00
|
|
|
syntax(),
|
2021-12-02 04:04:01 +03:00
|
|
|
|_| tr(Default::default()),
|
2020-05-07 12:17:57 +03:00
|
|
|
issue_227,
|
|
|
|
"export default function fn1(...args) {
|
2019-02-18 05:15:04 +03:00
|
|
|
fn2(...args);
|
2023-10-30 04:38:59 +03:00
|
|
|
}"
|
2019-02-18 05:15:04 +03:00
|
|
|
);
|
|
|
|
|
2019-02-12 16:18:14 +03:00
|
|
|
test!(
|
2020-05-07 12:17:57 +03:00
|
|
|
syntax(),
|
2021-12-02 04:04:01 +03:00
|
|
|
|_| tr(Default::default()),
|
2020-05-07 12:17:57 +03:00
|
|
|
issue_169,
|
|
|
|
r#"
|
2019-02-12 16:18:14 +03:00
|
|
|
class Foo {
|
|
|
|
func(a, b = Date.now()) {
|
|
|
|
return {a};
|
|
|
|
}
|
|
|
|
}
|
2023-10-30 04:38:59 +03:00
|
|
|
"#
|
2019-02-12 16:18:14 +03:00
|
|
|
);
|
|
|
|
|
2018-11-28 06:24:08 +03:00
|
|
|
test!(
|
2020-05-07 12:17:57 +03:00
|
|
|
syntax(),
|
2021-12-02 04:04:01 +03:00
|
|
|
|_| tr(Default::default()),
|
2020-05-07 12:17:57 +03:00
|
|
|
babel_6057_simple,
|
|
|
|
r#"const a = 'bar';
|
2018-11-28 06:24:08 +03:00
|
|
|
function foo(...a) {
|
|
|
|
return a;
|
|
|
|
}"#
|
|
|
|
);
|
|
|
|
|
|
|
|
test!(
|
2020-05-07 12:17:57 +03:00
|
|
|
syntax(),
|
2021-12-02 04:04:01 +03:00
|
|
|
|_| tr(Default::default()),
|
2020-05-07 12:17:57 +03:00
|
|
|
default_before_last,
|
2023-10-30 04:38:59 +03:00
|
|
|
r#"function foo({x,y} = "foo", b) {}"#
|
2018-11-28 06:24:08 +03:00
|
|
|
);
|
|
|
|
|
|
|
|
test_exec!(
|
2020-05-07 12:17:57 +03:00
|
|
|
syntax(),
|
2021-12-02 04:04:01 +03:00
|
|
|
|_| tr(Default::default()),
|
2020-05-07 12:17:57 +03:00
|
|
|
default_destructuring,
|
|
|
|
r#"function required(msg) {
|
2018-11-28 06:24:08 +03:00
|
|
|
throw new Error(msg);
|
|
|
|
}
|
|
|
|
|
|
|
|
function sum(
|
|
|
|
{ arr = required('arr is required') } = { arr: arr = [] },
|
|
|
|
length = arr.length
|
|
|
|
) {
|
|
|
|
let i = 0;
|
|
|
|
let acc = 0;
|
|
|
|
for (let item of arr) {
|
|
|
|
if (i >= length) return acc;
|
|
|
|
acc += item;
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
return acc;
|
|
|
|
}
|
|
|
|
|
|
|
|
expect(sum({arr:[1,2]})).toBe(3);"#
|
|
|
|
);
|
|
|
|
|
|
|
|
test_exec!(
|
2020-05-07 12:17:57 +03:00
|
|
|
syntax(),
|
2021-12-02 04:04:01 +03:00
|
|
|
|_| tr(Default::default()),
|
2020-05-07 12:17:57 +03:00
|
|
|
default_earlier_params,
|
|
|
|
r#"function f(a, b = a, c = b) { return c; }
|
2018-11-28 06:24:08 +03:00
|
|
|
|
|
|
|
expect(3).toBe(f(3));"#
|
|
|
|
);
|
|
|
|
|
|
|
|
test!(
|
2020-05-07 12:17:57 +03:00
|
|
|
ignore,
|
|
|
|
syntax(),
|
2021-12-02 04:04:01 +03:00
|
|
|
|_| tr(Default::default()),
|
2020-05-07 12:17:57 +03:00
|
|
|
default_eval,
|
|
|
|
r#"let x = "outside";
|
2018-11-28 06:24:08 +03:00
|
|
|
function outer(a = () => eval("x")) {
|
|
|
|
let x = "inside";
|
|
|
|
return a();
|
|
|
|
}
|
|
|
|
outer();"#
|
|
|
|
);
|
|
|
|
|
|
|
|
test_exec!(
|
2020-05-07 12:17:57 +03:00
|
|
|
syntax(),
|
2021-12-02 04:04:01 +03:00
|
|
|
|_| tr(Default::default()),
|
2020-05-07 12:17:57 +03:00
|
|
|
default_iife_1128,
|
|
|
|
r#"const bar = true;
|
2018-11-28 06:24:08 +03:00
|
|
|
|
|
|
|
function foo(a = bar, ...b) {
|
|
|
|
const bar = false;
|
|
|
|
expect(b[0]).toBe(2);
|
|
|
|
expect(b[1]).toBe(3);
|
|
|
|
}
|
|
|
|
|
|
|
|
foo(1, 2, 3);"#
|
|
|
|
);
|
|
|
|
|
|
|
|
test!(
|
2020-05-07 12:17:57 +03:00
|
|
|
syntax(),
|
2022-02-15 07:02:08 +03:00
|
|
|
|t| chain!(
|
|
|
|
classes(Some(t.comments.clone()), Default::default()),
|
|
|
|
tr(Default::default())
|
|
|
|
),
|
2020-05-07 12:17:57 +03:00
|
|
|
default_iife_4253,
|
|
|
|
r#"class Ref {
|
2018-11-28 06:24:08 +03:00
|
|
|
constructor(id = ++Ref.nextID) {
|
|
|
|
this.id = id
|
|
|
|
}
|
|
|
|
}
|
2023-10-30 04:38:59 +03:00
|
|
|
Ref.nextID = 0"#
|
2018-11-28 06:24:08 +03:00
|
|
|
);
|
|
|
|
|
|
|
|
test_exec!(
|
2020-05-07 12:17:57 +03:00
|
|
|
ignore,
|
|
|
|
syntax(),
|
|
|
|
// Stage0
|
2021-12-02 04:04:01 +03:00
|
|
|
|_| tr(Default::default()),
|
2020-05-07 12:17:57 +03:00
|
|
|
default_iife_4253_exec,
|
|
|
|
r#"class Ref {
|
2018-11-28 06:24:08 +03:00
|
|
|
static nextId = 0
|
|
|
|
constructor(id = ++Ref.nextId, n = id) {
|
|
|
|
this.id = n
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
expect(new Ref().id).toBe(1);
|
|
|
|
expect(new Ref().id).toBe(2);"#
|
|
|
|
);
|
|
|
|
|
|
|
|
test!(
|
2020-05-07 12:17:57 +03:00
|
|
|
syntax(),
|
2022-02-15 07:02:08 +03:00
|
|
|
|t| chain!(
|
|
|
|
classes(Some(t.comments.clone()), Default::default()),
|
|
|
|
tr(Default::default())
|
|
|
|
),
|
2020-05-07 12:17:57 +03:00
|
|
|
default_iife_self,
|
|
|
|
r#"class Ref {
|
2018-11-28 06:24:08 +03:00
|
|
|
constructor(ref = Ref) {
|
|
|
|
this.ref = ref
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class X {
|
|
|
|
constructor(x = foo) {
|
|
|
|
this.x = x
|
|
|
|
}
|
2023-10-30 04:38:59 +03:00
|
|
|
}"#
|
2018-11-28 06:24:08 +03:00
|
|
|
);
|
|
|
|
|
|
|
|
test_exec!(
|
2020-05-07 12:17:57 +03:00
|
|
|
syntax(),
|
2021-12-02 04:04:01 +03:00
|
|
|
|_| tr(Default::default()),
|
2020-05-07 12:17:57 +03:00
|
|
|
default_iife_self_exec,
|
|
|
|
r#"class Ref {
|
2018-11-28 06:24:08 +03:00
|
|
|
constructor(ref = Ref) {
|
|
|
|
this.ref = ref
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
expect(new Ref().ref).toBe(Ref);"#
|
|
|
|
);
|
|
|
|
|
2019-02-21 16:21:48 +03:00
|
|
|
test!(
|
2020-05-07 12:17:57 +03:00
|
|
|
syntax(),
|
2021-12-02 04:04:01 +03:00
|
|
|
|_| tr(Default::default()),
|
2020-05-07 12:17:57 +03:00
|
|
|
default_multiple,
|
|
|
|
r#"var t = function (e = "foo", f = 5) {
|
2018-11-28 06:24:08 +03:00
|
|
|
return e + " bar " + f;
|
|
|
|
};
|
|
|
|
|
|
|
|
var a = function (e, f = 5) {
|
|
|
|
return e + " bar " + f;
|
2023-10-30 04:38:59 +03:00
|
|
|
};"#
|
2018-11-28 06:24:08 +03:00
|
|
|
);
|
|
|
|
|
|
|
|
test!(
|
2020-05-07 12:17:57 +03:00
|
|
|
syntax(),
|
2021-12-02 04:04:01 +03:00
|
|
|
|_| tr(Default::default()),
|
2020-05-07 12:17:57 +03:00
|
|
|
default_rest_mix,
|
|
|
|
r#"function fn(
|
2018-11-28 06:24:08 +03:00
|
|
|
a1,
|
|
|
|
a2 = 4,
|
|
|
|
{a3, a4},
|
|
|
|
a5,
|
2023-10-30 04:38:59 +03:00
|
|
|
{a6, a7} = {}) {}"#
|
2018-11-28 06:24:08 +03:00
|
|
|
);
|
|
|
|
|
2019-10-19 06:21:56 +03:00
|
|
|
test!(
|
2020-05-07 12:17:57 +03:00
|
|
|
syntax(),
|
2021-12-02 04:04:01 +03:00
|
|
|
|_| tr(Default::default()),
|
2020-05-07 12:17:57 +03:00
|
|
|
default_rest_1,
|
|
|
|
r#"const a = 1;
|
2018-11-28 06:24:08 +03:00
|
|
|
function rest(b = a, ...a) {
|
|
|
|
expect(b).toBe(1);
|
|
|
|
}
|
2023-10-30 04:38:59 +03:00
|
|
|
rest(undefined, 2)"#
|
2018-11-28 06:24:08 +03:00
|
|
|
);
|
|
|
|
|
2019-10-19 06:21:56 +03:00
|
|
|
test!(
|
2020-05-07 12:17:57 +03:00
|
|
|
syntax(),
|
2021-12-02 04:04:01 +03:00
|
|
|
|_| tr(Default::default()),
|
2020-05-07 12:17:57 +03:00
|
|
|
default_rest_2,
|
|
|
|
r#"const a = 1;
|
2018-11-28 06:24:08 +03:00
|
|
|
function rest2(b = a, ...a) {
|
|
|
|
expect(a[0]).toBe(2);
|
|
|
|
}
|
|
|
|
rest2(undefined, 2);"#
|
|
|
|
);
|
|
|
|
|
2019-10-19 06:21:56 +03:00
|
|
|
test!(
|
2020-05-07 12:17:57 +03:00
|
|
|
syntax(),
|
2021-12-02 04:04:01 +03:00
|
|
|
|_| tr(Default::default()),
|
2020-05-07 12:17:57 +03:00
|
|
|
default_rest_3,
|
|
|
|
r#"const a = 1;
|
2018-11-28 06:24:08 +03:00
|
|
|
function rest3(b = a, ...a) {
|
|
|
|
expect(a).toHaveLength(1);
|
|
|
|
}
|
2023-10-30 04:38:59 +03:00
|
|
|
rest3(undefined, 2)"#
|
2018-11-28 06:24:08 +03:00
|
|
|
);
|
|
|
|
|
|
|
|
test_exec!(
|
2020-05-07 12:17:57 +03:00
|
|
|
syntax(),
|
2021-12-02 04:04:01 +03:00
|
|
|
|_| tr(Default::default()),
|
2020-05-07 12:17:57 +03:00
|
|
|
default_rest_exec,
|
|
|
|
r#"const a = 1;
|
2018-11-28 06:24:08 +03:00
|
|
|
function rest(b = a, ...a) {
|
|
|
|
expect(b).toBe(1);
|
|
|
|
}
|
|
|
|
rest(undefined, 2)
|
|
|
|
|
|
|
|
function rest2(b = a, ...a) {
|
|
|
|
expect(a[0]).toBe(2);
|
|
|
|
}
|
|
|
|
rest2(undefined, 2)
|
|
|
|
|
|
|
|
function rest3(b = a, ...a) {
|
|
|
|
expect(a).toHaveLength(1);
|
|
|
|
}
|
|
|
|
rest3(undefined, 2)"#
|
|
|
|
);
|
|
|
|
|
|
|
|
test!(
|
2020-05-07 12:17:57 +03:00
|
|
|
syntax(),
|
2021-12-02 04:04:01 +03:00
|
|
|
|_| tr(Default::default()),
|
2020-05-07 12:17:57 +03:00
|
|
|
default_setter_noexec,
|
|
|
|
r#"const obj = {
|
2018-11-28 06:24:08 +03:00
|
|
|
set field(num = 1) {
|
|
|
|
this.num = num;
|
|
|
|
}
|
2023-10-30 04:38:59 +03:00
|
|
|
};"#
|
2018-11-28 06:24:08 +03:00
|
|
|
);
|
|
|
|
|
2021-12-02 04:04:01 +03:00
|
|
|
test!(
|
|
|
|
syntax(),
|
|
|
|
|_| tr(Default::default()),
|
|
|
|
default_setter_complex,
|
|
|
|
r#"const obj = {
|
|
|
|
set obj({ a, b } = {}) {
|
|
|
|
this.num = { a, b };
|
|
|
|
},
|
|
|
|
set arr([x, y] = []) {
|
|
|
|
this.num = { x, y }
|
|
|
|
}
|
2023-10-30 04:38:59 +03:00
|
|
|
};"#
|
2021-12-02 04:04:01 +03:00
|
|
|
);
|
|
|
|
|
2018-11-28 06:24:08 +03:00
|
|
|
test_exec!(
|
2020-05-07 12:17:57 +03:00
|
|
|
syntax(),
|
2021-12-02 04:04:01 +03:00
|
|
|
|_| tr(Default::default()),
|
2020-05-07 12:17:57 +03:00
|
|
|
default_setter_exec,
|
|
|
|
r#"const defaultValue = 1;
|
2018-11-28 06:24:08 +03:00
|
|
|
const obj = {
|
|
|
|
set field(num = defaultValue) {
|
|
|
|
this.num = num;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
obj.field = void 0;
|
|
|
|
|
|
|
|
expect(obj.num).toBe(defaultValue);"#
|
|
|
|
);
|
|
|
|
|
|
|
|
test!(
|
2020-05-07 12:17:57 +03:00
|
|
|
syntax(),
|
2021-12-02 04:04:01 +03:00
|
|
|
|_| tr(Default::default()),
|
2020-05-07 12:17:57 +03:00
|
|
|
default_single,
|
|
|
|
r#"var t = function (f = "foo") {
|
2018-11-28 06:24:08 +03:00
|
|
|
return f + " bar";
|
|
|
|
};"#
|
|
|
|
);
|
|
|
|
|
|
|
|
test!(
|
2020-05-07 12:17:57 +03:00
|
|
|
syntax(),
|
2021-12-02 04:04:01 +03:00
|
|
|
|_| tr(Default::default()),
|
2020-05-07 12:17:57 +03:00
|
|
|
destructuring_rest,
|
|
|
|
r#"// #3861
|
2018-11-28 06:24:08 +03:00
|
|
|
function t(x = "default", { a, b }, ...args) {
|
|
|
|
console.log(x, a, b, args);
|
2023-10-30 04:38:59 +03:00
|
|
|
}"#
|
2018-11-28 06:24:08 +03:00
|
|
|
);
|
|
|
|
|
|
|
|
test!(
|
2020-05-07 12:17:57 +03:00
|
|
|
syntax(),
|
2021-12-02 04:04:01 +03:00
|
|
|
|_| tr(Default::default()),
|
2020-05-07 12:17:57 +03:00
|
|
|
regression_4333,
|
|
|
|
r#"const args = 'bar';
|
2018-11-28 06:24:08 +03:00
|
|
|
function foo(...args) {
|
|
|
|
return args;
|
2023-10-30 04:38:59 +03:00
|
|
|
}"#
|
2018-11-28 06:24:08 +03:00
|
|
|
);
|
|
|
|
|
|
|
|
test!(
|
2020-05-07 12:17:57 +03:00
|
|
|
syntax(),
|
2021-12-02 04:04:01 +03:00
|
|
|
|_| tr(Default::default()),
|
2020-05-07 12:17:57 +03:00
|
|
|
regression_4348,
|
|
|
|
r#"function first(...values) {
|
2018-11-28 06:24:08 +03:00
|
|
|
var index = 0;
|
|
|
|
return values[index++];
|
|
|
|
}"#
|
|
|
|
);
|
|
|
|
|
|
|
|
test!(
|
2020-05-07 12:17:57 +03:00
|
|
|
ignore,
|
|
|
|
syntax(),
|
|
|
|
// type
|
2021-12-02 04:04:01 +03:00
|
|
|
|_| tr(Default::default()),
|
2020-05-07 12:17:57 +03:00
|
|
|
regression_4634,
|
|
|
|
r#"let oneOf = (...nodes) => {
|
2018-11-28 06:24:08 +03:00
|
|
|
if (nodes.length === 1) {
|
|
|
|
return nodes[0];
|
|
|
|
}
|
|
|
|
return ((new OneOfNode(nodes)): any)
|
2023-10-30 04:38:59 +03:00
|
|
|
}"#
|
2018-11-28 06:24:08 +03:00
|
|
|
);
|
|
|
|
|
2019-10-19 06:21:56 +03:00
|
|
|
test!(
|
2020-05-07 12:17:57 +03:00
|
|
|
syntax(),
|
2021-12-02 04:04:01 +03:00
|
|
|
|_| tr(Default::default()),
|
2020-05-07 12:17:57 +03:00
|
|
|
regression_5787,
|
|
|
|
r#"function f(a, ...rest) {
|
2018-11-28 06:24:08 +03:00
|
|
|
let b = rest[rest.length - 3];
|
|
|
|
let c = rest[rest.length - 2];
|
|
|
|
let d = rest[rest.length - 1];
|
|
|
|
return [a, b, c, d];
|
|
|
|
}
|
|
|
|
|
|
|
|
function f(a, ...rest) {
|
|
|
|
return rest[-1];
|
|
|
|
}"#
|
|
|
|
);
|
|
|
|
|
|
|
|
test_exec!(
|
2020-05-07 12:17:57 +03:00
|
|
|
syntax(),
|
2021-12-02 04:04:01 +03:00
|
|
|
|_| tr(Default::default()),
|
2020-05-07 12:17:57 +03:00
|
|
|
regression_5787_exec,
|
|
|
|
r#"function f1(a, ...rest) {
|
2018-11-28 06:24:08 +03:00
|
|
|
let b = rest[rest.length - 3];
|
|
|
|
let c = rest[rest.length - 2];
|
|
|
|
let d = rest[rest.length - 1];
|
|
|
|
return [a, b, c, d];
|
|
|
|
}
|
|
|
|
expect(f1(1, 2)).toEqual([1, undefined, undefined, 2]);
|
|
|
|
|
|
|
|
function f2(a, ...rest) {
|
|
|
|
return rest[-1];
|
|
|
|
}
|
|
|
|
expect(f2(1, 2)).toBeUndefined();"#
|
|
|
|
);
|
|
|
|
|
|
|
|
test!(
|
2020-05-07 12:17:57 +03:00
|
|
|
syntax(),
|
2021-12-02 04:04:01 +03:00
|
|
|
|_| tr(Default::default()),
|
2020-05-07 12:17:57 +03:00
|
|
|
rest_args_deoptimiazation,
|
|
|
|
r#"function x (...rest) {
|
2018-11-28 06:24:08 +03:00
|
|
|
arguments;
|
|
|
|
}"#
|
|
|
|
);
|
|
|
|
|
|
|
|
test!(
|
2020-05-07 12:17:57 +03:00
|
|
|
// Stage 0
|
|
|
|
ignore,
|
|
|
|
syntax(),
|
2021-12-02 04:04:01 +03:00
|
|
|
|_| tr(Default::default()),
|
2020-05-07 12:17:57 +03:00
|
|
|
rest_arrow_fn,
|
|
|
|
r#"var concat = (...arrs) => {
|
2018-11-28 06:24:08 +03:00
|
|
|
var x = arrs[0];
|
|
|
|
var y = arrs[1];
|
|
|
|
};
|
|
|
|
|
|
|
|
var somefun = function () {
|
2021-09-01 16:11:55 +03:00
|
|
|
let get2ndArg = (a, b, ...args) => {
|
|
|
|
var _b = args[0];
|
2018-11-28 06:24:08 +03:00
|
|
|
let somef = (x, y, z, ...args2) => {
|
|
|
|
var _a = args2[0];
|
|
|
|
};
|
|
|
|
let somefg = (c, d, e, f, ...args3) => {
|
|
|
|
var _a = args3[0];
|
|
|
|
};
|
2021-09-01 16:11:55 +03:00
|
|
|
var _d = args[1];
|
2018-11-28 06:24:08 +03:00
|
|
|
};
|
|
|
|
let get3rdArg = (...args) => args[2];
|
|
|
|
}
|
|
|
|
|
|
|
|
function demo1(...args) {
|
|
|
|
return (i) => {
|
|
|
|
return args[i+0];
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
var x = (...rest) => {
|
|
|
|
if (noNeedToWork) return 0;
|
|
|
|
return rest;
|
|
|
|
};
|
|
|
|
|
|
|
|
var innerclassproperties = (...args) => (
|
|
|
|
class {
|
|
|
|
static args = args;
|
|
|
|
args = args;
|
|
|
|
}
|
2023-10-30 04:38:59 +03:00
|
|
|
);"#
|
2018-11-28 06:24:08 +03:00
|
|
|
);
|
|
|
|
|
|
|
|
test!(
|
2020-05-07 12:17:57 +03:00
|
|
|
ignore,
|
|
|
|
syntax(),
|
2021-12-02 04:04:01 +03:00
|
|
|
|_| tr(Default::default()),
|
2020-05-07 12:17:57 +03:00
|
|
|
rest_async_arrow_fn,
|
|
|
|
r#"var concat = async (...arrs) => {
|
2018-11-28 06:24:08 +03:00
|
|
|
var x = arrs[0];
|
|
|
|
var y = arrs[1];
|
|
|
|
};
|
|
|
|
|
|
|
|
var x = async (...rest) => {
|
|
|
|
if (noNeedToWork) return 0;
|
|
|
|
return rest;
|
2023-10-30 04:38:59 +03:00
|
|
|
};"#
|
2018-11-28 06:24:08 +03:00
|
|
|
);
|
|
|
|
|
|
|
|
test!(
|
2020-05-07 12:17:57 +03:00
|
|
|
syntax(),
|
2022-07-13 13:29:03 +03:00
|
|
|
|_| {
|
|
|
|
let unresolved_mark = Mark::new();
|
|
|
|
let top_level_mark = Mark::new();
|
|
|
|
|
|
|
|
chain!(
|
|
|
|
arrow(unresolved_mark),
|
|
|
|
resolver(unresolved_mark, top_level_mark, false),
|
|
|
|
parameters(Default::default(), unresolved_mark),
|
|
|
|
destructuring(destructuring::Config { loose: false }),
|
|
|
|
block_scoping(unresolved_mark),
|
|
|
|
)
|
|
|
|
},
|
2020-05-07 12:17:57 +03:00
|
|
|
rest_binding_deoptimisation,
|
|
|
|
r#"const deepAssign = (...args) => args = [];
|
2023-10-30 04:38:59 +03:00
|
|
|
"#
|
2018-11-28 06:24:08 +03:00
|
|
|
);
|
|
|
|
|
|
|
|
test!(
|
2022-04-11 21:45:58 +03:00
|
|
|
// optimization is not implemented
|
2020-05-07 12:17:57 +03:00
|
|
|
ignore,
|
|
|
|
syntax(),
|
2021-12-02 04:04:01 +03:00
|
|
|
|_| tr(Default::default()),
|
2020-05-07 12:17:57 +03:00
|
|
|
rest_deepest_common_ancestor_earliest_child,
|
|
|
|
r#"// single reference
|
2018-11-28 06:24:08 +03:00
|
|
|
function r(...rest){
|
|
|
|
if (noNeedToWork) return 0;
|
|
|
|
return rest;
|
|
|
|
}
|
|
|
|
|
|
|
|
// multiple references
|
|
|
|
function r(...rest){
|
|
|
|
if (noNeedToWork) return 0;
|
|
|
|
|
|
|
|
rest;
|
|
|
|
rest;
|
|
|
|
}
|
|
|
|
|
|
|
|
// multiple nested references
|
|
|
|
function r(...rest){
|
|
|
|
if (noNeedToWork) return 0;
|
|
|
|
|
|
|
|
if (true) {
|
|
|
|
return rest;
|
|
|
|
} else {
|
|
|
|
return rest;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// deeply nested
|
|
|
|
function r(...rest){
|
|
|
|
if (true) {
|
|
|
|
if (true) {
|
|
|
|
return rest;
|
|
|
|
} else {
|
|
|
|
return rest;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// nested reference with root reference
|
|
|
|
function r(...rest){
|
|
|
|
if (noNeedToWork) return 0;
|
|
|
|
|
|
|
|
if (lol) rest;
|
|
|
|
rest;
|
|
|
|
}
|
|
|
|
|
|
|
|
// nested functions
|
|
|
|
function a(...args) {
|
|
|
|
return function() {
|
|
|
|
function b() {}
|
|
|
|
|
2023-10-30 04:38:59 +03:00
|
|
|
console.log("Shouldn't args be from a's scope?" args);
|
2018-11-28 06:24:08 +03:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
// loop
|
|
|
|
function runQueue(queue, ...args) {
|
|
|
|
for (let i = 0; i < queue.length; i++) {
|
|
|
|
queue[i](...args)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// nested loop
|
|
|
|
function runQueue(queue, ...args) {
|
|
|
|
if (foo) {
|
|
|
|
for (let i = 0; i < queue.length; i++) {
|
|
|
|
queue[i](...args)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function r(...rest){
|
|
|
|
if (noNeedToWork) return 0;
|
|
|
|
[rest[0]] = x;
|
|
|
|
return rest;
|
|
|
|
}"#
|
|
|
|
);
|
|
|
|
|
2019-10-19 06:21:56 +03:00
|
|
|
test!(
|
2020-05-07 12:17:57 +03:00
|
|
|
syntax(),
|
2021-12-02 04:04:01 +03:00
|
|
|
|_| tr(Default::default()),
|
2020-05-07 12:17:57 +03:00
|
|
|
rest_length,
|
|
|
|
r#"var t = function (f, ...items) {
|
2018-11-28 06:24:08 +03:00
|
|
|
items[0];
|
|
|
|
items[items.length - 1];
|
|
|
|
};
|
|
|
|
|
|
|
|
function t(f, ...items) {
|
|
|
|
items;
|
|
|
|
items[0];
|
|
|
|
items[items.length - 1];
|
|
|
|
}"#
|
|
|
|
);
|
|
|
|
|
|
|
|
test_exec!(
|
2020-05-07 12:17:57 +03:00
|
|
|
syntax(),
|
2021-12-02 04:04:01 +03:00
|
|
|
|_| tr(Default::default()),
|
2020-05-07 12:17:57 +03:00
|
|
|
rest_length_exec,
|
|
|
|
r#"var length = function (a, b, ...items) {
|
2018-11-28 06:24:08 +03:00
|
|
|
return items.length;
|
|
|
|
};
|
|
|
|
|
|
|
|
expect(length()).toBe(0);
|
|
|
|
expect(length(1)).toBe(0);
|
|
|
|
expect(length(1, 2)).toBe(0);
|
|
|
|
expect(length(1, 2, 3)).toBe(1);"#
|
|
|
|
);
|
|
|
|
|
|
|
|
test!(
|
2020-05-07 12:17:57 +03:00
|
|
|
// optimisation is not implemented
|
|
|
|
ignore,
|
|
|
|
syntax(),
|
2021-12-02 04:04:01 +03:00
|
|
|
|_| tr(Default::default()),
|
2020-05-07 12:17:57 +03:00
|
|
|
rest_member_expression_deoptimisation,
|
|
|
|
r#"var t = function (...items) {
|
2018-11-28 06:24:08 +03:00
|
|
|
var x = items[0];
|
|
|
|
var y = items[1];
|
|
|
|
}
|
|
|
|
|
|
|
|
function t(...items) {
|
|
|
|
var x = items[0];
|
|
|
|
var y = items[1];
|
|
|
|
}
|
|
|
|
|
|
|
|
function t(...items) {
|
|
|
|
var a = [];
|
|
|
|
for (var i = 0; i < items.length; i++) {
|
|
|
|
a.push(i);
|
|
|
|
}
|
|
|
|
return a;
|
|
|
|
}
|
|
|
|
|
|
|
|
// https://github.com/babel/babel/pull/2833#issuecomment-166039291
|
|
|
|
function t(...items) {
|
|
|
|
for (let i = 0; i < items.length; i++) {
|
|
|
|
return items[i];
|
|
|
|
}
|
|
|
|
}"#
|
|
|
|
);
|
|
|
|
|
|
|
|
test!(
|
2020-05-07 12:17:57 +03:00
|
|
|
// optimisation is not implemented
|
|
|
|
ignore,
|
|
|
|
syntax(),
|
2021-12-02 04:04:01 +03:00
|
|
|
|_| tr(Default::default()),
|
2020-05-07 12:17:57 +03:00
|
|
|
rest_member_expression_optimisation,
|
|
|
|
r#"var t = function (...items) {
|
2018-11-28 06:24:08 +03:00
|
|
|
var x = items[0];
|
|
|
|
var y = items[1];
|
|
|
|
}
|
|
|
|
|
|
|
|
function t(...items) {
|
|
|
|
var x = items[0];
|
|
|
|
var y = items[1];
|
|
|
|
}
|
|
|
|
|
|
|
|
function t(...items) {
|
|
|
|
var a = [];
|
|
|
|
for (var i = 0; i < items.length; i++) {
|
|
|
|
a.push(i);
|
|
|
|
}
|
|
|
|
return a;
|
|
|
|
}
|
|
|
|
|
|
|
|
// https://github.com/babel/babel/pull/2833#issuecomment-166039291
|
|
|
|
function t(...items) {
|
|
|
|
for (let i = 0; i < items.length; i++) {
|
|
|
|
return items[i];
|
|
|
|
}
|
|
|
|
}"#
|
|
|
|
);
|
|
|
|
|
2019-10-19 06:21:56 +03:00
|
|
|
test!(
|
2020-05-07 12:17:57 +03:00
|
|
|
syntax(),
|
2021-12-02 04:04:01 +03:00
|
|
|
|_| tr(Default::default()),
|
2020-05-07 12:17:57 +03:00
|
|
|
rest_multiple,
|
|
|
|
r#"var t = function (f, ...items) {
|
2018-11-28 06:24:08 +03:00
|
|
|
var x = f;
|
|
|
|
x = items[0];
|
|
|
|
x = items[1];
|
|
|
|
};
|
|
|
|
|
|
|
|
function t(f, ...items) {
|
|
|
|
var x = f;
|
|
|
|
x = items[0];
|
|
|
|
x = items[1];
|
|
|
|
}
|
|
|
|
|
|
|
|
function u(f, g, ...items) {
|
|
|
|
var x = f;
|
|
|
|
var y = g;
|
|
|
|
x[12] = items[0];
|
|
|
|
y.prop = items[1];
|
|
|
|
var z = items[2] | 0 || 12;
|
|
|
|
}"#
|
|
|
|
);
|
|
|
|
|
|
|
|
test!(
|
2020-05-07 12:17:57 +03:00
|
|
|
// optimisation is not implemented
|
|
|
|
ignore,
|
|
|
|
syntax(),
|
2021-12-02 04:04:01 +03:00
|
|
|
|_| tr(Default::default()),
|
2020-05-07 12:17:57 +03:00
|
|
|
rest_nested_5656,
|
|
|
|
r#"function a(...args) {
|
2018-11-28 06:24:08 +03:00
|
|
|
const foo = (...list) => bar(...list);
|
|
|
|
foo(...args);
|
|
|
|
}
|
|
|
|
|
|
|
|
function b(...args) {
|
|
|
|
const foo = (...args) => bar(...args);
|
|
|
|
foo(...args);
|
|
|
|
}
|
|
|
|
|
|
|
|
function c(...args) {
|
|
|
|
const foo = (...args) => bar(...args);
|
|
|
|
foo([]);
|
|
|
|
}
|
|
|
|
|
|
|
|
function d(thing, ...args) {
|
|
|
|
const foo = (...args) => bar(...args);
|
|
|
|
{
|
|
|
|
let args = thing;
|
|
|
|
foo(thing);
|
|
|
|
}
|
|
|
|
}"#
|
|
|
|
);
|
|
|
|
|
2019-02-23 15:56:12 +03:00
|
|
|
test!(
|
2020-05-07 12:17:57 +03:00
|
|
|
syntax(),
|
2021-05-08 09:47:20 +03:00
|
|
|
|t| chain!(
|
2021-12-02 04:04:01 +03:00
|
|
|
tr(Default::default()),
|
2022-02-15 07:02:08 +03:00
|
|
|
classes(Some(t.comments.clone()), Default::default()),
|
2021-05-08 09:47:20 +03:00
|
|
|
spread(Default::default())
|
|
|
|
),
|
2020-05-07 12:17:57 +03:00
|
|
|
rest_nested_iife,
|
|
|
|
r#"function broken(x, ...foo) {
|
2018-11-28 06:24:08 +03:00
|
|
|
if (true) {
|
|
|
|
class Foo extends Bar { }
|
|
|
|
return hello(...foo)
|
|
|
|
}
|
|
|
|
}"#
|
|
|
|
);
|
|
|
|
|
|
|
|
test!(
|
2020-05-07 12:17:57 +03:00
|
|
|
syntax(),
|
2021-12-02 04:04:01 +03:00
|
|
|
|_| tr(Default::default()),
|
2020-05-07 12:17:57 +03:00
|
|
|
rest_patterns,
|
2023-10-30 04:38:59 +03:00
|
|
|
r#"function foo(...[a]) {}"#
|
2018-11-28 06:24:08 +03:00
|
|
|
);
|
|
|
|
|
|
|
|
test_exec!(
|
2020-05-07 12:17:57 +03:00
|
|
|
syntax(),
|
2021-12-02 04:04:01 +03:00
|
|
|
|_| tr(Default::default()),
|
2020-05-07 12:17:57 +03:00
|
|
|
rest_patterns_exec,
|
|
|
|
r#"
|
2018-11-28 06:24:08 +03:00
|
|
|
function foo(...{ length }) {
|
|
|
|
return length;
|
|
|
|
}
|
|
|
|
|
|
|
|
expect(foo(1, 2, 3)).toEqual(3);"#
|
|
|
|
);
|
|
|
|
|
|
|
|
test!(
|
2020-05-07 12:17:57 +03:00
|
|
|
// optimisation is not implemented
|
|
|
|
ignore,
|
|
|
|
syntax(),
|
2021-12-02 04:04:01 +03:00
|
|
|
|_| tr(Default::default()),
|
2020-05-07 12:17:57 +03:00
|
|
|
rest_spread_optimisation,
|
|
|
|
r#"// optimisation
|
2018-11-28 06:24:08 +03:00
|
|
|
|
|
|
|
function foo(...bar) {
|
|
|
|
foo(...bar);
|
|
|
|
}
|
|
|
|
|
|
|
|
// deoptimisation
|
|
|
|
|
|
|
|
function foo(a, ...b) {
|
|
|
|
foo(...b);
|
|
|
|
}
|
|
|
|
|
|
|
|
function foo(...b) {
|
|
|
|
foo(1, ...b);
|
|
|
|
}
|
|
|
|
|
|
|
|
function foo(...args){
|
|
|
|
args.pop()
|
|
|
|
foo(...args);
|
|
|
|
}"#
|
|
|
|
);
|
2019-12-09 15:02:51 +03:00
|
|
|
|
|
|
|
//// regression_6057_expanded
|
|
|
|
//test!(
|
|
|
|
// syntax(),
|
|
|
|
// |_| tr(r#"{
|
|
|
|
// "presets": ["env"],
|
|
|
|
// "plugins": ["proposal-class-properties"]
|
|
|
|
//}
|
|
|
|
//"#),
|
|
|
|
// regression_6057_expanded,
|
|
|
|
// r#"
|
|
|
|
//import args from 'utils/url/args';
|
|
|
|
//
|
|
|
|
//export default class App extends Component {
|
|
|
|
// exportType = ''
|
|
|
|
//
|
|
|
|
// componentDidMount() {
|
|
|
|
// this.exportType = args.get('type', window.location.href);
|
|
|
|
// }
|
|
|
|
//}
|
|
|
|
//
|
2023-10-30 04:38:59 +03:00
|
|
|
//"#
|
2019-12-09 15:02:51 +03:00
|
|
|
// r#"
|
|
|
|
//"use strict";
|
|
|
|
//
|
2023-10-30 04:38:59 +03:00
|
|
|
//Object.defineProperty(exports, "__esModule" {
|
2019-12-09 15:02:51 +03:00
|
|
|
// value: true
|
|
|
|
//});
|
|
|
|
//exports["default"] = void 0;
|
|
|
|
//
|
2023-03-31 09:15:21 +03:00
|
|
|
//var _args = _interop_require_default(require("utils/url/args"));
|
2019-12-09 15:02:51 +03:00
|
|
|
//
|
2023-03-31 09:15:21 +03:00
|
|
|
//function _interop_require_default(obj) { return obj && obj.__esModule ? obj :
|
|
|
|
// { "default": obj }; }
|
2019-12-09 15:02:51 +03:00
|
|
|
//
|
|
|
|
//function _typeof(obj) { if (typeof Symbol === "function" && typeof
|
|
|
|
// Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return
|
|
|
|
// typeof obj; }; } else { _typeof = function _typeof(obj) { return obj &&
|
|
|
|
// typeof Symbol === "function" && obj.constructor === Symbol && obj !==
|
|
|
|
// Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
|
|
//
|
2023-03-31 09:15:21 +03:00
|
|
|
//function _class_call_check(instance, Constructor) { if (!(instance instanceof
|
2019-12-09 15:02:51 +03:00
|
|
|
// Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
|
|
//
|
|
|
|
//function _defineProperties(target, props) { for (var i = 0; i < props.length;
|
|
|
|
// i++) { var descriptor = props[i]; descriptor.enumerable =
|
|
|
|
// descriptor.enumerable || false; descriptor.configurable = true; if ("value"
|
|
|
|
// in descriptor) descriptor.writable = true; Object.defineProperty(target,
|
|
|
|
// descriptor.key, descriptor); } }
|
|
|
|
//
|
2023-03-31 09:15:21 +03:00
|
|
|
//function _create_class(Constructor, protoProps, staticProps) { if
|
|
|
|
// (protoProps) _defineProperties(Constructor.prototype, protoProps); if
|
|
|
|
// (staticProps) _defineProperties(Constructor, staticProps); return
|
|
|
|
// Constructor; }
|
2019-12-09 15:02:51 +03:00
|
|
|
//
|
2023-03-31 09:15:21 +03:00
|
|
|
//function _possible_constructor_return(self, call) { if (call &&
|
|
|
|
// (_typeof(call) === "object" || typeof call === "function")) { return call; }
|
|
|
|
// return _assert_this_initialized(self); }
|
2019-12-09 15:02:51 +03:00
|
|
|
//
|
2023-03-31 09:15:21 +03:00
|
|
|
//function _get_prototype_of(o) { _get_prototype_of = Object.setPrototypeOf ?
|
|
|
|
// Object.getPrototypeOf : function _get_prototype_of(o) { return o.__proto__ ||
|
|
|
|
// Object.getPrototypeOf(o); }; return _get_prototype_of(o); }
|
2019-12-09 15:02:51 +03:00
|
|
|
//
|
2023-03-31 09:15:21 +03:00
|
|
|
//function _assert_this_initialized(self) { if (self === void 0) { throw new
|
2019-12-09 15:02:51 +03:00
|
|
|
// ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
|
|
// } return self; }
|
|
|
|
//
|
|
|
|
//function _inherits(subClass, superClass) { if (typeof superClass !==
|
|
|
|
// "function" && superClass !== null) { throw new TypeError("Super expression
|
|
|
|
// must either be null or a function"); } subClass.prototype =
|
|
|
|
// Object.create(superClass && superClass.prototype, { constructor: { value:
|
|
|
|
// subClass, writable: true, configurable: true } }); if (superClass)
|
2023-03-31 09:15:21 +03:00
|
|
|
// _set_prototype_of(subClass, superClass); }
|
2019-12-09 15:02:51 +03:00
|
|
|
//
|
2023-03-31 09:15:21 +03:00
|
|
|
//function _set_prototype_of(o, p) { _set_prototype_of = Object.setPrototypeOf
|
|
|
|
// || function _set_prototype_of(o, p) { o.__proto__ = p; return o; }; return
|
|
|
|
// _set_prototype_of(o, p); }
|
2019-12-09 15:02:51 +03:00
|
|
|
//
|
2023-03-31 09:15:21 +03:00
|
|
|
//function _define_property(obj, key, value) { if (key in obj) {
|
2019-12-09 15:02:51 +03:00
|
|
|
// Object.defineProperty(obj, key, { value: value, enumerable: true,
|
|
|
|
// configurable: true, writable: true }); } else { obj[key] = value; } return
|
|
|
|
// obj; }
|
|
|
|
//
|
|
|
|
//var App =
|
|
|
|
// /*#__PURE__*/
|
|
|
|
//function (_Component) {
|
|
|
|
// _inherits(App, _Component);
|
|
|
|
//
|
|
|
|
// function App() {
|
2023-03-31 09:15:21 +03:00
|
|
|
// var _get_prototype_of2;
|
2019-12-09 15:02:51 +03:00
|
|
|
//
|
|
|
|
// var _this;
|
|
|
|
//
|
2023-03-31 09:15:21 +03:00
|
|
|
// _class_call_check(this, App);
|
2019-12-09 15:02:51 +03:00
|
|
|
//
|
|
|
|
// for (var _len = arguments.length, args = new Array(_len), _key = 0; _key <
|
|
|
|
// _len; _key++) { args[_key] = arguments[_key];
|
|
|
|
// }
|
|
|
|
//
|
2023-03-31 09:15:21 +03:00
|
|
|
// _this = _possible_constructor_return(this, (_get_prototype_of2 =
|
|
|
|
// _get_prototype_of(App)).call.apply(_get_prototype_of2, [this].concat(args)));
|
2019-12-09 15:02:51 +03:00
|
|
|
//
|
2023-10-30 04:38:59 +03:00
|
|
|
// _define_property(_assert_this_initialized(_this), "exportType" '');
|
2019-12-09 15:02:51 +03:00
|
|
|
//
|
|
|
|
// return _this;
|
|
|
|
// }
|
|
|
|
//
|
2023-03-31 09:15:21 +03:00
|
|
|
// _create_class(App, [{
|
2023-10-30 04:38:59 +03:00
|
|
|
// key: "componentDidMount"
|
2019-12-09 15:02:51 +03:00
|
|
|
// value: function componentDidMount() {
|
|
|
|
// this.exportType = _args["default"].get('type', window.location.href);
|
|
|
|
// }
|
|
|
|
// }]);
|
|
|
|
//
|
|
|
|
// return App;
|
|
|
|
//}(Component);
|
|
|
|
//
|
|
|
|
//exports["default"] = App;
|
|
|
|
//
|
|
|
|
//"#
|
|
|
|
//);
|
|
|
|
|
|
|
|
//// parameters_iife_this_9385
|
|
|
|
//test!(
|
|
|
|
// syntax(),
|
|
|
|
// |_| tr(r#"{
|
|
|
|
// "plugins": ["transform-typescript"],
|
|
|
|
// "presets": ["env"]
|
|
|
|
//}
|
|
|
|
//"#),
|
|
|
|
// parameters_iife_this_9385,
|
|
|
|
// r#"
|
|
|
|
//export class Test {
|
|
|
|
// invite(options: { privacy: string } = {}) {
|
|
|
|
// const privacy = options.privacy || "Private"
|
|
|
|
// console.log(this)
|
|
|
|
// }
|
|
|
|
//}
|
2023-10-30 04:38:59 +03:00
|
|
|
//"#
|
2019-12-09 15:02:51 +03:00
|
|
|
// r#"
|
|
|
|
//"use strict";
|
|
|
|
//
|
2023-10-30 04:38:59 +03:00
|
|
|
//Object.defineProperty(exports, "__esModule" {
|
2019-12-09 15:02:51 +03:00
|
|
|
// value: true
|
|
|
|
//});
|
|
|
|
//exports.Test = void 0;
|
|
|
|
//
|
2023-03-31 09:15:21 +03:00
|
|
|
//function _class_call_check(instance, Constructor) { if (!(instance instanceof
|
2019-12-09 15:02:51 +03:00
|
|
|
// Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
|
|
//
|
|
|
|
//function _defineProperties(target, props) { for (var i = 0; i < props.length;
|
|
|
|
// i++) { var descriptor = props[i]; descriptor.enumerable =
|
|
|
|
// descriptor.enumerable || false; descriptor.configurable = true; if ("value"
|
|
|
|
// in descriptor) descriptor.writable = true; Object.defineProperty(target,
|
|
|
|
// descriptor.key, descriptor); } }
|
|
|
|
//
|
2023-03-31 09:15:21 +03:00
|
|
|
//function _create_class(Constructor, protoProps, staticProps) { if
|
|
|
|
// (protoProps) _defineProperties(Constructor.prototype, protoProps); if
|
|
|
|
// (staticProps) _defineProperties(Constructor, staticProps); return
|
|
|
|
// Constructor; }
|
2019-12-09 15:02:51 +03:00
|
|
|
//
|
|
|
|
//var Test =
|
|
|
|
// /*#__PURE__*/
|
|
|
|
//function () {
|
|
|
|
// function Test() {
|
2023-03-31 09:15:21 +03:00
|
|
|
// _class_call_check(this, Test);
|
2019-12-09 15:02:51 +03:00
|
|
|
// }
|
|
|
|
//
|
2023-03-31 09:15:21 +03:00
|
|
|
// _create_class(Test, [{
|
2023-10-30 04:38:59 +03:00
|
|
|
// key: "invite"
|
2019-12-09 15:02:51 +03:00
|
|
|
// value: function invite() {
|
|
|
|
// var options = arguments.length > 0 && arguments[0] !== undefined ?
|
|
|
|
// arguments[0] : {}; var privacy = options.privacy || "Private";
|
|
|
|
// console.log(this);
|
|
|
|
// }
|
|
|
|
// }]);
|
|
|
|
//
|
|
|
|
// return Test;
|
|
|
|
//}();
|
|
|
|
//
|
|
|
|
//exports.Test = Test;
|
|
|
|
//
|
|
|
|
//"#
|
|
|
|
//);
|
|
|
|
|
|
|
|
// parameters_rest_async_arrow_functions
|
|
|
|
test!(
|
2020-05-07 12:17:57 +03:00
|
|
|
// See https://github.com/swc-project/swc/issues/490
|
|
|
|
ignore,
|
|
|
|
syntax(),
|
2022-06-25 07:55:59 +03:00
|
|
|
|_| {
|
|
|
|
let unresolved_mark = Mark::new();
|
|
|
|
let top_level_mark = Mark::new();
|
|
|
|
chain!(
|
|
|
|
resolver(unresolved_mark, top_level_mark, false),
|
2022-08-12 16:39:26 +03:00
|
|
|
async_to_generator::<SingleThreadedComments>(Default::default(), None, unresolved_mark),
|
2022-07-13 13:29:03 +03:00
|
|
|
arrow(unresolved_mark),
|
2022-06-25 07:55:59 +03:00
|
|
|
parameters(Default::default(), unresolved_mark),
|
|
|
|
)
|
|
|
|
},
|
2020-05-07 12:17:57 +03:00
|
|
|
parameters_rest_async_arrow_functions_1,
|
|
|
|
r#"
|
2019-12-09 15:02:51 +03:00
|
|
|
var concat = async (...arrs) => {
|
|
|
|
var x = arrs[0];
|
|
|
|
var y = arrs[1];
|
|
|
|
};
|
|
|
|
"#
|
|
|
|
);
|
|
|
|
|
|
|
|
// parameters_rest_async_arrow_functions
|
|
|
|
test!(
|
2020-05-07 12:17:57 +03:00
|
|
|
// See https://github.com/swc-project/swc/issues/490
|
|
|
|
ignore,
|
|
|
|
syntax(),
|
2022-06-25 07:55:59 +03:00
|
|
|
|_| {
|
|
|
|
let unresolved_mark = Mark::new();
|
|
|
|
let top_level_mark = Mark::new();
|
|
|
|
chain!(
|
|
|
|
resolver(unresolved_mark, top_level_mark, false),
|
2022-08-12 16:39:26 +03:00
|
|
|
async_to_generator::<SingleThreadedComments>(Default::default(), None, unresolved_mark),
|
2022-07-13 13:29:03 +03:00
|
|
|
arrow(unresolved_mark),
|
2022-06-25 07:55:59 +03:00
|
|
|
parameters(Default::default(), unresolved_mark),
|
|
|
|
)
|
|
|
|
},
|
2020-05-07 12:17:57 +03:00
|
|
|
parameters_rest_async_arrow_functions_2,
|
|
|
|
r#"
|
2019-12-09 15:02:51 +03:00
|
|
|
var x = async (...rest) => {
|
|
|
|
if (noNeedToWork) return 0;
|
|
|
|
return rest;
|
|
|
|
};
|
|
|
|
|
|
|
|
"#
|
|
|
|
);
|
|
|
|
|
|
|
|
// regression_6057_simple
|
|
|
|
test!(
|
2020-05-07 12:17:57 +03:00
|
|
|
syntax(),
|
2022-06-25 07:55:59 +03:00
|
|
|
|_| {
|
|
|
|
let unresolved_mark = Mark::new();
|
|
|
|
let top_level_mark = Mark::new();
|
|
|
|
chain!(
|
|
|
|
resolver(unresolved_mark, top_level_mark, false),
|
|
|
|
parameters(Default::default(), unresolved_mark),
|
|
|
|
)
|
|
|
|
},
|
2020-05-07 12:17:57 +03:00
|
|
|
regression_6057_simple,
|
|
|
|
r#"
|
2019-12-09 15:02:51 +03:00
|
|
|
const a = 'bar';
|
|
|
|
function foo(...a) {
|
|
|
|
return a;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
"#
|
|
|
|
);
|
|
|
|
|
|
|
|
// parameters_regression_4333
|
|
|
|
test!(
|
2020-05-07 12:17:57 +03:00
|
|
|
syntax(),
|
2022-06-25 07:55:59 +03:00
|
|
|
|_| {
|
|
|
|
let unresolved_mark = Mark::new();
|
|
|
|
let top_level_mark = Mark::new();
|
|
|
|
chain!(
|
|
|
|
resolver(unresolved_mark, top_level_mark, false),
|
|
|
|
parameters(Default::default(), unresolved_mark),
|
2022-07-13 13:29:03 +03:00
|
|
|
block_scoping(unresolved_mark)
|
2022-06-25 07:55:59 +03:00
|
|
|
)
|
|
|
|
},
|
2020-05-07 12:17:57 +03:00
|
|
|
parameters_regression_4333,
|
|
|
|
r#"
|
2019-12-09 15:02:51 +03:00
|
|
|
const args = 'bar';
|
|
|
|
function foo(...args) {
|
|
|
|
return args;
|
|
|
|
}
|
|
|
|
|
|
|
|
"#
|
|
|
|
);
|
2020-05-05 14:10:30 +03:00
|
|
|
|
|
|
|
test!(
|
2020-05-07 12:17:57 +03:00
|
|
|
syntax(),
|
2022-06-25 07:55:59 +03:00
|
|
|
|_| {
|
|
|
|
let unresolved_mark = Mark::new();
|
|
|
|
let top_level_mark = Mark::new();
|
|
|
|
chain!(
|
|
|
|
resolver(unresolved_mark, top_level_mark, false),
|
|
|
|
parameters(Default::default(), unresolved_mark),
|
|
|
|
destructuring(Default::default())
|
|
|
|
)
|
|
|
|
},
|
2020-05-07 12:17:57 +03:00
|
|
|
issue_760,
|
|
|
|
"const initialState = 'foo'
|
2020-05-05 14:10:30 +03:00
|
|
|
export default function reducer(state = initialState, action = {}) {
|
2023-10-30 04:38:59 +03:00
|
|
|
}"
|
2020-05-05 14:10:30 +03:00
|
|
|
);
|
2021-07-16 10:05:00 +03:00
|
|
|
|
|
|
|
test!(
|
|
|
|
syntax(),
|
2022-06-25 07:55:59 +03:00
|
|
|
|_| {
|
|
|
|
let unresolved_mark = Mark::new();
|
|
|
|
let top_level_mark = Mark::new();
|
|
|
|
chain!(
|
|
|
|
resolver(unresolved_mark, top_level_mark, false),
|
|
|
|
parameters(Default::default(), unresolved_mark),
|
|
|
|
)
|
|
|
|
},
|
2021-07-16 10:05:00 +03:00
|
|
|
rest_in_top_level_arrow_1,
|
|
|
|
"
|
|
|
|
const arrow = (...args) => {
|
|
|
|
console.log(args);
|
|
|
|
}
|
|
|
|
"
|
|
|
|
);
|
|
|
|
|
|
|
|
test!(
|
|
|
|
syntax(),
|
2022-06-25 07:55:59 +03:00
|
|
|
|_| {
|
|
|
|
let unresolved_mark = Mark::new();
|
|
|
|
let top_level_mark = Mark::new();
|
|
|
|
chain!(
|
|
|
|
resolver(unresolved_mark, top_level_mark, false),
|
|
|
|
parameters(Default::default(), unresolved_mark),
|
|
|
|
)
|
|
|
|
},
|
2021-07-16 10:05:00 +03:00
|
|
|
rest_in_top_level_arrow_2,
|
|
|
|
"
|
|
|
|
const arrow = () => (...args) => {
|
|
|
|
console.log(args);
|
|
|
|
}
|
|
|
|
"
|
|
|
|
);
|
|
|
|
|
|
|
|
test!(
|
|
|
|
syntax(),
|
2022-06-25 07:55:59 +03:00
|
|
|
|_| {
|
|
|
|
let unresolved_mark = Mark::new();
|
|
|
|
let top_level_mark = Mark::new();
|
|
|
|
chain!(
|
|
|
|
resolver(unresolved_mark, top_level_mark, false),
|
|
|
|
parameters(Default::default(), unresolved_mark),
|
|
|
|
)
|
|
|
|
},
|
2021-07-16 10:05:00 +03:00
|
|
|
rest_in_top_level_arrow_3,
|
|
|
|
"
|
|
|
|
const arrow = () => (...args) => {
|
|
|
|
console.log(this, args);
|
|
|
|
}
|
|
|
|
"
|
|
|
|
);
|
|
|
|
|
|
|
|
test!(
|
|
|
|
syntax(),
|
2022-06-25 07:55:59 +03:00
|
|
|
|_| {
|
|
|
|
let unresolved_mark = Mark::new();
|
|
|
|
let top_level_mark = Mark::new();
|
|
|
|
chain!(
|
|
|
|
resolver(unresolved_mark, top_level_mark, false),
|
|
|
|
parameters(Default::default(), unresolved_mark),
|
|
|
|
)
|
|
|
|
},
|
2021-07-16 10:05:00 +03:00
|
|
|
rest_in_top_level_arrow_4,
|
|
|
|
"
|
|
|
|
const arrow = () => (this, (...args) => {
|
|
|
|
console.log(this, args);
|
|
|
|
})
|
|
|
|
"
|
|
|
|
);
|
|
|
|
|
|
|
|
test!(
|
|
|
|
syntax(),
|
2022-06-25 07:55:59 +03:00
|
|
|
|_| {
|
|
|
|
let unresolved_mark = Mark::new();
|
|
|
|
let top_level_mark = Mark::new();
|
|
|
|
chain!(
|
|
|
|
resolver(unresolved_mark, top_level_mark, false),
|
|
|
|
parameters(Default::default(), unresolved_mark),
|
|
|
|
)
|
|
|
|
},
|
2021-07-16 10:05:00 +03:00
|
|
|
rest_in_top_level_arrow_nested_1,
|
|
|
|
"
|
|
|
|
const arrow = (...args) => (this, () => (...args) => {
|
|
|
|
console.log(this, args);
|
|
|
|
})
|
|
|
|
"
|
|
|
|
);
|
2021-12-02 04:04:01 +03:00
|
|
|
|
|
|
|
test!(
|
|
|
|
syntax(),
|
|
|
|
|_| tr(Default::default()),
|
|
|
|
issue_2825,
|
|
|
|
"
|
|
|
|
const foo = (...rest) => console.log(this, rest)
|
|
|
|
const bar = () => this
|
|
|
|
"
|
|
|
|
);
|
|
|
|
|
|
|
|
test!(
|
|
|
|
syntax(),
|
|
|
|
|_| tr(Default::default()),
|
|
|
|
issue_2811,
|
|
|
|
"
|
|
|
|
class Foo extends (function(){}) {
|
|
|
|
constructor(){
|
|
|
|
var foo = (...rest) => [rest, this];
|
|
|
|
|
|
|
|
if (true){
|
|
|
|
console.log(super(), foo());
|
|
|
|
} else {
|
|
|
|
super();
|
|
|
|
console.log(foo());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
"
|
|
|
|
);
|
|
|
|
|
2022-02-14 09:44:33 +03:00
|
|
|
test!(
|
|
|
|
syntax(),
|
2022-06-25 07:55:59 +03:00
|
|
|
|_| {
|
|
|
|
let unresolved_mark = Mark::new();
|
|
|
|
let top_level_mark = Mark::new();
|
|
|
|
chain!(
|
|
|
|
resolver(unresolved_mark, top_level_mark, false),
|
|
|
|
parameters(Default::default(), unresolved_mark),
|
|
|
|
)
|
|
|
|
},
|
2022-02-14 09:44:33 +03:00
|
|
|
issue_3471,
|
|
|
|
"
|
|
|
|
class A {
|
|
|
|
a = 1 + ((...a) => a)
|
2022-04-11 21:45:58 +03:00
|
|
|
b = (...b) => b + this
|
|
|
|
static c = (c = 123) => c + this
|
2022-02-14 09:44:33 +03:00
|
|
|
}
|
|
|
|
"
|
|
|
|
);
|
|
|
|
|
2022-02-15 09:42:40 +03:00
|
|
|
test!(
|
|
|
|
syntax(),
|
2022-06-25 07:55:59 +03:00
|
|
|
|_| {
|
|
|
|
let unresolved_mark = Mark::new();
|
|
|
|
let top_level_mark = Mark::new();
|
|
|
|
chain!(
|
|
|
|
resolver(unresolved_mark, top_level_mark, false),
|
|
|
|
parameters(Default::default(), unresolved_mark),
|
|
|
|
)
|
|
|
|
},
|
2022-02-15 09:42:40 +03:00
|
|
|
issue_3569,
|
|
|
|
"
|
|
|
|
export class TableView extends React.Component {
|
|
|
|
constructor(props){
|
|
|
|
super(props);
|
|
|
|
this.getSearchForm = (innerWidth = 0)=>{
|
|
|
|
this.getProps();
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
"
|
|
|
|
);
|
|
|
|
|
2021-12-02 04:04:01 +03:00
|
|
|
test!(
|
|
|
|
syntax(),
|
|
|
|
|_| tr(Config {
|
|
|
|
ignore_function_length: true
|
|
|
|
}),
|
|
|
|
fn_len_complex_assign,
|
2023-10-30 04:38:59 +03:00
|
|
|
"function test({a: b} = {}) {}"
|
2021-12-02 04:04:01 +03:00
|
|
|
);
|
|
|
|
|
|
|
|
test!(
|
|
|
|
syntax(),
|
|
|
|
|_| tr(Config {
|
|
|
|
ignore_function_length: true
|
|
|
|
}),
|
|
|
|
fn_len_default_array_destructuring,
|
2023-10-30 04:38:59 +03:00
|
|
|
"function t([,,a] = [1,2,3]) { return a }"
|
2021-12-02 04:04:01 +03:00
|
|
|
);
|
|
|
|
|
|
|
|
test_exec!(
|
|
|
|
syntax(),
|
|
|
|
|_| tr(Config {
|
|
|
|
ignore_function_length: true
|
|
|
|
}),
|
|
|
|
fn_len_default_array_destructuring_exec,
|
|
|
|
"function t([,,a] = [1,2,3]) { return a }
|
|
|
|
|
|
|
|
expect(t()).toBe(3);
|
|
|
|
expect(t([4,5,6])).toBe(6);"
|
|
|
|
);
|
|
|
|
|
|
|
|
test_exec!(
|
|
|
|
syntax(),
|
|
|
|
|_| tr(Config {
|
|
|
|
ignore_function_length: true
|
|
|
|
}),
|
|
|
|
fn_len_default_earlier_params,
|
|
|
|
"function f(a, b = a, c = b) { return c; }
|
|
|
|
|
|
|
|
expect(f(3)).toBe(3);"
|
|
|
|
);
|
|
|
|
|
|
|
|
test_exec!(
|
|
|
|
syntax(),
|
|
|
|
|_| tr(Config {
|
|
|
|
ignore_function_length: true
|
|
|
|
}),
|
|
|
|
fn_len_default_iife_1128,
|
|
|
|
"const bar = true;
|
|
|
|
|
|
|
|
function foo(a = bar, ...b) {
|
|
|
|
const bar = false;
|
|
|
|
expect(b[0]).toBe(2);
|
|
|
|
expect(b[1]).toBe(3);
|
|
|
|
}
|
2021-12-03 19:55:27 +03:00
|
|
|
|
2021-12-02 04:04:01 +03:00
|
|
|
foo(1, 2, 3);"
|
|
|
|
);
|
|
|
|
|
|
|
|
test_exec!(
|
|
|
|
syntax(),
|
|
|
|
|_| tr(Config {
|
|
|
|
ignore_function_length: true
|
|
|
|
}),
|
|
|
|
fn_len_default_iife_4253,
|
|
|
|
"class Ref {
|
|
|
|
static nextId = 0
|
|
|
|
constructor(id = ++Ref.nextId, n = id) {
|
|
|
|
this.id = n
|
|
|
|
}
|
|
|
|
}
|
2021-12-03 19:55:27 +03:00
|
|
|
|
2021-12-02 04:04:01 +03:00
|
|
|
expect(new Ref().id).toBe(1);
|
|
|
|
expect(new Ref().id).toBe(2);"
|
|
|
|
);
|
|
|
|
|
|
|
|
test_exec!(
|
|
|
|
syntax(),
|
|
|
|
|_| tr(Config {
|
|
|
|
ignore_function_length: true
|
|
|
|
}),
|
|
|
|
fn_len_default_iife_self,
|
|
|
|
"class Ref {
|
|
|
|
constructor(ref = Ref) {
|
|
|
|
this.ref = ref
|
|
|
|
}
|
|
|
|
}
|
2021-12-03 19:55:27 +03:00
|
|
|
|
2021-12-02 04:04:01 +03:00
|
|
|
expect(new Ref().ref).toBe(Ref);"
|
|
|
|
);
|
|
|
|
|
|
|
|
test!(
|
|
|
|
syntax(),
|
|
|
|
|_| tr(Config {
|
|
|
|
ignore_function_length: true
|
|
|
|
}),
|
|
|
|
fn_len_default_multiple,
|
|
|
|
r#"
|
|
|
|
var t = function (e = "foo", f = 5) {
|
|
|
|
return e + " bar " + f;
|
|
|
|
};
|
2021-12-03 19:55:27 +03:00
|
|
|
|
2021-12-02 04:04:01 +03:00
|
|
|
var a = function (e, f = 5) {
|
|
|
|
return e + " bar " + f;
|
2023-10-30 04:38:59 +03:00
|
|
|
};"#
|
2021-12-02 04:04:01 +03:00
|
|
|
);
|
|
|
|
|
|
|
|
test_exec!(
|
|
|
|
syntax(),
|
|
|
|
|_| tr(Config {
|
|
|
|
ignore_function_length: true
|
|
|
|
}),
|
|
|
|
fn_len_object_destructuring,
|
|
|
|
"function required(msg) {
|
|
|
|
throw new Error(msg);
|
|
|
|
}
|
2021-12-03 19:55:27 +03:00
|
|
|
|
2021-12-02 04:04:01 +03:00
|
|
|
function sum(
|
|
|
|
{ arr = required('arr is required') } = { arr: arr = [] },
|
|
|
|
length = arr.length
|
|
|
|
) {
|
|
|
|
let i = 0;
|
|
|
|
let acc = 0;
|
|
|
|
for (let item of arr) {
|
|
|
|
if (i >= length) return acc;
|
|
|
|
acc += item;
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
return acc;
|
|
|
|
}
|
2021-12-03 19:55:27 +03:00
|
|
|
|
2021-12-02 04:04:01 +03:00
|
|
|
expect(sum({arr:[1,2]})).toBe(3);"
|
|
|
|
);
|
|
|
|
|
|
|
|
test!(
|
|
|
|
syntax(),
|
|
|
|
|_| tr(Config {
|
|
|
|
ignore_function_length: true
|
|
|
|
}),
|
|
|
|
fn_len_rest_mix,
|
|
|
|
r#"
|
|
|
|
function fn(
|
|
|
|
a1,
|
|
|
|
a2 = 4,
|
|
|
|
{a3, a4},
|
|
|
|
a5,
|
|
|
|
{a6, a7} = {}) {
|
2021-12-03 19:55:27 +03:00
|
|
|
|
2023-10-30 04:38:59 +03:00
|
|
|
}"#
|
2021-12-02 04:04:01 +03:00
|
|
|
);
|
|
|
|
|
|
|
|
test_exec!(
|
|
|
|
syntax(),
|
|
|
|
|_| tr(Config {
|
|
|
|
ignore_function_length: true
|
|
|
|
}),
|
|
|
|
fn_len_rest,
|
|
|
|
"const a = 1;
|
|
|
|
function rest(b = a, ...a) {
|
|
|
|
expect(b).toBe(1);
|
|
|
|
}
|
|
|
|
rest(undefined, 2)
|
2021-12-03 19:55:27 +03:00
|
|
|
|
2021-12-02 04:04:01 +03:00
|
|
|
function rest2(b = a, ...a) {
|
|
|
|
expect(a[0]).toBe(2);
|
|
|
|
}
|
|
|
|
rest2(undefined, 2)
|
2021-12-03 19:55:27 +03:00
|
|
|
|
2021-12-02 04:04:01 +03:00
|
|
|
function rest3(b = a, ...a) {
|
|
|
|
expect(a).toHaveLength(1);
|
|
|
|
}
|
|
|
|
rest3(undefined, 2)"
|
|
|
|
);
|
|
|
|
|
|
|
|
test!(
|
|
|
|
syntax(),
|
|
|
|
|_| tr(Config {
|
|
|
|
ignore_function_length: true
|
|
|
|
}),
|
|
|
|
fn_len_default_single,
|
|
|
|
r#"
|
|
|
|
var t = function (f = "foo") {
|
|
|
|
return f + " bar";
|
|
|
|
};"#
|
|
|
|
);
|
|
|
|
|
|
|
|
test!(
|
|
|
|
syntax(),
|
|
|
|
|_| tr(Config {
|
|
|
|
ignore_function_length: true
|
|
|
|
}),
|
|
|
|
fn_len_destructing_rest,
|
|
|
|
r#"
|
|
|
|
function t(x = "default", { a, b }, ...args) {
|
|
|
|
console.log(x, a, b, args);
|
|
|
|
}"#
|
|
|
|
);
|
|
|
|
|
|
|
|
test_exec!(
|
|
|
|
syntax(),
|
|
|
|
|_| tr(Config {
|
|
|
|
ignore_function_length: true
|
|
|
|
}),
|
|
|
|
fn_len_overwrite_undefined,
|
|
|
|
"function t(undefined = 17, a = 3) {
|
|
|
|
return a;
|
|
|
|
}
|
2021-12-03 19:55:27 +03:00
|
|
|
|
2021-12-02 04:04:01 +03:00
|
|
|
expect(t()).toBe(3);"
|
|
|
|
);
|
2022-06-25 07:55:59 +03:00
|
|
|
|
|
|
|
test!(
|
|
|
|
syntax(),
|
|
|
|
|_| tr(Config {
|
|
|
|
ignore_function_length: true
|
|
|
|
}),
|
|
|
|
issue_5030,
|
|
|
|
r#"
|
|
|
|
let v0 = (Array, Int8Array, ...Int32Array) => (NaN + Infinity) * Int32Array.length;
|
|
|
|
console.log(v0(1, 2, 'hello', true, 7));
|
2023-10-30 04:38:59 +03:00
|
|
|
"#
|
2022-06-25 07:55:59 +03:00
|
|
|
);
|
2023-01-12 09:54:36 +03:00
|
|
|
|
|
|
|
#[testing::fixture("tests/parameters/**/input.js")]
|
|
|
|
fn fixture(input: PathBuf) {
|
|
|
|
let output = input.with_file_name("output.js");
|
|
|
|
|
|
|
|
test_fixture(
|
|
|
|
Default::default(),
|
|
|
|
&|_| {
|
|
|
|
let unresolved_mark = Mark::new();
|
|
|
|
chain!(
|
|
|
|
resolver(unresolved_mark, Mark::new(), false),
|
|
|
|
parameters(Default::default(), unresolved_mark)
|
|
|
|
)
|
|
|
|
},
|
|
|
|
&input,
|
|
|
|
&output,
|
|
|
|
Default::default(),
|
|
|
|
);
|
|
|
|
}
|