diff --git a/Userland/Libraries/LibJS/Bytecode/Generator.cpp b/Userland/Libraries/LibJS/Bytecode/Generator.cpp index 91f97d567c..2a11de594a 100644 --- a/Userland/Libraries/LibJS/Bytecode/Generator.cpp +++ b/Userland/Libraries/LibJS/Bytecode/Generator.cpp @@ -268,7 +268,10 @@ CodeGenerationErrorOr> Generator::emit_l } return Optional {}; } - VERIFY_NOT_REACHED(); + return CodeGenerationError { + &node, + "Unimplemented/invalid node used a reference"sv + }; } CodeGenerationErrorOr Generator::emit_store_to_reference(JS::ASTNode const& node) diff --git a/Userland/Libraries/LibJS/Tests/invalid-lhs-in-assignment.js b/Userland/Libraries/LibJS/Tests/invalid-lhs-in-assignment.js index ad329dc826..7f753cad14 100644 --- a/Userland/Libraries/LibJS/Tests/invalid-lhs-in-assignment.js +++ b/Userland/Libraries/LibJS/Tests/invalid-lhs-in-assignment.js @@ -5,6 +5,13 @@ test.xfail("assignment to function call", () => { }).toThrowWithMessage(ReferenceError, "Invalid left-hand side in assignment"); }); +test.xfail("Postfix operator after function call", () => { + expect(() => { + function foo() {} + foo()++; + }).toThrow(ReferenceError); +}); + test("assignment to function call in strict mode", () => { expect("'use strict'; foo() = 'foo'").toEval(); });