-
Notifications
You must be signed in to change notification settings - Fork 464
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Update test for o[p] = f() Update S11.13.1_A7_T3.js now that consensus has been reached on tc39/ecma262#3307. * Rename test and add an analogous one for super.
- Loading branch information
Showing
3 changed files
with
87 additions
and
26 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
40 changes: 40 additions & 0 deletions
40
test/language/expressions/assignment/target-member-computed-reference.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// Copyright (C) 2015 André Bargull. All rights reserved. | ||
// Copyright (C) 2024 Sony Interactive Entertainment Inc. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
/*--- | ||
esid: sec-assignment-operators | ||
description: Assignment Operator evaluates its operands from left to right (formerly S11.13.1_A7_T3) | ||
info: | | ||
The left-hand side expression is evaluated before the right-hand side. | ||
Left-hand side expression is MemberExpression: base[prop]. | ||
ToPropertyKey(prop) occurs after both sides are evaluated. | ||
---*/ | ||
|
||
function DummyError() { } | ||
|
||
assert.throws(DummyError, function() { | ||
var base = {}; | ||
var prop = function() { | ||
throw new DummyError(); | ||
}; | ||
var expr = function() { | ||
throw new Test262Error("right-hand side expression evaluated"); | ||
}; | ||
|
||
base[prop()] = expr(); | ||
}); | ||
|
||
assert.throws(DummyError, function() { | ||
var base = {}; | ||
var prop = { | ||
toString: function() { | ||
throw new Test262Error("property key evaluated"); | ||
} | ||
}; | ||
var expr = function() { | ||
throw new DummyError(); | ||
}; | ||
|
||
base[prop] = expr(); | ||
}); |
47 changes: 47 additions & 0 deletions
47
test/language/expressions/assignment/target-super-computed-reference.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// Copyright (C) 2024 Sony Interactive Entertainment Inc. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
/*--- | ||
esid: sec-assignment-operators | ||
description: Assignment Operator evaluates its operands from left to right | ||
info: | | ||
The left-hand side expression is evaluated before the right-hand side. | ||
Left-hand side expression is MemberExpression: super[prop]. | ||
ToPropertyKey(prop) occurs after both sides are evaluated. | ||
---*/ | ||
|
||
assert.throws(DummyError, function() { | ||
var prop = function() { | ||
throw new DummyError(); | ||
}; | ||
var expr = function() { | ||
throw new Test262Error("right-hand side expression evaluated"); | ||
}; | ||
|
||
class C extends class {} { | ||
m() { | ||
super[prop()] = expr(); | ||
} | ||
} | ||
|
||
(new C()).m(); | ||
}); | ||
|
||
assert.throws(DummyError, function() { | ||
var prop = { | ||
toString: function() { | ||
throw new Test262Error("property key evaluated"); | ||
} | ||
}; | ||
var expr = function() { | ||
throw new DummyError(); | ||
}; | ||
|
||
class C extends class {} { | ||
m() { | ||
super[prop] = expr(); | ||
} | ||
} | ||
|
||
(new C()).m(); | ||
}); |