Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/language/computed-property-names/object/method/super.js

raw
1 // Copyright (C) 2014 the V8 project authors. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3 /*---
4 es6id: 12.2.5
5 description: >
6 computed property methods can call super methods
7 ---*/
8
9 function ID(x) {
10 return x;
11 }
12
13 var proto = {
14 m() {
15 return ' proto m';
16 }
17 };
18 var object = {
19 ['a']() { return 'a' + super.m(); },
20 [ID('b')]() { return 'b' + super.m(); },
21 [0]() { return '0' + super.m(); },
22 [ID(1)]() { return '1' + super.m(); },
23 };
24
25 Object.setPrototypeOf(object, proto);
26
27 assert.sameValue(object.a(), 'a proto m', "`object.a()` returns `'a proto m'`, after executing `Object.setPrototypeOf(object, proto);`");
28 assert.sameValue(object.b(), 'b proto m', "`object.b()` returns `'b proto m'`, after executing `Object.setPrototypeOf(object, proto);`");
29 assert.sameValue(object[0](), '0 proto m', "`object[0]()` returns `'0 proto m'`, after executing `Object.setPrototypeOf(object, proto);`");
30 assert.sameValue(object[1](), '1 proto m', "`object[1]()` returns `'1 proto m'`, after executing `Object.setPrototypeOf(object, proto);`");