mirror of
https://github.com/denoland/deno.git
synced 2025-01-03 04:48:52 -05:00
fix: ES private fields parsing in SWC (#5964)
This commit is contained in:
parent
8b037364ac
commit
550556e948
4 changed files with 24 additions and 3 deletions
|
@ -32,9 +32,9 @@ use swc_ecma_visit::Visit;
|
|||
fn get_default_es_config() -> EsConfig {
|
||||
let mut config = EsConfig::default();
|
||||
config.num_sep = true;
|
||||
config.class_private_props = false;
|
||||
config.class_private_methods = false;
|
||||
config.class_props = false;
|
||||
config.class_private_props = true;
|
||||
config.class_private_methods = true;
|
||||
config.class_props = true;
|
||||
config.export_default_from = true;
|
||||
config.export_namespace_from = true;
|
||||
config.dynamic_import = true;
|
||||
|
|
15
cli/tests/es_private_fields.js
Normal file
15
cli/tests/es_private_fields.js
Normal file
|
@ -0,0 +1,15 @@
|
|||
class Foo {
|
||||
#field = "field";
|
||||
|
||||
setValue(val) {
|
||||
this.#field = val;
|
||||
}
|
||||
|
||||
getValue() {
|
||||
return this.#field;
|
||||
}
|
||||
}
|
||||
|
||||
const bar = new Foo();
|
||||
bar.setValue("PRIVATE");
|
||||
console.log(bar.getValue());
|
1
cli/tests/es_private_fields.js.out
Normal file
1
cli/tests/es_private_fields.js.out
Normal file
|
@ -0,0 +1 @@
|
|||
PRIVATE
|
|
@ -1827,6 +1827,11 @@ itest!(fix_js_imports {
|
|||
output: "fix_js_imports.ts.out",
|
||||
});
|
||||
|
||||
itest!(es_private_fields {
|
||||
args: "run --quiet --reload es_private_fields.js",
|
||||
output: "es_private_fields.js.out",
|
||||
});
|
||||
|
||||
itest!(proto_exploit {
|
||||
args: "run proto_exploit.js",
|
||||
output: "proto_exploit.js.out",
|
||||
|
|
Loading…
Reference in a new issue