You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Oct 15, 2020. It is now read-only.
Includes following bug fix in chakracore that was observed in
4e46931 changes to `node.js`.
* Fix to enable `{get}` as valid object literal. See chakra-core/ChakraCore#320
Copy file name to clipboardExpand all lines: deps/chakrashim/core/test/es6/destructuring_obj.js
+18-1Lines changed: 18 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -165,9 +165,26 @@ var tests = [
165
165
assert.throws(function(){eval("for(var [z] = function ([a]) { } in []) {}");},SyntaxError,"Initializer as function expression is not valid syntax","for-in loop head declarations cannot have an initializer");
166
166
}
167
167
},
168
+
{
169
+
name: "Object destructuring with `get` and `set` identifiers",
170
+
body: function(){
171
+
var{ get }={get: 1};
172
+
let{ set }={set: 2};
173
+
assert.areEqual(1,get,"`get` is a valid object destructuring name");
174
+
assert.areEqual(2,set,"`set` is a valid object destructuring name");
175
+
176
+
assert.throws(function(){eval("var { get foo() { } } = { get: 1 };");},SyntaxError,"getter accessor is not a valid object destructuring name","Invalid destructuring assignment target");
177
+
assert.throws(function(){eval("var { set bar(x) { } } = { set: 2 };");},SyntaxError,"setter accessor is not a valid object destructuring name","Invalid destructuring assignment target");
178
+
179
+
const{get: x}={get: 3};
180
+
var{set: y}={set: 4};
181
+
assert.areEqual(3,x,"`get` is a valid object destructuring name mapping");
182
+
assert.areEqual(4,y,"`set` is a valid object destructuring name mapping");
0 commit comments