diff --git a/Libraries/LibJS/Bytecode/Generator.cpp b/Libraries/LibJS/Bytecode/Generator.cpp index f4c99673a1c..dcd7b04efa4 100644 --- a/Libraries/LibJS/Bytecode/Generator.cpp +++ b/Libraries/LibJS/Bytecode/Generator.cpp @@ -812,7 +812,7 @@ CodeGenerationErrorOr> Generator::emit_delete_reference( emit(dst, *super_reference.base, *super_reference.this_value, identifier_table_ref); } - return Optional {}; + return dst; } auto object = TRY(expression.object().generate_bytecode(*this)).value(); diff --git a/Libraries/LibJS/Tests/operators/delete-basic.js b/Libraries/LibJS/Tests/operators/delete-basic.js index f41269c5fc9..fc6d58b057a 100644 --- a/Libraries/LibJS/Tests/operators/delete-basic.js +++ b/Libraries/LibJS/Tests/operators/delete-basic.js @@ -93,6 +93,13 @@ test("deleting super property", () => { } } + class D { + static foo() { + const deleter = () => delete super.foo; + deleter(); + } + } + const obj = new B(); expect(() => { obj.bar(); @@ -106,6 +113,10 @@ test("deleting super property", () => { expect(() => { C.foo(); }).toThrowWithMessage(ReferenceError, "Can't delete a property on 'super'"); + + expect(() => { + D.foo(); + }).toThrowWithMessage(ReferenceError, "Can't delete a property on 'super'"); }); test("deleting an object computed property coerces the object to a property key", () => {