From 26a029d407be480d791972afb5975cf62c9360a6 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 02:47:55 +0200 Subject: Adding upstream version 124.0.1. Signed-off-by: Daniel Baumann --- .../language/destructuring/binding/browser.js | 0 ...nitialization-requires-object-coercible-null.js | 24 +++++++++++ ...lization-requires-object-coercible-undefined.js | 24 +++++++++++ ...-returns-normal-completion-for-empty-objects.js | 33 +++++++++++++++ .../language/destructuring/binding/shell.js | 0 .../syntax/array-elements-with-initializer.js | 35 ++++++++++++++++ .../syntax/array-elements-with-object-patterns.js | 37 +++++++++++++++++ .../syntax/array-elements-without-initializer.js | 35 ++++++++++++++++ .../binding/syntax/array-pattern-with-elisions.js | 21 ++++++++++ .../syntax/array-pattern-with-no-elements.js | 20 +++++++++ .../binding/syntax/array-rest-elements.js | 31 ++++++++++++++ .../destructuring/binding/syntax/browser.js | 0 ...g-array-parameters-function-arguments-length.js | 37 +++++++++++++++++ ...-object-parameters-function-arguments-length.js | 37 +++++++++++++++++ .../syntax/object-pattern-with-no-property-list.js | 21 ++++++++++ .../syntax/property-list-bindings-elements.js | 48 ++++++++++++++++++++++ .../property-list-followed-by-a-single-comma.js | 25 +++++++++++ .../syntax/property-list-single-name-bindings.js | 35 ++++++++++++++++ .../syntax/property-list-with-property-list.js | 29 +++++++++++++ .../syntax/recursive-array-and-object-patterns.js | 27 ++++++++++++ .../language/destructuring/binding/syntax/shell.js | 0 21 files changed, 519 insertions(+) create mode 100644 js/src/tests/test262/language/destructuring/binding/browser.js create mode 100644 js/src/tests/test262/language/destructuring/binding/initialization-requires-object-coercible-null.js create mode 100644 js/src/tests/test262/language/destructuring/binding/initialization-requires-object-coercible-undefined.js create mode 100644 js/src/tests/test262/language/destructuring/binding/initialization-returns-normal-completion-for-empty-objects.js create mode 100644 js/src/tests/test262/language/destructuring/binding/shell.js create mode 100644 js/src/tests/test262/language/destructuring/binding/syntax/array-elements-with-initializer.js create mode 100644 js/src/tests/test262/language/destructuring/binding/syntax/array-elements-with-object-patterns.js create mode 100644 js/src/tests/test262/language/destructuring/binding/syntax/array-elements-without-initializer.js create mode 100644 js/src/tests/test262/language/destructuring/binding/syntax/array-pattern-with-elisions.js create mode 100644 js/src/tests/test262/language/destructuring/binding/syntax/array-pattern-with-no-elements.js create mode 100644 js/src/tests/test262/language/destructuring/binding/syntax/array-rest-elements.js create mode 100644 js/src/tests/test262/language/destructuring/binding/syntax/browser.js create mode 100644 js/src/tests/test262/language/destructuring/binding/syntax/destructuring-array-parameters-function-arguments-length.js create mode 100644 js/src/tests/test262/language/destructuring/binding/syntax/destructuring-object-parameters-function-arguments-length.js create mode 100644 js/src/tests/test262/language/destructuring/binding/syntax/object-pattern-with-no-property-list.js create mode 100644 js/src/tests/test262/language/destructuring/binding/syntax/property-list-bindings-elements.js create mode 100644 js/src/tests/test262/language/destructuring/binding/syntax/property-list-followed-by-a-single-comma.js create mode 100644 js/src/tests/test262/language/destructuring/binding/syntax/property-list-single-name-bindings.js create mode 100644 js/src/tests/test262/language/destructuring/binding/syntax/property-list-with-property-list.js create mode 100644 js/src/tests/test262/language/destructuring/binding/syntax/recursive-array-and-object-patterns.js create mode 100644 js/src/tests/test262/language/destructuring/binding/syntax/shell.js (limited to 'js/src/tests/test262/language/destructuring/binding') diff --git a/js/src/tests/test262/language/destructuring/binding/browser.js b/js/src/tests/test262/language/destructuring/binding/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/destructuring/binding/initialization-requires-object-coercible-null.js b/js/src/tests/test262/language/destructuring/binding/initialization-requires-object-coercible-null.js new file mode 100644 index 0000000000..43296aca11 --- /dev/null +++ b/js/src/tests/test262/language/destructuring/binding/initialization-requires-object-coercible-null.js @@ -0,0 +1,24 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 13.3.3.5 +description: > + Cannot convert null argument value to object +info: | + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ObjectBindingPattern + + 1. Let valid be RequireObjectCoercible(value). + 2. ReturnIfAbrupt(valid). +features: [destructuring-binding] +---*/ + +function fn({}) {} + +assert.throws(TypeError, function() { + fn(null); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/destructuring/binding/initialization-requires-object-coercible-undefined.js b/js/src/tests/test262/language/destructuring/binding/initialization-requires-object-coercible-undefined.js new file mode 100644 index 0000000000..b9f16e7825 --- /dev/null +++ b/js/src/tests/test262/language/destructuring/binding/initialization-requires-object-coercible-undefined.js @@ -0,0 +1,24 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 13.3.3.5 +description: > + Cannot convert undefined argument value to object +info: | + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ObjectBindingPattern + + 1. Let valid be RequireObjectCoercible(value). + 2. ReturnIfAbrupt(valid). +features: [destructuring-binding] +---*/ + +function fn({}) {} + +assert.throws(TypeError, function() { + fn(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/destructuring/binding/initialization-returns-normal-completion-for-empty-objects.js b/js/src/tests/test262/language/destructuring/binding/initialization-returns-normal-completion-for-empty-objects.js new file mode 100644 index 0000000000..eddb08694d --- /dev/null +++ b/js/src/tests/test262/language/destructuring/binding/initialization-returns-normal-completion-for-empty-objects.js @@ -0,0 +1,33 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 13.3.3.5 +description: > + Normal completion when initializing an empty ObjectBindingPattern +info: | + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ObjectBindingPattern + + ... + 3. Return the result of performing BindingInitialization for + ObjectBindingPattern using value and environment as arguments. + + ObjectBindingPattern : { } + + 1. Return NormalCompletion(empty). + +features: [destructuring-binding] +---*/ + +function fn({}) { return true; } + +assert(fn(0)); +assert(fn(NaN)); +assert(fn('')); +assert(fn(false)); +assert(fn({})); +assert(fn([])); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/destructuring/binding/shell.js b/js/src/tests/test262/language/destructuring/binding/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/destructuring/binding/syntax/array-elements-with-initializer.js b/js/src/tests/test262/language/destructuring/binding/syntax/array-elements-with-initializer.js new file mode 100644 index 0000000000..c15a868672 --- /dev/null +++ b/js/src/tests/test262/language/destructuring/binding/syntax/array-elements-with-initializer.js @@ -0,0 +1,35 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 13.3.3 +description: > + The ArrayBindingPattern with an element list with initializers +info: | + Destructuring Binding Patterns - Syntax + + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] + + BindingElementList[Yield] : + BindingElisionElement[?Yield] + BindingElementList[?Yield] , BindingElisionElement[?Yield] + + BindingElisionElement[Yield] : + Elisionopt BindingElement[?Yield] + + BindingElement[Yield ] : + SingleNameBinding[?Yield] + BindingPattern[?Yield] Initializer[In, ?Yield]opt +features: [destructuring-binding] +---*/ + +function fn1([a, b = 42]) {} + +function fn2([a = 42, b,]) {} + +function fn3([a,, b = a, c = 42]) {} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/destructuring/binding/syntax/array-elements-with-object-patterns.js b/js/src/tests/test262/language/destructuring/binding/syntax/array-elements-with-object-patterns.js new file mode 100644 index 0000000000..36ee68222c --- /dev/null +++ b/js/src/tests/test262/language/destructuring/binding/syntax/array-elements-with-object-patterns.js @@ -0,0 +1,37 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 13.3.3 +description: > + The ArrayBindingPattern with Object patterns on the element list +info: | + Destructuring Binding Patterns - Syntax + + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] + + BindingElementList[Yield] : + BindingElisionElement[?Yield] + BindingElementList[?Yield] , BindingElisionElement[?Yield] + + BindingElisionElement[Yield] : + Elisionopt BindingElement[?Yield] + + BindingElement[Yield ] : + SingleNameBinding[?Yield] + BindingPattern[?Yield] Initializer[In, ?Yield]opt +features: [destructuring-binding] +---*/ + +function fn1([{}]) {} + +function fn2([{} = 42]) {} + +function fn3([a, {b: c}]) {} + +function fn4([a, {b: []}]) {} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/destructuring/binding/syntax/array-elements-without-initializer.js b/js/src/tests/test262/language/destructuring/binding/syntax/array-elements-without-initializer.js new file mode 100644 index 0000000000..e6b9db3c28 --- /dev/null +++ b/js/src/tests/test262/language/destructuring/binding/syntax/array-elements-without-initializer.js @@ -0,0 +1,35 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 13.3.3 +description: > + The ArrayBindingPattern with an element list without initializers +info: | + Destructuring Binding Patterns - Syntax + + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] + + BindingElementList[Yield] : + BindingElisionElement[?Yield] + BindingElementList[?Yield] , BindingElisionElement[?Yield] + + BindingElisionElement[Yield] : + Elisionopt BindingElement[?Yield] + + BindingElement[Yield ] : + SingleNameBinding[?Yield] + BindingPattern[?Yield] Initializer[In, ?Yield]opt +features: [destructuring-binding] +---*/ + +function fn1([a, b]) {} + +function fn2([a, b,]) {} + +function fn3([a,, b,]) {} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/destructuring/binding/syntax/array-pattern-with-elisions.js b/js/src/tests/test262/language/destructuring/binding/syntax/array-pattern-with-elisions.js new file mode 100644 index 0000000000..c4f7fa32de --- /dev/null +++ b/js/src/tests/test262/language/destructuring/binding/syntax/array-pattern-with-elisions.js @@ -0,0 +1,21 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 13.3.3 +description: > + The ArrayBindingPattern with elisions only +info: | + Destructuring Binding Patterns - Syntax + + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +features: [destructuring-binding] +---*/ + +function fn1([,]) {} +function fn2([,,]) {} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/destructuring/binding/syntax/array-pattern-with-no-elements.js b/js/src/tests/test262/language/destructuring/binding/syntax/array-pattern-with-no-elements.js new file mode 100644 index 0000000000..38093c9bf7 --- /dev/null +++ b/js/src/tests/test262/language/destructuring/binding/syntax/array-pattern-with-no-elements.js @@ -0,0 +1,20 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 13.3.3 +description: > + The ArrayBindingPattern with no elements +info: | + Destructuring Binding Patterns - Syntax + + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +features: [destructuring-binding] +---*/ + +function fn([]) {} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/destructuring/binding/syntax/array-rest-elements.js b/js/src/tests/test262/language/destructuring/binding/syntax/array-rest-elements.js new file mode 100644 index 0000000000..ba576db483 --- /dev/null +++ b/js/src/tests/test262/language/destructuring/binding/syntax/array-rest-elements.js @@ -0,0 +1,31 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 13.3.3 +description: > + Array Binding Pattern with Rest Element +info: | + Destructuring Binding Patterns - Syntax + + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] + + BindingRestElement[Yield] : + ... BindingIdentifier[?Yield] +features: [destructuring-binding] +---*/ + +function fn1([...args]) {} + +function fn2([,,,,,,,...args]) {} + +function fn3([x, {y}, ...z]) {} + +function fn4([,x, {y}, , ...z]) {} + +function fn5({x: [...y]}) {} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/destructuring/binding/syntax/browser.js b/js/src/tests/test262/language/destructuring/binding/syntax/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/destructuring/binding/syntax/destructuring-array-parameters-function-arguments-length.js b/js/src/tests/test262/language/destructuring/binding/syntax/destructuring-array-parameters-function-arguments-length.js new file mode 100644 index 0000000000..3ea3b59a00 --- /dev/null +++ b/js/src/tests/test262/language/destructuring/binding/syntax/destructuring-array-parameters-function-arguments-length.js @@ -0,0 +1,37 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-destructuring-binding-patterns-static-semantics-hasinitializer +description: > + Function.length when ArrayBindingPattern in FormalParameterList +info: | + #sec-function-definitions-static-semantics-expectedargumentcount + + Static Semantics: ExpectedArgumentCount + + FormalParameterList : FormalParameter + + 1. If HasInitializer of FormalParameter is true, return 0. + 2. Return 1. + + #sec-destructuring-binding-patterns-static-semantics-hasinitializer + + Static Semantics: HasInitializer + + BindingElement : BindingPattern + + 1. Return false. + +features: [destructuring-binding] +---*/ + +assert.sameValue((([a,b]) => {}).length, 1); +assert.sameValue((function([a,b]) {}).length, 1); +assert.sameValue((function * ([a,b]) {}).length, 1); +assert.sameValue((async ([a,b]) => {}).length, 1); +assert.sameValue((async function([a,b]) {}).length, 1); +assert.sameValue((async function * ([a,b]) {}).length, 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/destructuring/binding/syntax/destructuring-object-parameters-function-arguments-length.js b/js/src/tests/test262/language/destructuring/binding/syntax/destructuring-object-parameters-function-arguments-length.js new file mode 100644 index 0000000000..eb9088102a --- /dev/null +++ b/js/src/tests/test262/language/destructuring/binding/syntax/destructuring-object-parameters-function-arguments-length.js @@ -0,0 +1,37 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-destructuring-binding-patterns-static-semantics-hasinitializer +description: > + Function.length when ObjectBindingPattern in FormalParameterList +info: | + #sec-function-definitions-static-semantics-expectedargumentcount + + Static Semantics: ExpectedArgumentCount + + FormalParameterList : FormalParameter + + 1. If HasInitializer of FormalParameter is true, return 0. + 2. Return 1. + + #sec-destructuring-binding-patterns-static-semantics-hasinitializer + + Static Semantics: HasInitializer + + BindingElement : BindingPattern + + 1. Return false. + +features: [destructuring-binding] +---*/ + +assert.sameValue((({a,b}) => {}).length, 1); +assert.sameValue((function({a,b}) {}).length, 1); +assert.sameValue((function * ({a,b}) {}).length, 1); +assert.sameValue((async ({a,b}) => {}).length, 1); +assert.sameValue((async function({a,b}) {}).length, 1); +assert.sameValue((async function * ({a,b}) {}).length, 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/destructuring/binding/syntax/object-pattern-with-no-property-list.js b/js/src/tests/test262/language/destructuring/binding/syntax/object-pattern-with-no-property-list.js new file mode 100644 index 0000000000..3114bf12d3 --- /dev/null +++ b/js/src/tests/test262/language/destructuring/binding/syntax/object-pattern-with-no-property-list.js @@ -0,0 +1,21 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 13.3.3 +description: > + The ObjectBindingPattern can be `{ }` +info: | + Destructuring Binding Patterns - Syntax + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } + +features: [destructuring-binding] +---*/ + +function fn({}) {} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/destructuring/binding/syntax/property-list-bindings-elements.js b/js/src/tests/test262/language/destructuring/binding/syntax/property-list-bindings-elements.js new file mode 100644 index 0000000000..a5e2aae653 --- /dev/null +++ b/js/src/tests/test262/language/destructuring/binding/syntax/property-list-bindings-elements.js @@ -0,0 +1,48 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 13.3.3 +description: > + The ObjectBindingPattern with binding elements +info: | + Destructuring Binding Patterns - Syntax + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } + + BindingPropertyList[Yield] : + BindingProperty[?Yield] + BindingPropertyList[?Yield] , BindingProperty[?Yield] + + BindingProperty[Yield] : + SingleNameBinding[?Yield] + PropertyName[?Yield] : BindingElement[?Yield] + + BindingElement[Yield ] : + SingleNameBinding[?Yield] + BindingPattern[?Yield] Initializer[In, ?Yield]opt + + SingleNameBinding[Yield] : + BindingIdentifier[?Yield] Initializer[In, ?Yield]opt + +features: [destructuring-binding] +---*/ + +// BindingElement w/ SingleNameBinding +function fna({x: y}) {} + +// BindingElement w/ SingleNameBinding with initializer +function fnb({x: y = 42}) {} + +// BindingElement w/ BindingPattern +function fnc({x: {}}) {} +function fnd({x: {y}}) {} + +// BindingElement w/ BindingPattern w/ initializer +function fne({x: {} = 42}) {} +function fnf({x: {y} = 42}) {} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/destructuring/binding/syntax/property-list-followed-by-a-single-comma.js b/js/src/tests/test262/language/destructuring/binding/syntax/property-list-followed-by-a-single-comma.js new file mode 100644 index 0000000000..cd280360fa --- /dev/null +++ b/js/src/tests/test262/language/destructuring/binding/syntax/property-list-followed-by-a-single-comma.js @@ -0,0 +1,25 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 13.3.3 +description: > + The Binding Property List followed by a single comma is a valid syntax +info: | + Destructuring Binding Patterns - Syntax + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } + +features: [destructuring-binding] +---*/ + +function fn1({x,}) {} + +function fn2({a: {p: q, }, }) {} + +function fn3({x,}) {} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/destructuring/binding/syntax/property-list-single-name-bindings.js b/js/src/tests/test262/language/destructuring/binding/syntax/property-list-single-name-bindings.js new file mode 100644 index 0000000000..6719019ca1 --- /dev/null +++ b/js/src/tests/test262/language/destructuring/binding/syntax/property-list-single-name-bindings.js @@ -0,0 +1,35 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 13.3.3 +description: > + The ObjectBindingPattern with a simple property list and single name binding +info: | + Destructuring Binding Patterns - Syntax + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } + + BindingPropertyList[Yield] : + BindingProperty[?Yield] + BindingPropertyList[?Yield] , BindingProperty[?Yield] + + BindingProperty[Yield] : + SingleNameBinding[?Yield] + PropertyName[?Yield] : BindingElement[?Yield] + + SingleNameBinding[Yield] : + BindingIdentifier[?Yield] Initializer[In, ?Yield]opt + +features: [destructuring-binding] +---*/ + +function fna({x}) {} +function fnb({x, y}) {} +function fnc({x = 42}) {} +function fnd({x, y = 42}) {} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/destructuring/binding/syntax/property-list-with-property-list.js b/js/src/tests/test262/language/destructuring/binding/syntax/property-list-with-property-list.js new file mode 100644 index 0000000000..af6f3d7a3a --- /dev/null +++ b/js/src/tests/test262/language/destructuring/binding/syntax/property-list-with-property-list.js @@ -0,0 +1,29 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 13.3.3 +description: > + The ObjectBindingPattern with deep binding property lists +info: | + Destructuring Binding Patterns - Syntax + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } + + BindingPropertyList[Yield] : + BindingProperty[?Yield] + BindingPropertyList[?Yield] , BindingProperty[?Yield] + +features: [destructuring-binding] +---*/ + +function fn1({a: {p: q}, b: {r}, c: {s = 0}, d: {}}) {} + +function fn2(x, {a: r, b: s, c: t}, y) {} + +function fn3({x: {y: {z: {} = 42}}}) {} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/destructuring/binding/syntax/recursive-array-and-object-patterns.js b/js/src/tests/test262/language/destructuring/binding/syntax/recursive-array-and-object-patterns.js new file mode 100644 index 0000000000..60226bde4d --- /dev/null +++ b/js/src/tests/test262/language/destructuring/binding/syntax/recursive-array-and-object-patterns.js @@ -0,0 +1,27 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 13.3.3 +description: > + Recursive array and object binding patterns +info: | + Destructuring Binding Patterns - Syntax + + BindingPattern[Yield] : + ObjectBindingPattern[?Yield] + ArrayBindingPattern[?Yield] +features: [destructuring-binding] +---*/ + +function fn1([{}]) {} + +function fn2([{a: [{}]}]) {} + +function fn3({a: [,,,] = 42}) {} + +function fn4([], [[]], [[[[[[[[[x]]]]]]]]]) {} + +function fn4([[x, y, ...z]]) {} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/destructuring/binding/syntax/shell.js b/js/src/tests/test262/language/destructuring/binding/syntax/shell.js new file mode 100644 index 0000000000..e69de29bb2 -- cgit v1.2.3