diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index e805593..e33be5f 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -23,19 +23,6 @@ jobs: run: cargo test --release --features=moz_central env: RUST_MIN_STACK: 9999999 - - name: rust-tarpaulin - uses: actions-rs/tarpaulin@v0.1 - env: - RUST_MIN_STACK: 9999999 - with: - args: --features=moz_central - - name: Upload to codecov.io - uses: codecov/codecov-action@v3 - continue-on-error: true - with: - token: ${{secrets.CODECOV_TOKEN}} - - name: Check syntax - run: cargo fmt --all -- --check - name: Cache node_modules uses: actions/cache@v3 with: diff --git a/src/spanned/mod.rs b/src/spanned/mod.rs index 25adf09..df984a1 100644 --- a/src/spanned/mod.rs +++ b/src/spanned/mod.rs @@ -3080,7 +3080,9 @@ where let id = self.parse_object_property_key()?; let open_paren = self.expect_punct(Punct::OpenParen)?; let close_paren = self.expect_punct(Punct::CloseParen)?; + self.add_scope(lexical_names::Scope::FuncTop); let body = self.parse_method_body(true, false)?; + self.remove_scope(); Ok(PropGet { keyword_static, keyword_get, @@ -3191,9 +3193,11 @@ where ); let prev_allow_super_call = self.context.allow_super_call; self.context.allow_super_call = self.context.allow_super; + self.add_scope(lexical_names::Scope::FuncTop); let params = self.parse_formal_params()?; let body = self.parse_method_body(params.simple, params.found_restricted)?; self.context.allow_super_call = prev_allow_super_call; + self.remove_scope(); let ctor = PropCtor { keyword: id, open_paren: params.open_paren, diff --git a/tests/snippets.rs b/tests/snippets.rs index b95e3db..16b732b 100644 --- a/tests/snippets.rs +++ b/tests/snippets.rs @@ -1141,6 +1141,22 @@ fn for_lhs() { run_test("for(var x=(0 in[])in{});", false).unwrap(); } +#[test] +fn class_ctor_scope() { + env_logger::builder().is_test(true).try_init().ok(); + run_test("class e { + constructor(t) {} + + get a() { + let t; + } + + get b() { + let t; + } +}", false).unwrap(); +} + #[test] fn import_default() { env_logger::builder().is_test(true).try_init().ok();