OLD | NEW |
| (Empty) |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | |
2 // for details. All rights reserved. Use of this source code is governed by a | |
3 // BSD-style license that can be found in the LICENSE.md file. | |
4 | |
5 class Foo { | |
6 static const staticConstant = 42; | |
7 static var staticField = 42; | |
8 static staticFunction() {} | |
9 | |
10 static get staticGetter => null; | |
11 static set staticSetter(_) {} | |
12 } | |
13 | |
14 use(x) { | |
15 if (x == new DateTime.now().millisecondsSinceEpoch) throw "Shouldn't happen"; | |
16 } | |
17 | |
18 main() { | |
19 try { | |
20 Foo.staticConstant; | |
21 use(Foo.staticConstant); | |
22 Foo.staticField; | |
23 use(Foo.staticField); | |
24 Foo.staticFunction; | |
25 use(Foo.staticFunction); | |
26 Foo.staticGetter; | |
27 use(Foo.staticGetter); | |
28 Foo.staticSetter; | |
29 use(Foo.staticSetter); | |
30 | |
31 Foo.staticConstant++; | |
32 use(Foo.staticConstant++); | |
33 Foo.staticField++; | |
34 use(Foo.staticField++); | |
35 Foo.staticFunction++; | |
36 use(Foo.staticFunction++); | |
37 Foo.staticGetter++; | |
38 use(Foo.staticGetter++); | |
39 Foo.staticSetter++; | |
40 use(Foo.staticSetter++); | |
41 | |
42 ++Foo.staticConstant; | |
43 use(++Foo.staticConstant); | |
44 ++Foo.staticField; | |
45 use(++Foo.staticField); | |
46 ++Foo.staticFunction; | |
47 use(++Foo.staticFunction); | |
48 ++Foo.staticGetter; | |
49 use(++Foo.staticGetter); | |
50 ++Foo.staticSetter; | |
51 use(++Foo.staticSetter); | |
52 | |
53 Foo.staticConstant(); | |
54 use(Foo.staticConstant()); | |
55 Foo.staticField(); | |
56 use(Foo.staticField()); | |
57 Foo.staticFunction(); | |
58 use(Foo.staticFunction()); | |
59 Foo.staticGetter(); | |
60 use(Foo.staticGetter()); | |
61 Foo.staticSetter(); | |
62 use(Foo.staticSetter()); | |
63 | |
64 Foo.staticConstant = 87; | |
65 use(Foo.staticConstant = 87); | |
66 Foo.staticField = 87; | |
67 use(Foo.staticField = 87); | |
68 Foo.staticFunction = 87; | |
69 use(Foo.staticFunction = 87); | |
70 Foo.staticGetter = 87; | |
71 use(Foo.staticGetter = 87); | |
72 Foo.staticSetter = 87; | |
73 use(Foo.staticSetter = 87); | |
74 | |
75 Foo.staticConstant ??= 87; | |
76 use(Foo.staticConstant ??= 87); | |
77 Foo.staticField ??= 87; | |
78 use(Foo.staticField ??= 87); | |
79 Foo.staticFunction ??= 87; | |
80 use(Foo.staticFunction ??= 87); | |
81 Foo.staticGetter ??= 87; | |
82 use(Foo.staticGetter ??= 87); | |
83 Foo.staticSetter ??= 87; | |
84 use(Foo.staticSetter ??= 87); | |
85 } on NoSuchMethodError { | |
86 // Expected. | |
87 } | |
88 } | |
OLD | NEW |