| 1 |
// Copyright (C) 2016 the V8 project authors. All rights reserved. |
| 2 |
// This code is governed by the BSD license found in the LICENSE file. |
| 3 |
/*--- |
| 4 |
esid: sec-delete-operator-runtime-semantics-evaluation |
| 5 |
es6id: 12.5.4.2 |
| 6 |
description: SuperReferences may not be deleted |
| 7 |
info: | |
| 8 |
[...] |
| 9 |
5.If IsPropertyReference(ref) is true, then |
| 10 |
a. If IsSuperReference(ref) is true, throw a ReferenceError exception. |
| 11 |
features: [class] |
| 12 |
---*/ |
| 13 |
|
| 14 |
var caught; |
| 15 |
|
| 16 |
class C extends Object { |
| 17 |
constructor() { |
| 18 |
try { |
| 19 |
delete super.x; |
| 20 |
} catch (err) { |
| 21 |
caught = err; |
| 22 |
} |
| 23 |
} |
| 24 |
} |
| 25 |
|
| 26 |
// When the "construct" invocation completes and the "this" value is |
| 27 |
// uninitialized, the specification dictates that a ReferenceError must be |
| 28 |
// thrown. That behavior is tested elsewhere, so the error is ignored (if it is |
| 29 |
// produced at all). |
| 30 |
try { |
| 31 |
new C(); |
| 32 |
} catch (_) {} |
| 33 |
|
| 34 |
assert.sameValue(typeof caught, 'object'); |
| 35 |
assert.sameValue(caught.constructor, ReferenceError); |