Coverage gaps found by quickjs. Fixes gh-2370

This commit is contained in:
Rick Waldron 2020-08-21 14:53:50 -04:00
parent 378481b041
commit accf91c57d
3 changed files with 27 additions and 17 deletions

View File

@ -27,6 +27,7 @@ assert.sameValue(delete 0, true, 'delete 0');
assert.sameValue(delete 1, true, 'delete 1');
assert.sameValue(delete '', true, 'delete ""');
assert.sameValue(delete 'Test262', true, 'delete "Test262"');
assert.sameValue(delete 'Test262'[100], true, 'delete "Test262"[100]');
assert.sameValue(delete typeof +-~!0, true, 'delete typeof +-~!0');
assert.sameValue(delete +-~!0, true, 'delete +-~!0');
assert.sameValue(delete -~!0, true, 'delete -~!0');

View File

@ -0,0 +1,23 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-delete-operator-runtime-semantics-evaluation
description: Attempts to delete super reference property references throws ReferenceError exception
features: [class]
---*/
class X {
method() { return this; }
}
class Y extends X {
method() {
delete super.method;
}
}
const y = new Y();
assert.throws(ReferenceError, () => {
y.method();
});

View File

@ -2,7 +2,6 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-delete-operator-runtime-semantics-evaluation
es6id: 12.5.4.2
description: SuperReferences may not be deleted
info: |
[...]
@ -11,26 +10,13 @@ info: |
features: [class]
---*/
var caught;
class C extends Object {
constructor() {
super();
try {
delete super.x;
} catch (err) {
caught = err;
}
delete super.x;
}
}
// When the "construct" invocation completes and the "this" value is
// uninitialized, the specification dictates that a ReferenceError must be
// thrown. That behavior is tested elsewhere, so the error is ignored (if it is
// produced at all).
try {
assert.throws(ReferenceError, () => {
new C();
} catch (_) {}
assert.sameValue(typeof caught, 'object');
assert.sameValue(caught.constructor, ReferenceError);
});