OLD | NEW |
| (Empty) |
1 // Copyright (c) 2013, 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 file. | |
4 | |
5 // Regression test for a crash in dart2js. | |
6 | |
7 part of crash_6725; | |
8 | |
9 class Fisk { | |
10 it1(x) { | |
11 // "key" is unresolved and caused a crash in dart2js. | |
12 // This is the original example the user reported. | |
13 for (key in x) { | |
14 print(key); | |
15 } | |
16 } | |
17 | |
18 it2(x) { | |
19 // "length" is "intercepted" and handled differently from other | |
20 // names when an instance of list is observed. | |
21 for (length in x) { | |
22 print(length); | |
23 } | |
24 } | |
25 | |
26 it3(x) { | |
27 // We're pretty sure that there's no "fisk" that is "intercepted". | |
28 for (fisk in x) { | |
29 print(fisk); | |
30 } | |
31 } | |
32 } | |
33 | |
34 class SubFisk extends Fisk { | |
35 var key; | |
36 var length; | |
37 var fisk; | |
38 } | |
39 | |
40 test() { | |
41 Fisk f = new SubFisk(); | |
42 var m = (x) { | |
43 for (undeclared in x) { | |
44 print(undeclared); | |
45 } | |
46 }; | |
47 if (new DateTime.now().millisecondsSinceEpoch == 42) { | |
48 f = null; | |
49 m = (x) {}; | |
50 } | |
51 | |
52 f.it1([87, 42]); | |
53 if (f.key != 42) { | |
54 throw 'f.key != 42 (${f.key})'; | |
55 } | |
56 | |
57 f.it2([87, 42]); | |
58 if (f.length != 42) { | |
59 throw 'f.length != 42 (${f.length})'; | |
60 } | |
61 | |
62 f.it3([87, 42]); | |
63 if (f.fisk != 42) { | |
64 throw 'f.fisk != 42 (${f.fisk})'; | |
65 } | |
66 | |
67 try { | |
68 m([87, 42]); | |
69 throw 'NoSuchMethodError expected'; | |
70 } on NoSuchMethodError { | |
71 // Expected. | |
72 } | |
73 } | |
OLD | NEW |