1
0
Fork 0
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:
Bartek Iwańczuk 2020-05-30 17:32:48 +02:00 committed by GitHub
parent 8b037364ac
commit 550556e948
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 24 additions and 3 deletions

View file

@ -32,9 +32,9 @@ use swc_ecma_visit::Visit;
fn get_default_es_config() -> EsConfig { fn get_default_es_config() -> EsConfig {
let mut config = EsConfig::default(); let mut config = EsConfig::default();
config.num_sep = true; config.num_sep = true;
config.class_private_props = false; config.class_private_props = true;
config.class_private_methods = false; config.class_private_methods = true;
config.class_props = false; config.class_props = true;
config.export_default_from = true; config.export_default_from = true;
config.export_namespace_from = true; config.export_namespace_from = true;
config.dynamic_import = true; config.dynamic_import = true;

View 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());

View file

@ -0,0 +1 @@
PRIVATE

View file

@ -1827,6 +1827,11 @@ itest!(fix_js_imports {
output: "fix_js_imports.ts.out", 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 { itest!(proto_exploit {
args: "run proto_exploit.js", args: "run proto_exploit.js",
output: "proto_exploit.js.out", output: "proto_exploit.js.out",