summaryrefslogtreecommitdiff
path: root/test/language/statements/const/dstr-ary-init-iter-get-err.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/language/statements/const/dstr-ary-init-iter-get-err.js')
-rw-r--r--test/language/statements/const/dstr-ary-init-iter-get-err.js35
1 files changed, 35 insertions, 0 deletions
diff --git a/test/language/statements/const/dstr-ary-init-iter-get-err.js b/test/language/statements/const/dstr-ary-init-iter-get-err.js
new file mode 100644
index 000000000..96f4b09bc
--- /dev/null
+++ b/test/language/statements/const/dstr-ary-init-iter-get-err.js
@@ -0,0 +1,35 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-get-err.case
+// - src/dstr-binding/error/const-stmt.template
+/*---
+description: Abrupt completion returned by GetIterator (`const` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+es6id: 13.3.1.4
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ArrayBindingPattern
+
+ 1. Let iterator be GetIterator(value).
+ 2. ReturnIfAbrupt(iterator).
+
+---*/
+var iter = {};
+iter[Symbol.iterator] = function() {
+ throw new Test262Error();
+};
+
+assert.throws(Test262Error, function() {
+ const [x] = iter;
+});