Debian Codegraph @

js/src/tests/test262/language/statements/class/elements/fields-asi-5.js

raw
1 // Copyright (C) 2017 Valerie Young. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3
4 /*---
5 description: ASI test in field declarations -- field with PropertyName "in" interpreted as index
6 esid: sec-automatic-semicolon-insertion
7 features: [class, class-fields-public]
8 ---*/
9
10 var x = 0;
11 var y = 1;
12 var z = [42];
13
14 class C {
15 a = x
16 in
17 z
18 b = y
19 in
20 z
21 }
22
23 var c = new C();
24
25 assert.sameValue(c.a, true, 'a = x in z');
26 assert.sameValue(c.b, false, 'b = y in z');
27 assert(!Object.prototype.hasOwnProperty.call(c, "in"), "'in' is not parsed as a field declaration");
28 assert(!Object.prototype.hasOwnProperty.call(c, "z"), "'z' is not parsed as a field declaration");
29
30 reportCompare(0, 0);