mirror of https://github.com/tc39/test262.git
Add test for abrupt completion from HasBinding
Ensure that when HasBinding of an Object environment record returns an abrupt completion, that same completion is returned to the runtime. Update the meta-data of related tests for consistency with this new test.
This commit is contained in:
parent
10e4bdf0b6
commit
6a3837fc0f
|
@ -0,0 +1,36 @@
|
|||
// Copyright (c) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-getidentifierreference
|
||||
es6id: 8.1.2.1
|
||||
description: >
|
||||
Behavior when binding query produces an abrupt completion
|
||||
info: |
|
||||
[...]
|
||||
2. Let envRec be lex's EnvironmentRecord.
|
||||
3. Let exists be ? envRec.HasBinding(name).
|
||||
|
||||
8.1.1.2.1 HasBinding
|
||||
|
||||
1. Let envRec be the object Environment Record for which the method was
|
||||
invoked.
|
||||
2. Let bindings be the binding object for envRec.
|
||||
3. Let foundBinding be ? HasProperty(bindings, N).
|
||||
flags: [noStrict]
|
||||
features: [Proxy]
|
||||
---*/
|
||||
|
||||
var thrower = new Proxy({}, {
|
||||
has: function(_, name) {
|
||||
if (name === 'test262') {
|
||||
throw new Test262Error();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
with (thrower) {
|
||||
assert.throws(Test262Error, function() {
|
||||
test262;
|
||||
});
|
||||
}
|
|
@ -2,18 +2,25 @@
|
|||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
es6id: 8.1.1.2.1
|
||||
esid: sec-getidentifierreference
|
||||
es6id: 8.1.2.1
|
||||
description: >
|
||||
Behavior when accessing `Symbol.unscopables` property value throws an error
|
||||
info: >
|
||||
info: |
|
||||
[...]
|
||||
6. If the withEnvironment flag of envRec is false, return true.
|
||||
7. Let unscopables be Get(bindings, @@unscopables).
|
||||
8. ReturnIfAbrupt(unscopables).
|
||||
2. Let envRec be lex's EnvironmentRecord.
|
||||
3. Let exists be ? envRec.HasBinding(name).
|
||||
|
||||
8.1.1.2.1 HasBinding
|
||||
|
||||
ES6: 13.11.7 (The `with` Statement) Runtime Semantics: Evaluation
|
||||
[...]
|
||||
6. Set the withEnvironment flag of newEnv’s EnvironmentRecord to true.
|
||||
5. If the withEnvironment flag of envRec is false, return true.
|
||||
6. Let unscopables be ? Get(bindings, @@unscopables).
|
||||
|
||||
13.11.7 (The `with` Statement) Runtime Semantics: Evaluation
|
||||
|
||||
[...]
|
||||
5. Set the withEnvironment flag of newEnv’s EnvironmentRecord to true.
|
||||
[...]
|
||||
flags: [noStrict]
|
||||
features: [Symbol.unscopables]
|
||||
|
@ -28,6 +35,6 @@ Object.defineProperty(env, Symbol.unscopables, {
|
|||
|
||||
with (env) {
|
||||
assert.throws(Test262Error, function() {
|
||||
void x;
|
||||
x;
|
||||
});
|
||||
}
|
||||
|
|
|
@ -2,20 +2,28 @@
|
|||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
es6id: 8.1.1.2.1
|
||||
esid: sec-getidentifierreference
|
||||
es6id: 8.1.2.1
|
||||
description: >
|
||||
`Symbol.unscopables` is not referenced when environment record does not have requested property
|
||||
info: >
|
||||
`Symbol.unscopables` is not referenced when environment record does not have
|
||||
requested property
|
||||
info: |
|
||||
[...]
|
||||
2. Let envRec be lex's EnvironmentRecord.
|
||||
3. Let exists be ? envRec.HasBinding(name).
|
||||
|
||||
8.1.1.2.1 HasBinding
|
||||
|
||||
1. Let envRec be the object Environment Record for which the method was
|
||||
invoked.
|
||||
2. Let bindings be the binding object for envRec.
|
||||
3. Let foundBinding be HasProperty(bindings, N)
|
||||
4. ReturnIfAbrupt(foundBinding).
|
||||
5. If foundBinding is false, return false.
|
||||
3. Let foundBinding be ? HasProperty(bindings, N).
|
||||
4. If foundBinding is false, return false.
|
||||
|
||||
13.11.7 (The `with` Statement) Runtime Semantics: Evaluation
|
||||
|
||||
ES6: 13.11.7 (The `with` Statement) Runtime Semantics: Evaluation
|
||||
[...]
|
||||
6. Set the withEnvironment flag of newEnv’s EnvironmentRecord to true.
|
||||
5. Set the withEnvironment flag of newEnv’s EnvironmentRecord to true.
|
||||
[...]
|
||||
flags: [noStrict]
|
||||
features: [Symbol.unscopables]
|
||||
|
@ -31,7 +39,7 @@ Object.defineProperty(env, Symbol.unscopables, {
|
|||
});
|
||||
|
||||
with (env) {
|
||||
void x;
|
||||
x;
|
||||
}
|
||||
|
||||
assert.sameValue(callCount, 0);
|
||||
|
|
|
@ -2,21 +2,29 @@
|
|||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
es6id: 8.1.1.2.1
|
||||
esid: sec-getidentifierreference
|
||||
es6id: 8.1.2.1
|
||||
description: >
|
||||
Behavior when accessing property of `Symbol.unscopables` property throws an error
|
||||
info: >
|
||||
Behavior when accessing property of `Symbol.unscopables` property throws an
|
||||
error
|
||||
info: |
|
||||
[...]
|
||||
6. If the withEnvironment flag of envRec is false, return true.
|
||||
7. Let unscopables be Get(bindings, @@unscopables).
|
||||
8. ReturnIfAbrupt(unscopables).
|
||||
9. If Type(unscopables) is Object, then
|
||||
a. Let blocked be ToBoolean(Get(unscopables, N)).
|
||||
b. ReturnIfAbrupt(blocked).
|
||||
2. Let envRec be lex's EnvironmentRecord.
|
||||
3. Let exists be ? envRec.HasBinding(name).
|
||||
|
||||
8.1.1.2.1 HasBinding
|
||||
|
||||
ES6: 13.11.7 (The `with` Statement) Runtime Semantics: Evaluation
|
||||
[...]
|
||||
6. Set the withEnvironment flag of newEnv’s EnvironmentRecord to true.
|
||||
5. If the withEnvironment flag of envRec is false, return true.
|
||||
6. Let unscopables be ? Get(bindings, @@unscopables).
|
||||
7. If Type(unscopables) is Object, then
|
||||
a. Let blocked be ToBoolean(? Get(unscopables, N)).
|
||||
b. If blocked is true, return false.
|
||||
|
||||
13.11.7 (The `with` Statement) Runtime Semantics: Evaluation
|
||||
|
||||
[...]
|
||||
5. Set the withEnvironment flag of newEnv’s EnvironmentRecord to true.
|
||||
[...]
|
||||
flags: [noStrict]
|
||||
features: [Symbol.unscopables]
|
||||
|
@ -33,6 +41,6 @@ Object.defineProperty(env[Symbol.unscopables], 'x', {
|
|||
|
||||
with (env) {
|
||||
assert.throws(Test262Error, function() {
|
||||
void x;
|
||||
x;
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue