diff --git a/.gitee/PULL_REQUEST_TEMPLATE.en.md b/.gitee/PULL_REQUEST_TEMPLATE.en.md index e8d76c6d8cb96f0ee66ae881797496b1eca37111..789b54d357cc078f97c8c495d7b0b25a6e1f1239 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 919b88223d0cfc87e90cb7d550f0ee0bfd62dc51..bf9e587e33be4834ae35621ae789035c9835027d 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 0000000000000000000000000000000000000000..360f092c1384f46f14c1fab7c4852dcb334ca986 --- /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 0000000000000000000000000000000000000000..c1cc2d8dc7c6d7ecfc1d8bddf058d1c98133b6e5 --- /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 0000000000000000000000000000000000000000..92cdd1ec910f786645a903af17828324e2f76ac3 --- /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 0000000000000000000000000000000000000000..360f092c1384f46f14c1fab7c4852dcb334ca986 --- /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 0000000000000000000000000000000000000000..adbb8c05c614cef61e3d84e0f036aea315878582 --- /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 0000000000000000000000000000000000000000..92cdd1ec910f786645a903af17828324e2f76ac3 --- /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 0000000000000000000000000000000000000000..b4dfb2b02445a61dbb6be9295df0129f0236805a --- /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 0000000000000000000000000000000000000000..ac461df85681df15c4f9a36a9a57e6e82dd1beac --- /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 0000000000000000000000000000000000000000..92cdd1ec910f786645a903af17828324e2f76ac3 --- /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 0000000000000000000000000000000000000000..4a805150f031907ea40ecad462d7694ff40f4262 --- /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 0000000000000000000000000000000000000000..e35d6a5ee24292e2c359c6f3d36b119a10deed8a --- /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 0000000000000000000000000000000000000000..92cdd1ec910f786645a903af17828324e2f76ac3 --- /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 0000000000000000000000000000000000000000..360f092c1384f46f14c1fab7c4852dcb334ca986 --- /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 0000000000000000000000000000000000000000..c1cc2d8dc7c6d7ecfc1d8bddf058d1c98133b6e5 --- /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 0000000000000000000000000000000000000000..9b28a88ba35548bac086b1bee8f29ca3a3dee08a --- /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 0000000000000000000000000000000000000000..360f092c1384f46f14c1fab7c4852dcb334ca986 --- /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 0000000000000000000000000000000000000000..adbb8c05c614cef61e3d84e0f036aea315878582 --- /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 0000000000000000000000000000000000000000..9b28a88ba35548bac086b1bee8f29ca3a3dee08a --- /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 0000000000000000000000000000000000000000..b4dfb2b02445a61dbb6be9295df0129f0236805a --- /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 0000000000000000000000000000000000000000..ac461df85681df15c4f9a36a9a57e6e82dd1beac --- /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 0000000000000000000000000000000000000000..9b28a88ba35548bac086b1bee8f29ca3a3dee08a --- /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 0000000000000000000000000000000000000000..4a805150f031907ea40ecad462d7694ff40f4262 --- /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 0000000000000000000000000000000000000000..e35d6a5ee24292e2c359c6f3d36b119a10deed8a --- /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 0000000000000000000000000000000000000000..9b28a88ba35548bac086b1bee8f29ca3a3dee08a --- /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