mirror of
https://github.com/swc-project/swc.git
synced 2024-12-24 22:22:34 +03:00
ab7d46c5bc
swc_common: - implement VisitWith for &T and [T] swc_ecma_ast: - fix codegen of `===` swc_ecma_parser: - fix parsing of array pattern swc_ecma_transforms: - implement es2015::destructuring - implement es2015::computed_properties - implement es2015::duplicate_keys - implement es2015::parameters - fix `InjectHelper` pass Note that getters / setters in class are not supported yet - Run execution tests via jest - ignore es2016::exponentation tests
113 lines
1.4 KiB
Rust
113 lines
1.4 KiB
Rust
use super::*;
|
|
|
|
test!(
|
|
ignore,
|
|
DupKeys::default(),
|
|
combination_dupes,
|
|
r#"var x = { a: 5, a: 6 };"#,
|
|
r#"var x = _defineProperty({
|
|
a: 5
|
|
}, "a", 6);"#
|
|
);
|
|
|
|
test!(
|
|
DupKeys::default(),
|
|
combination_no_dupes,
|
|
r#"var x = { a: 5, b: 6 };"#,
|
|
r#"var x = { a: 5, b: 6 };"#
|
|
);
|
|
|
|
test!(
|
|
DupKeys::default(),
|
|
dup_keys_both_quoted,
|
|
r#"var x = { "a\n b": 5, "a\n b": 6 };"#,
|
|
r#"var x = {
|
|
"a\n b": 5,
|
|
["a\n b"]: 6
|
|
};"#
|
|
);
|
|
|
|
test!(
|
|
DupKeys::default(),
|
|
dup_keys_dupes,
|
|
r#"var x = { a: 5, a: 6 };"#,
|
|
r#"var x = {
|
|
a: 5,
|
|
["a"]: 6
|
|
};"#
|
|
);
|
|
|
|
test!(
|
|
DupKeys::default(),
|
|
dup_keys_getter,
|
|
r#"var x = { a: 5, get a() {return 6;} };"#,
|
|
r#"var x = {
|
|
a: 5,
|
|
|
|
get ["a"]() {
|
|
return 6;
|
|
}
|
|
|
|
};"#
|
|
);
|
|
|
|
test!(
|
|
DupKeys::default(),
|
|
dup_keys_getter_and_setter,
|
|
r#"var x = {
|
|
get a() {},
|
|
set a(x) {},
|
|
get a() {},
|
|
set a(x) {},
|
|
a: 3,
|
|
b: 4,
|
|
get b() {},
|
|
set b(x) {},
|
|
get c() {},
|
|
c: 5,
|
|
set c(x) {},
|
|
set d(x) {},
|
|
d: 6,
|
|
get d() {}
|
|
};"#,
|
|
r#"var x = {
|
|
get a() {},
|
|
|
|
set a(x) {},
|
|
|
|
get ["a"]() {},
|
|
|
|
set ["a"](x) {},
|
|
|
|
["a"]: 3,
|
|
b: 4,
|
|
|
|
get ["b"]() {},
|
|
|
|
set ["b"](x) {},
|
|
|
|
get c() {},
|
|
|
|
["c"]: 5,
|
|
|
|
set ["c"](x) {},
|
|
|
|
set d(x) {},
|
|
|
|
["d"]: 6,
|
|
|
|
get ["d"]() {}
|
|
|
|
};"#
|
|
);
|
|
|
|
test!(
|
|
DupKeys::default(),
|
|
dup_keys_one_quoted,
|
|
r#"var x = { a: 5, "a": 6 };"#,
|
|
r#"var x = {
|
|
a: 5,
|
|
["a"]: 6
|
|
};"#
|
|
);
|