test262/implementation-contributed/javascriptcore/stress/assignment-in-function-call-bracket-node.js
test262-automation e9a5a7f918 [javascriptcore-test262-automation] changes from git@github.com:WebKit/webkit.git at sha 949e26452cfa153a7f4afe593da97e2fe9e1b706 on Tue Jul 03 2018 14:35:15 GMT-0400 (Eastern Daylight Time) (#1620)
* [javascriptcore-test262-automation] changes from git@github.com:WebKit/webkit.git at sha 949e26452cfa153a7f4afe593da97e2fe9e1b706 on Tue Jul 03 2018 14:35:15 GMT-0400 (Eastern Daylight Time)
2018-07-03 15:59:58 -04:00

127 lines
2.0 KiB
JavaScript

function shouldBe(actual, expected) {
if (actual !== expected)
throw new Error('bad value: ' + actual);
}
// Simple assignment (not FunctionCallBracketNode).
shouldBe(function () {
var object = {
null: 'ok'
};
return object[object = null];
}(), 'ok');
shouldBe(function (value) {
var object = { };
object.null = 'ok';
return object[object = value];
}(null), 'ok');
shouldBe(function () {
var object = {
null: 'ok'
};
return object['null'];
}(), 'ok');
shouldBe(function (value) {
var object = { };
object.null = 'ok';
return object['null'];
}(null), 'ok');
shouldBe(function () {
var object = {
null: 'ok'
};
function fill() {
return object = null;
}
return object[fill()];
}(), 'ok');
shouldBe(function (value) {
var object = { };
object.null = 'ok';
function fill() {
return object = value;
}
return object[fill()];
}(null), 'ok');
// FunctionCallBracketNode.
shouldBe(function () {
var object = {
null: function () {
return 'ok';
}
};
return object[object = null]();
}(), 'ok');
shouldBe(function (value) {
var object = { };
object.null = function () {
return 'ok';
};
return object[object = value]();
}(null), 'ok');
shouldBe(function () {
var object = {
null: function () {
return 'ok';
}
};
return object['null']();
}(), 'ok');
shouldBe(function (value) {
var object = { };
object.null = function () {
return 'ok';
};
return object['null']();
}(null), 'ok');
shouldBe(function () {
var object = {
null: function () {
return 'ok';
}
};
function fill() {
return object = null;
}
return object[fill()]();
}(), 'ok');
shouldBe(function (value) {
var object = { };
object.null = function () {
return 'ok';
};
function fill() {
return object = value;
}
return object[fill()]();
}(null), 'ok');