From b403d3094ba1c54de5c1c6ede449353ebc071613 Mon Sep 17 00:00:00 2001 From: ElevenDuan Date: Tue, 9 Sep 2025 21:10:31 +0800 Subject: [PATCH] Add hot-reload ut and checklist Issue: https://gitee.com/openharmony/arkcompiler_ets_frontend/issues/ICX7CK?from=project-issue Change-Id: I5f72095d0a9272505e846ca20d0de8c09abea59a Signed-off-by: ElevenDuan --- .gitee/PULL_REQUEST_TEMPLATE.en.md | 6 ++++ .gitee/PULL_REQUEST_TEMPLATE.zh-CN.md | 6 ++++ .../modify-lexenv-add-target/base.js | 26 +++++++++++++++++ .../modify-lexenv-add-target/base_mod.js | 27 ++++++++++++++++++ .../modify-lexenv-add-target/expected.txt | 17 +++++++++++ .../modify-lexenv-add-this/base.js | 26 +++++++++++++++++ .../modify-lexenv-add-this/base_mod.js | 28 +++++++++++++++++++ .../modify-lexenv-add-this/expected.txt | 17 +++++++++++ .../modify-lexenv-remove-target/base.js | 25 +++++++++++++++++ .../modify-lexenv-remove-target/base_mod.js | 26 +++++++++++++++++ .../modify-lexenv-remove-target/expected.txt | 17 +++++++++++ .../modify-lexenv-remove-this/base.js | 26 +++++++++++++++++ .../modify-lexenv-remove-this/base_mod.js | 28 +++++++++++++++++++ .../modify-lexenv-remove-this/expected.txt | 17 +++++++++++ .../modify-lexenv-add-target/base.js | 26 +++++++++++++++++ .../modify-lexenv-add-target/base_mod.js | 27 ++++++++++++++++++ .../modify-lexenv-add-target/expected.txt | 17 +++++++++++ .../modify-lexenv-add-this/base.js | 26 +++++++++++++++++ .../modify-lexenv-add-this/base_mod.js | 28 +++++++++++++++++++ .../modify-lexenv-add-this/expected.txt | 17 +++++++++++ .../modify-lexenv-remove-target/base.js | 25 +++++++++++++++++ .../modify-lexenv-remove-target/base_mod.js | 26 +++++++++++++++++ .../modify-lexenv-remove-target/expected.txt | 17 +++++++++++ .../modify-lexenv-remove-this/base.js | 26 +++++++++++++++++ .../modify-lexenv-remove-this/base_mod.js | 28 +++++++++++++++++++ .../modify-lexenv-remove-this/expected.txt | 17 +++++++++++ 26 files changed, 572 insertions(+) create mode 100644 es2panda/test/patch/11/hotreload/hotreload-throwerror/modify-lexenv-add-target/base.js create mode 100644 es2panda/test/patch/11/hotreload/hotreload-throwerror/modify-lexenv-add-target/base_mod.js create mode 100644 es2panda/test/patch/11/hotreload/hotreload-throwerror/modify-lexenv-add-target/expected.txt create mode 100644 es2panda/test/patch/11/hotreload/hotreload-throwerror/modify-lexenv-add-this/base.js create mode 100644 es2panda/test/patch/11/hotreload/hotreload-throwerror/modify-lexenv-add-this/base_mod.js create mode 100644 es2panda/test/patch/11/hotreload/hotreload-throwerror/modify-lexenv-add-this/expected.txt create mode 100644 es2panda/test/patch/11/hotreload/hotreload-throwerror/modify-lexenv-remove-target/base.js create mode 100644 es2panda/test/patch/11/hotreload/hotreload-throwerror/modify-lexenv-remove-target/base_mod.js create mode 100644 es2panda/test/patch/11/hotreload/hotreload-throwerror/modify-lexenv-remove-target/expected.txt create mode 100644 es2panda/test/patch/11/hotreload/hotreload-throwerror/modify-lexenv-remove-this/base.js create mode 100644 es2panda/test/patch/11/hotreload/hotreload-throwerror/modify-lexenv-remove-this/base_mod.js create mode 100644 es2panda/test/patch/11/hotreload/hotreload-throwerror/modify-lexenv-remove-this/expected.txt create mode 100644 es2panda/test/patch/currentVersion/hotreload/hotreload-throwerror/modify-lexenv-add-target/base.js create mode 100644 es2panda/test/patch/currentVersion/hotreload/hotreload-throwerror/modify-lexenv-add-target/base_mod.js create mode 100644 es2panda/test/patch/currentVersion/hotreload/hotreload-throwerror/modify-lexenv-add-target/expected.txt create mode 100644 es2panda/test/patch/currentVersion/hotreload/hotreload-throwerror/modify-lexenv-add-this/base.js create mode 100644 es2panda/test/patch/currentVersion/hotreload/hotreload-throwerror/modify-lexenv-add-this/base_mod.js create mode 100644 es2panda/test/patch/currentVersion/hotreload/hotreload-throwerror/modify-lexenv-add-this/expected.txt create mode 100644 es2panda/test/patch/currentVersion/hotreload/hotreload-throwerror/modify-lexenv-remove-target/base.js create mode 100644 es2panda/test/patch/currentVersion/hotreload/hotreload-throwerror/modify-lexenv-remove-target/base_mod.js create mode 100644 es2panda/test/patch/currentVersion/hotreload/hotreload-throwerror/modify-lexenv-remove-target/expected.txt create mode 100644 es2panda/test/patch/currentVersion/hotreload/hotreload-throwerror/modify-lexenv-remove-this/base.js create mode 100644 es2panda/test/patch/currentVersion/hotreload/hotreload-throwerror/modify-lexenv-remove-this/base_mod.js create mode 100644 es2panda/test/patch/currentVersion/hotreload/hotreload-throwerror/modify-lexenv-remove-this/expected.txt diff --git a/.gitee/PULL_REQUEST_TEMPLATE.en.md b/.gitee/PULL_REQUEST_TEMPLATE.en.md index e8d76c6d8c..789b54d357 100644 --- a/.gitee/PULL_REQUEST_TEMPLATE.en.md +++ b/.gitee/PULL_REQUEST_TEMPLATE.en.md @@ -76,6 +76,12 @@ ninja all tests - [ ] Affected — Changes impact API/bytecode version but do not need to be synced to other branches - [ ] Not affected — Changes do not involve API/bytecode version +4. Compatibility Testing for Lexical Environment Changes +**Note: If the PR involves modifications to the lexical environment, verify whether it is compatible with hot reload scenarios.** +- [ ] Involved, affects hot reload scenarios, requires impact assessment +- [ ] Involved, does not affect hot reload scenarios +- [ ] Not involved + #### Performance Testing (e.g., new syntax checking scenarios) - [ ] Passed - [ ] Not applicable, no need to verify diff --git a/.gitee/PULL_REQUEST_TEMPLATE.zh-CN.md b/.gitee/PULL_REQUEST_TEMPLATE.zh-CN.md index 919b88223d..bf9e587e33 100644 --- a/.gitee/PULL_REQUEST_TEMPLATE.zh-CN.md +++ b/.gitee/PULL_REQUEST_TEMPLATE.zh-CN.md @@ -79,6 +79,12 @@ - [ ] 涉及,变更影响 API/字节码 版本, 无需同步到其他分支 - [ ] 不涉及,变更不涉及 API/字节码 版本 +4. 是否涉及词法环境修改 +**说明:如PR涉及词法环境修改,需验证对应热重载场景是否兼容** + - [ ] 涉及,影响热重载场景,需排查影响 + - [ ] 涉及,不影响热重载场景 + - [ ] 不涉及 + #### 性能测试 (新增语法检查等场景) - [ ] 已通过 - [ ] 不涉及,无需验证 diff --git a/es2panda/test/patch/11/hotreload/hotreload-throwerror/modify-lexenv-add-target/base.js b/es2panda/test/patch/11/hotreload/hotreload-throwerror/modify-lexenv-add-target/base.js new file mode 100644 index 0000000000..360f092c13 --- /dev/null +++ b/es2panda/test/patch/11/hotreload/hotreload-throwerror/modify-lexenv-add-target/base.js @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +class A { + x = "test string"; + test() { + let a = () => { + print("change this"); + } + return a; + } +} +let a = new A(); +a.test()(); \ No newline at end of file diff --git a/es2panda/test/patch/11/hotreload/hotreload-throwerror/modify-lexenv-add-target/base_mod.js b/es2panda/test/patch/11/hotreload/hotreload-throwerror/modify-lexenv-add-target/base_mod.js new file mode 100644 index 0000000000..c1cc2d8dc7 --- /dev/null +++ b/es2panda/test/patch/11/hotreload/hotreload-throwerror/modify-lexenv-add-target/base_mod.js @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// Test scenario: modify lexenv, es2abc can specify and throw error + +class A { + test() { + let a = () => { + new.target; + } + return a; + } +} +let a = new A(); +a.test()(); \ No newline at end of file diff --git a/es2panda/test/patch/11/hotreload/hotreload-throwerror/modify-lexenv-add-target/expected.txt b/es2panda/test/patch/11/hotreload/hotreload-throwerror/modify-lexenv-add-target/expected.txt new file mode 100644 index 0000000000..92cdd1ec91 --- /dev/null +++ b/es2panda/test/patch/11/hotreload/hotreload-throwerror/modify-lexenv-add-target/expected.txt @@ -0,0 +1,17 @@ +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +[Patch] Found lexical variable added or removed in .test, not supported! +[Patch] Found unsupported change in file, will not generate patch! +Error: [base_mod.js:0:0] +The size of programs is expected to be 1, but is 0 diff --git a/es2panda/test/patch/11/hotreload/hotreload-throwerror/modify-lexenv-add-this/base.js b/es2panda/test/patch/11/hotreload/hotreload-throwerror/modify-lexenv-add-this/base.js new file mode 100644 index 0000000000..360f092c13 --- /dev/null +++ b/es2panda/test/patch/11/hotreload/hotreload-throwerror/modify-lexenv-add-this/base.js @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +class A { + x = "test string"; + test() { + let a = () => { + print("change this"); + } + return a; + } +} +let a = new A(); +a.test()(); \ No newline at end of file diff --git a/es2panda/test/patch/11/hotreload/hotreload-throwerror/modify-lexenv-add-this/base_mod.js b/es2panda/test/patch/11/hotreload/hotreload-throwerror/modify-lexenv-add-this/base_mod.js new file mode 100644 index 0000000000..adbb8c05c6 --- /dev/null +++ b/es2panda/test/patch/11/hotreload/hotreload-throwerror/modify-lexenv-add-this/base_mod.js @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// Test scenario: modify lexenv, es2abc can specify and throw error + +class A { + x = "test string"; + test() { + let a = () => { + print(this.x); + } + return a; + } +} +let a = new A(); +a.test()(); \ No newline at end of file diff --git a/es2panda/test/patch/11/hotreload/hotreload-throwerror/modify-lexenv-add-this/expected.txt b/es2panda/test/patch/11/hotreload/hotreload-throwerror/modify-lexenv-add-this/expected.txt new file mode 100644 index 0000000000..92cdd1ec91 --- /dev/null +++ b/es2panda/test/patch/11/hotreload/hotreload-throwerror/modify-lexenv-add-this/expected.txt @@ -0,0 +1,17 @@ +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +[Patch] Found lexical variable added or removed in .test, not supported! +[Patch] Found unsupported change in file, will not generate patch! +Error: [base_mod.js:0:0] +The size of programs is expected to be 1, but is 0 diff --git a/es2panda/test/patch/11/hotreload/hotreload-throwerror/modify-lexenv-remove-target/base.js b/es2panda/test/patch/11/hotreload/hotreload-throwerror/modify-lexenv-remove-target/base.js new file mode 100644 index 0000000000..b4dfb2b024 --- /dev/null +++ b/es2panda/test/patch/11/hotreload/hotreload-throwerror/modify-lexenv-remove-target/base.js @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +class A { + test() { + let a = () => { + new.target; + } + return a; + } +} +let a = new A(); +a.test()(); \ No newline at end of file diff --git a/es2panda/test/patch/11/hotreload/hotreload-throwerror/modify-lexenv-remove-target/base_mod.js b/es2panda/test/patch/11/hotreload/hotreload-throwerror/modify-lexenv-remove-target/base_mod.js new file mode 100644 index 0000000000..ac461df856 --- /dev/null +++ b/es2panda/test/patch/11/hotreload/hotreload-throwerror/modify-lexenv-remove-target/base_mod.js @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// Test scenario: modify lexenv, es2abc can specify and throw error + +class A { + test() { + let a = () => { + } + return a; + } +} +let a = new A(); +a.test()(); \ No newline at end of file diff --git a/es2panda/test/patch/11/hotreload/hotreload-throwerror/modify-lexenv-remove-target/expected.txt b/es2panda/test/patch/11/hotreload/hotreload-throwerror/modify-lexenv-remove-target/expected.txt new file mode 100644 index 0000000000..92cdd1ec91 --- /dev/null +++ b/es2panda/test/patch/11/hotreload/hotreload-throwerror/modify-lexenv-remove-target/expected.txt @@ -0,0 +1,17 @@ +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +[Patch] Found lexical variable added or removed in .test, not supported! +[Patch] Found unsupported change in file, will not generate patch! +Error: [base_mod.js:0:0] +The size of programs is expected to be 1, but is 0 diff --git a/es2panda/test/patch/11/hotreload/hotreload-throwerror/modify-lexenv-remove-this/base.js b/es2panda/test/patch/11/hotreload/hotreload-throwerror/modify-lexenv-remove-this/base.js new file mode 100644 index 0000000000..4a805150f0 --- /dev/null +++ b/es2panda/test/patch/11/hotreload/hotreload-throwerror/modify-lexenv-remove-this/base.js @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +class A { + x = "test string"; + test() { + let a = () => { + print(this.x); + } + return a; + } +} +let a = new A(); +a.test()(); \ No newline at end of file diff --git a/es2panda/test/patch/11/hotreload/hotreload-throwerror/modify-lexenv-remove-this/base_mod.js b/es2panda/test/patch/11/hotreload/hotreload-throwerror/modify-lexenv-remove-this/base_mod.js new file mode 100644 index 0000000000..e35d6a5ee2 --- /dev/null +++ b/es2panda/test/patch/11/hotreload/hotreload-throwerror/modify-lexenv-remove-this/base_mod.js @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// Test scenario: modify lexenv, es2abc can specify and throw error + +class A { + x = "test string"; + test() { + let a = () => { + print("change this"); + } + return a; + } +} +let a = new A(); +a.test()(); \ No newline at end of file diff --git a/es2panda/test/patch/11/hotreload/hotreload-throwerror/modify-lexenv-remove-this/expected.txt b/es2panda/test/patch/11/hotreload/hotreload-throwerror/modify-lexenv-remove-this/expected.txt new file mode 100644 index 0000000000..92cdd1ec91 --- /dev/null +++ b/es2panda/test/patch/11/hotreload/hotreload-throwerror/modify-lexenv-remove-this/expected.txt @@ -0,0 +1,17 @@ +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +[Patch] Found lexical variable added or removed in .test, not supported! +[Patch] Found unsupported change in file, will not generate patch! +Error: [base_mod.js:0:0] +The size of programs is expected to be 1, but is 0 diff --git a/es2panda/test/patch/currentVersion/hotreload/hotreload-throwerror/modify-lexenv-add-target/base.js b/es2panda/test/patch/currentVersion/hotreload/hotreload-throwerror/modify-lexenv-add-target/base.js new file mode 100644 index 0000000000..360f092c13 --- /dev/null +++ b/es2panda/test/patch/currentVersion/hotreload/hotreload-throwerror/modify-lexenv-add-target/base.js @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +class A { + x = "test string"; + test() { + let a = () => { + print("change this"); + } + return a; + } +} +let a = new A(); +a.test()(); \ No newline at end of file diff --git a/es2panda/test/patch/currentVersion/hotreload/hotreload-throwerror/modify-lexenv-add-target/base_mod.js b/es2panda/test/patch/currentVersion/hotreload/hotreload-throwerror/modify-lexenv-add-target/base_mod.js new file mode 100644 index 0000000000..c1cc2d8dc7 --- /dev/null +++ b/es2panda/test/patch/currentVersion/hotreload/hotreload-throwerror/modify-lexenv-add-target/base_mod.js @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// Test scenario: modify lexenv, es2abc can specify and throw error + +class A { + test() { + let a = () => { + new.target; + } + return a; + } +} +let a = new A(); +a.test()(); \ No newline at end of file diff --git a/es2panda/test/patch/currentVersion/hotreload/hotreload-throwerror/modify-lexenv-add-target/expected.txt b/es2panda/test/patch/currentVersion/hotreload/hotreload-throwerror/modify-lexenv-add-target/expected.txt new file mode 100644 index 0000000000..9b28a88ba3 --- /dev/null +++ b/es2panda/test/patch/currentVersion/hotreload/hotreload-throwerror/modify-lexenv-add-target/expected.txt @@ -0,0 +1,17 @@ +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +[Patch] Found lexical variable added or removed in .#~A>#test, not supported! +[Patch] Found unsupported change in file, will not generate patch! +Error: [base_mod.js:0:0] +The size of programs is expected to be 1, but is 0 diff --git a/es2panda/test/patch/currentVersion/hotreload/hotreload-throwerror/modify-lexenv-add-this/base.js b/es2panda/test/patch/currentVersion/hotreload/hotreload-throwerror/modify-lexenv-add-this/base.js new file mode 100644 index 0000000000..360f092c13 --- /dev/null +++ b/es2panda/test/patch/currentVersion/hotreload/hotreload-throwerror/modify-lexenv-add-this/base.js @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +class A { + x = "test string"; + test() { + let a = () => { + print("change this"); + } + return a; + } +} +let a = new A(); +a.test()(); \ No newline at end of file diff --git a/es2panda/test/patch/currentVersion/hotreload/hotreload-throwerror/modify-lexenv-add-this/base_mod.js b/es2panda/test/patch/currentVersion/hotreload/hotreload-throwerror/modify-lexenv-add-this/base_mod.js new file mode 100644 index 0000000000..adbb8c05c6 --- /dev/null +++ b/es2panda/test/patch/currentVersion/hotreload/hotreload-throwerror/modify-lexenv-add-this/base_mod.js @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// Test scenario: modify lexenv, es2abc can specify and throw error + +class A { + x = "test string"; + test() { + let a = () => { + print(this.x); + } + return a; + } +} +let a = new A(); +a.test()(); \ No newline at end of file diff --git a/es2panda/test/patch/currentVersion/hotreload/hotreload-throwerror/modify-lexenv-add-this/expected.txt b/es2panda/test/patch/currentVersion/hotreload/hotreload-throwerror/modify-lexenv-add-this/expected.txt new file mode 100644 index 0000000000..9b28a88ba3 --- /dev/null +++ b/es2panda/test/patch/currentVersion/hotreload/hotreload-throwerror/modify-lexenv-add-this/expected.txt @@ -0,0 +1,17 @@ +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +[Patch] Found lexical variable added or removed in .#~A>#test, not supported! +[Patch] Found unsupported change in file, will not generate patch! +Error: [base_mod.js:0:0] +The size of programs is expected to be 1, but is 0 diff --git a/es2panda/test/patch/currentVersion/hotreload/hotreload-throwerror/modify-lexenv-remove-target/base.js b/es2panda/test/patch/currentVersion/hotreload/hotreload-throwerror/modify-lexenv-remove-target/base.js new file mode 100644 index 0000000000..b4dfb2b024 --- /dev/null +++ b/es2panda/test/patch/currentVersion/hotreload/hotreload-throwerror/modify-lexenv-remove-target/base.js @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +class A { + test() { + let a = () => { + new.target; + } + return a; + } +} +let a = new A(); +a.test()(); \ No newline at end of file diff --git a/es2panda/test/patch/currentVersion/hotreload/hotreload-throwerror/modify-lexenv-remove-target/base_mod.js b/es2panda/test/patch/currentVersion/hotreload/hotreload-throwerror/modify-lexenv-remove-target/base_mod.js new file mode 100644 index 0000000000..ac461df856 --- /dev/null +++ b/es2panda/test/patch/currentVersion/hotreload/hotreload-throwerror/modify-lexenv-remove-target/base_mod.js @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// Test scenario: modify lexenv, es2abc can specify and throw error + +class A { + test() { + let a = () => { + } + return a; + } +} +let a = new A(); +a.test()(); \ No newline at end of file diff --git a/es2panda/test/patch/currentVersion/hotreload/hotreload-throwerror/modify-lexenv-remove-target/expected.txt b/es2panda/test/patch/currentVersion/hotreload/hotreload-throwerror/modify-lexenv-remove-target/expected.txt new file mode 100644 index 0000000000..9b28a88ba3 --- /dev/null +++ b/es2panda/test/patch/currentVersion/hotreload/hotreload-throwerror/modify-lexenv-remove-target/expected.txt @@ -0,0 +1,17 @@ +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +[Patch] Found lexical variable added or removed in .#~A>#test, not supported! +[Patch] Found unsupported change in file, will not generate patch! +Error: [base_mod.js:0:0] +The size of programs is expected to be 1, but is 0 diff --git a/es2panda/test/patch/currentVersion/hotreload/hotreload-throwerror/modify-lexenv-remove-this/base.js b/es2panda/test/patch/currentVersion/hotreload/hotreload-throwerror/modify-lexenv-remove-this/base.js new file mode 100644 index 0000000000..4a805150f0 --- /dev/null +++ b/es2panda/test/patch/currentVersion/hotreload/hotreload-throwerror/modify-lexenv-remove-this/base.js @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +class A { + x = "test string"; + test() { + let a = () => { + print(this.x); + } + return a; + } +} +let a = new A(); +a.test()(); \ No newline at end of file diff --git a/es2panda/test/patch/currentVersion/hotreload/hotreload-throwerror/modify-lexenv-remove-this/base_mod.js b/es2panda/test/patch/currentVersion/hotreload/hotreload-throwerror/modify-lexenv-remove-this/base_mod.js new file mode 100644 index 0000000000..e35d6a5ee2 --- /dev/null +++ b/es2panda/test/patch/currentVersion/hotreload/hotreload-throwerror/modify-lexenv-remove-this/base_mod.js @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// Test scenario: modify lexenv, es2abc can specify and throw error + +class A { + x = "test string"; + test() { + let a = () => { + print("change this"); + } + return a; + } +} +let a = new A(); +a.test()(); \ No newline at end of file diff --git a/es2panda/test/patch/currentVersion/hotreload/hotreload-throwerror/modify-lexenv-remove-this/expected.txt b/es2panda/test/patch/currentVersion/hotreload/hotreload-throwerror/modify-lexenv-remove-this/expected.txt new file mode 100644 index 0000000000..9b28a88ba3 --- /dev/null +++ b/es2panda/test/patch/currentVersion/hotreload/hotreload-throwerror/modify-lexenv-remove-this/expected.txt @@ -0,0 +1,17 @@ +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +[Patch] Found lexical variable added or removed in .#~A>#test, not supported! +[Patch] Found unsupported change in file, will not generate patch! +Error: [base_mod.js:0:0] +The size of programs is expected to be 1, but is 0 -- Gitee