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

Side by Side Diff: tests/compiler/dart2js/deferred_dont_inline_deferred_globals_test.dart

Issue 2939063002: Strong mode cleaning of many dart2js tests. (Closed)
Patch Set: Use ClassElement. Created 3 years, 6 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 // Test that the additional runtime type support is output to the right 5 // Test that the additional runtime type support is output to the right
6 // Files when using deferred loading. 6 // Files when using deferred loading.
7 7
8 import 'package:async_helper/async_helper.dart'; 8 import 'package:async_helper/async_helper.dart';
9 import 'package:compiler/compiler_new.dart'; 9 import 'package:compiler/compiler_new.dart';
10 import 'package:compiler/src/compiler.dart'; 10 import 'package:compiler/src/compiler.dart';
(...skipping 11 matching lines...) Expand all
22 return compiler.libraryLoader.lookupLibrary(Uri.parse(name)); 22 return compiler.libraryLoader.lookupLibrary(Uri.parse(name));
23 } 23 }
24 24
25 var main = compiler.mainFunction; 25 var main = compiler.mainFunction;
26 Expect.isNotNull(main, "Could not find 'main'"); 26 Expect.isNotNull(main, "Could not find 'main'");
27 compiler.deferredLoadTask.onResolutionComplete( 27 compiler.deferredLoadTask.onResolutionComplete(
28 main, compiler.resolutionWorldBuilder.closedWorldForTesting); 28 main, compiler.resolutionWorldBuilder.closedWorldForTesting);
29 29
30 var outputUnitForElement = compiler.deferredLoadTask.outputUnitForElement; 30 var outputUnitForElement = compiler.deferredLoadTask.outputUnitForElement;
31 31
32 var lib1 = lookupLibrary("memory:lib1.dart"); 32 dynamic lib1 = lookupLibrary("memory:lib1.dart");
33 var foo1 = lib1.find("finalVar"); 33 var foo1 = lib1.find("finalVar");
34 var ou_lib1 = outputUnitForElement(foo1); 34 var ou_lib1 = outputUnitForElement(foo1);
35 35
36 String mainOutput = collector.getOutput("", OutputType.js); 36 String mainOutput = collector.getOutput("", OutputType.js);
37 String lib1Output = 37 String lib1Output =
38 collector.getOutput("out_${ou_lib1.name}", OutputType.jsPart); 38 collector.getOutput("out_${ou_lib1.name}", OutputType.jsPart);
39 // Test that the deferred globals are not inlined into the main file. 39 // Test that the deferred globals are not inlined into the main file.
40 RegExp re1 = new RegExp(r"= .string1"); 40 RegExp re1 = new RegExp(r"= .string1");
41 RegExp re2 = new RegExp(r"= .string2"); 41 RegExp re2 = new RegExp(r"= .string2");
42 Expect.isTrue(re1.hasMatch(lib1Output)); 42 Expect.isTrue(re1.hasMatch(lib1Output));
(...skipping 18 matching lines...) Expand all
61 print(lib1.globalVar); 61 print(lib1.globalVar);
62 }); 62 });
63 } 63 }
64 """, 64 """,
65 "lib1.dart": """ 65 "lib1.dart": """
66 import "main.dart" as main; 66 import "main.dart" as main;
67 final finalVar = "string1"; 67 final finalVar = "string1";
68 var globalVar = "string2"; 68 var globalVar = "string2";
69 """ 69 """
70 }; 70 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698