Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(159)

Side by Side Diff: test/mjsunit/harmony/class-privates-errors.js

Issue 2329703002: Private fields
Patch Set: some comments Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // Flags: --harmony-private-class-fields
6
7 // Adding the same property twice
8 // TODO(bakkot) instantiating 'Base' should be an error
9 {
10 class Base {
11 constructor() { return new Derived; }
12 }
13
14 class Derived extends Base {
15 #a = 0;
16 }
17 }
18
19 // Deleting a private field
20 // TODO(bakkot) each of these lines should be a syntax error
21 {
22 class C { #a; m(){ delete #a; } }
23 class D { #a; m(){ delete this.#a; } }
24 }
25
26 // Referencing a private field outside a class
27 // TODO(bakkot) this is not spec'd to be a syntax error, but should be
28 {
29 () => #a;
30 () => this.#a;
31 }
32
33 // Referencing a private field inside a class which doesn't declare it
34 // TODO(bakkot) it is unclear whether or not this will be an error, see
35 // https://github.com/tc39/proposal-private-fields/issues/49
36 {
37 class C {
38 #a;
39 m(){ #b; }
40 }
41 }
42
43 // Referencing a private field through 'eval'
44 // TODO(bakkot) it is unclear whether or not this will be an error, see
45 // https://github.com/tc39/proposal-private-fields/issues/47
46 {
47 class C {
48 #a = 0;
49 m() { return eval('#a'); }
50 }
51 let c = new C;
52 assertEquals(0, c.m());
53 }
OLDNEW
« no previous file with comments | « test/mjsunit/harmony/class-privates-delete.js ('k') | test/mjsunit/harmony/class-privates-evaluation-order.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698