@next-core/cook 1.6.5 → 1.6.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,41 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [1.6.9](https://github.com/easyops-cn/next-core/compare/@next-core/cook@1.6.8...@next-core/cook@1.6.9) (2022-01-13)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * perform iterator close in for-of-loop ([bd44f3f](https://github.com/easyops-cn/next-core/commit/bd44f3f2e3d3996b48b6af50cb97528aae631047))
12
+
13
+
14
+
15
+
16
+
17
+ ## [1.6.8](https://github.com/easyops-cn/next-core/compare/@next-core/cook@1.6.7...@next-core/cook@1.6.8) (2022-01-07)
18
+
19
+ **Note:** Version bump only for package @next-core/cook
20
+
21
+
22
+
23
+
24
+
25
+ ## [1.6.7](https://github.com/easyops-cn/next-core/compare/@next-core/cook@1.6.6...@next-core/cook@1.6.7) (2022-01-05)
26
+
27
+ **Note:** Version bump only for package @next-core/cook
28
+
29
+
30
+
31
+
32
+
33
+ ## [1.6.6](https://github.com/easyops-cn/next-core/compare/@next-core/cook@1.6.5...@next-core/cook@1.6.6) (2021-12-30)
34
+
35
+ **Note:** Version bump only for package @next-core/cook
36
+
37
+
38
+
39
+
40
+
6
41
  ## [1.6.5](https://github.com/easyops-cn/next-core/compare/@next-core/cook@1.6.4...@next-core/cook@1.6.5) (2021-12-29)
7
42
 
8
43
  **Note:** Version bump only for package @next-core/cook
package/dist/cjs/cook.js CHANGED
@@ -776,7 +776,19 @@ function cook(rootAst, codeSource, {
776
776
  getRunningContext().LexicalEnvironment = oldEnv;
777
777
 
778
778
  if (!(0, _contextFree.LoopContinues)(result)) {
779
- return (0, _contextFree.UpdateEmpty)(result, V);
779
+ const status = (0, _contextFree.UpdateEmpty)(result, V);
780
+
781
+ if (!(iterationKind === "enumerate" || iteratorRecord.return === undefined)) {
782
+ // Perform *IteratorClose*
783
+ // https://tc39.es/ecma262/#sec-iteratorclose
784
+ const innerResult = iteratorRecord.return();
785
+
786
+ if (!innerResult || !["object", "function"].includes(typeof innerResult)) {
787
+ throw new TypeError(`Iterator result is not an object`);
788
+ }
789
+ }
790
+
791
+ return status;
780
792
  }
781
793
 
782
794
  if (result.Value !== _ExecutionContext.Empty) {