diff options
author | Andreas Kling <kling@serenityos.org> | 2021-06-25 16:27:59 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-06-25 16:58:36 +0200 |
commit | bce7fdba8117a82b832063645210df3fbb8614ea (patch) | |
tree | 83d0edd2fa343757f5b787ba608ced0f0d812e6a /Userland/Libraries/LibJS/Tests/strict-mode-errors.js | |
parent | 6e1932e8b2e5ff10854f08e69b9c5cc7032ae30e (diff) | |
download | serenity-bce7fdba8117a82b832063645210df3fbb8614ea.zip |
LibJS: Bring Reference records a bit closer to the ECMAScript spec
Our Reference class now has the same fields as the spec:
- Base (a non-nullish value, an environment record, or `unresolvable`)
- Referenced Name (the name of the binding)
- Strict (whether the reference originated in strict mode code)
- ThisValue (if non-empty, the reference represents a `super` keyword)
The main difference from before is that we now resolve the environment
record that a reference interacts with. Previously we simply resolved
to either "local variable" or "global variable".
The associated abstract operations are still largely non-conforming,
since we don't yet implement proper variable bindings. But this patch
should at least fix a handful of test262 cases. :^)
There's one minor regression: some TypeError message strings get
a little worse due to doing a RequireObjectCoercible earlier in the
evaluation of MemberExpression.
Diffstat (limited to 'Userland/Libraries/LibJS/Tests/strict-mode-errors.js')
-rw-r--r-- | Userland/Libraries/LibJS/Tests/strict-mode-errors.js | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/Userland/Libraries/LibJS/Tests/strict-mode-errors.js b/Userland/Libraries/LibJS/Tests/strict-mode-errors.js index 8c8d756c4f..acbe586500 100644 --- a/Userland/Libraries/LibJS/Tests/strict-mode-errors.js +++ b/Userland/Libraries/LibJS/Tests/strict-mode-errors.js @@ -18,12 +18,9 @@ test("basic functionality", () => { [null, undefined].forEach(primitive => { expect(() => { primitive.foo = "bar"; - }).toThrowWithMessage(TypeError, `Cannot set property 'foo' of ${primitive}`); + }).toThrowWithMessage(TypeError, `${primitive} cannot be converted to an object`); expect(() => { primitive[Symbol.hasInstance] = 123; - }).toThrowWithMessage( - TypeError, - `Cannot set property 'Symbol(Symbol.hasInstance)' of ${primitive}` - ); + }).toThrowWithMessage(TypeError, `${primitive} cannot be converted to an object`); }); }); |