diff --git a/Cargo.lock b/Cargo.lock index 1950ba351eab..d7663729eccc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1338,9 +1338,9 @@ checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" [[package]] name = "openssl" -version = "0.10.36" +version = "0.10.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d9facdb76fec0b73c406f125d44d86fdad818d66fef0531eec9233ca425ff4a" +checksum = "2bc6b9e4403633698352880b22cbe2f0e45dd0177f6fabe4585536e56a3e4f75" dependencies = [ "bitflags", "cfg-if 1.0.0", @@ -1358,9 +1358,9 @@ checksum = "28988d872ab76095a6e6ac88d99b54fd267702734fd7ffe610ca27f533ddb95a" [[package]] name = "openssl-sys" -version = "0.9.67" +version = "0.9.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69df2d8dfc6ce3aaf44b40dec6f487d5a886516cf6879c49e98e0710f310a058" +checksum = "1c571f25d3f66dd427e417cebf73dbe2361d6125cf6e3a70d143fdf97c9f5150" dependencies = [ "autocfg 1.0.1", "cc", @@ -2712,7 +2712,7 @@ dependencies = [ [[package]] name = "swc_ecma_parser" -version = "0.76.0" +version = "0.76.1" dependencies = [ "either", "enum_kind", diff --git a/ecmascript/parser/Cargo.toml b/ecmascript/parser/Cargo.toml index c277153c7210..e61a9be4eec5 100644 --- a/ecmascript/parser/Cargo.toml +++ b/ecmascript/parser/Cargo.toml @@ -7,7 +7,7 @@ include = ["Cargo.toml", "src/**/*.rs", "examples/**/*.rs"] license = "Apache-2.0/MIT" name = "swc_ecma_parser" repository = "https://github.com/swc-project/swc.git" -version = "0.76.0" +version = "0.76.1" [package.metadata.docs.rs] all-features = true diff --git a/ecmascript/parser/src/lib.rs b/ecmascript/parser/src/lib.rs index 822e6b47b4b4..bf9b2e102e73 100644 --- a/ecmascript/parser/src/lib.rs +++ b/ecmascript/parser/src/lib.rs @@ -280,7 +280,7 @@ impl Syntax { Syntax::Es(EsConfig { private_in_object, .. }) => private_in_object, - _ => false, + Syntax::Typescript(_) => true, } } diff --git a/ecmascript/parser/tests/typescript/class/property-private/input.ts b/ecmascript/parser/tests/typescript/class/property-private/input.ts index 42b0cc8ccb91..e2c9ef677033 100644 --- a/ecmascript/parser/tests/typescript/class/property-private/input.ts +++ b/ecmascript/parser/tests/typescript/class/property-private/input.ts @@ -5,4 +5,8 @@ class MyClass { constructor() { this.#b = "test"; } + + method() { + return #a in this; + } } diff --git a/ecmascript/parser/tests/typescript/class/property-private/input.ts.json b/ecmascript/parser/tests/typescript/class/property-private/input.ts.json index 0bb025340923..bea05d64638e 100644 --- a/ecmascript/parser/tests/typescript/class/property-private/input.ts.json +++ b/ecmascript/parser/tests/typescript/class/property-private/input.ts.json @@ -2,7 +2,7 @@ "type": "Script", "span": { "start": 0, - "end": 98, + "end": 147, "ctxt": 0 }, "body": [ @@ -21,7 +21,7 @@ "declare": false, "span": { "start": 0, - "end": 98, + "end": 147, "ctxt": 0 }, "decorators": [], @@ -220,6 +220,96 @@ }, "accessibility": null, "isOptional": false + }, + { + "type": "ClassMethod", + "span": { + "start": 102, + "end": 145, + "ctxt": 0 + }, + "key": { + "type": "Identifier", + "span": { + "start": 102, + "end": 108, + "ctxt": 0 + }, + "value": "method", + "optional": false + }, + "function": { + "params": [], + "decorators": [], + "span": { + "start": 102, + "end": 145, + "ctxt": 0 + }, + "body": { + "type": "BlockStatement", + "span": { + "start": 111, + "end": 145, + "ctxt": 0 + }, + "stmts": [ + { + "type": "ReturnStatement", + "span": { + "start": 121, + "end": 139, + "ctxt": 0 + }, + "argument": { + "type": "BinaryExpression", + "span": { + "start": 128, + "end": 138, + "ctxt": 0 + }, + "operator": "in", + "left": { + "type": "PrivateName", + "span": { + "start": 128, + "end": 130, + "ctxt": 0 + }, + "id": { + "type": "Identifier", + "span": { + "start": 129, + "end": 130, + "ctxt": 0 + }, + "value": "a", + "optional": false + } + }, + "right": { + "type": "ThisExpression", + "span": { + "start": 134, + "end": 138, + "ctxt": 0 + } + } + } + } + ] + }, + "generator": false, + "async": false, + "typeParameters": null, + "returnType": null + }, + "kind": "method", + "isStatic": false, + "accessibility": null, + "isAbstract": false, + "isOptional": false, + "isOverride": false } ], "superClass": null,