Add unscopables check to ecma_op_get_value_lex_env_base (#3476)

Also added a special test case for this to symbol-unscopables.js

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
This commit is contained in:
Szilagyi Adam
2020-01-07 15:13:28 +01:00
committed by Robert Fancsik
parent 003694d259
commit aedd55b1f8
4 changed files with 43 additions and 1 deletions
+18
View File
@@ -70,6 +70,17 @@ with (obj2) {
}
}
var obj3 = { foo: 12 };
Object.defineProperty(obj3, Symbol.unscopables, { get: function () { throw 42; } });
with (obj3) {
try {
typeof foo;
} catch (e) {
assert(e === 42);
}
}
var symbol_obj = Array.prototype[Symbol.unscopables];
assert(symbol_obj.copyWithin === true);
assert(symbol_obj.entries === true);
@@ -86,3 +97,10 @@ assert(obj3.value === true);
assert(obj3.writable === true);
assert(obj3.enumerable == true);
assert(obj3.configurable == true);
var a = { foo: 1, bar: 2 };
a[Symbol.unscopables] = { bar: true };
with (a) {
assert(foo === 1);
assert(typeof bar === "undefined");
}