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

Side by Side Diff: tests/lib_strong/mirrors/globalized_closures_test.dart

Issue 2774783002: Re-land "Format all multitests" (Closed)
Patch Set: Created 3 years, 9 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
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 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. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 // Dart2js crashed on this example. It globalized closures and created 5 // Dart2js crashed on this example. It globalized closures and created
6 // top-level classes for closures (here the globalized_closure). There was a 6 // top-level classes for closures (here the globalized_closure). There was a
7 // name-clash with the global "main_closure" class which led to a crash. 7 // name-clash with the global "main_closure" class which led to a crash.
8 8
9 library main; 9 library main;
10 10
11 import 'dart:mirrors'; 11 import 'dart:mirrors';
12 12
13 import 'package:expect/expect.dart'; 13 import 'package:expect/expect.dart';
14 14
15 class main_closure { 15 class main_closure {}
16 }
17 16
18 confuse(x) { 17 confuse(x) {
19 if (new DateTime.now().millisecondsSinceEpoch == 42) return confuse(() => 42); 18 if (new DateTime.now().millisecondsSinceEpoch == 42) return confuse(() => 42);
20 return x; 19 return x;
21 } 20 }
22 21
23 main() { 22 main() {
24 new main_closure(); 23 new main_closure();
25 var globalized_closure = confuse(() => 499); 24 var globalized_closure = confuse(() => 499);
26 globalized_closure(); 25 globalized_closure();
27 final ms = currentMirrorSystem(); 26 final ms = currentMirrorSystem();
28 var lib = ms.findLibrary(#main); 27 var lib = ms.findLibrary(#main);
29 var collectedParents = []; 28 var collectedParents = [];
30 var classes = lib.declarations.values; 29 var classes = lib.declarations.values;
31 for (var c in classes) { 30 for (var c in classes) {
32 if (c is ClassMirror && c.superclass != null) { 31 if (c is ClassMirror && c.superclass != null) {
33 collectedParents.add(MirrorSystem.getName(c.superclass.simpleName)); 32 collectedParents.add(MirrorSystem.getName(c.superclass.simpleName));
34 } 33 }
35 }; 34 }
35 ;
36 Expect.listEquals(["Object"], collectedParents); // //# 00: ok 36 Expect.listEquals(["Object"], collectedParents); // //# 00: ok
37 } 37 }
OLDNEW
« no previous file with comments | « tests/lib_strong/mirrors/globalized_closures2_test.dart ('k') | tests/lib_strong/mirrors/initializing_formals_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698