Debian Codegraph @

js/src/tests/test262/language/eval-code/direct/super-prop-method.js

raw
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-scripts-static-semantics-early-errors
5 es6id: 15.1.1
6 description: >
7 A direct eval in the functon code of a non-ArrowFunction may contain
8 SuperProperty
9 info: |
10 - It is a Syntax Error if StatementList Contains super unless the source code
11 containing super is eval code that is being processed by a direct eval that
12 is contained in function code that is not the function code of an
13 ArrowFunction.
14 features: [super]
15 ---*/
16
17 var superProp = null;
18 var o = {
19 test262: null,
20 method() {
21 superProp = eval('super.test262;');
22 }
23 };
24
25 o.method();
26
27 assert.sameValue(superProp, undefined);
28
29 Object.setPrototypeOf(o, { test262: 262 });
30
31 o.method();
32
33 assert.sameValue(superProp, 262);
34
35 reportCompare(0, 0);