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

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

Issue 2936233003: Remove Compiler.mainApp and Compiler.mainFunction (Closed)
Patch Set: 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) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 library source_map_name_test; 5 library source_map_name_test;
6 6
7 import 'package:async_helper/async_helper.dart'; 7 import 'package:async_helper/async_helper.dart';
8 import 'package:expect/expect.dart'; 8 import 'package:expect/expect.dart';
9 import 'package:compiler/src/compiler.dart'; 9 import 'package:compiler/src/compiler.dart';
10 import 'package:compiler/src/elements/elements.dart'; 10 import 'package:compiler/src/elements/elements.dart';
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 String name = computeElementNameForSourceMaps(element); 75 String name = computeElementNameForSourceMaps(element);
76 Expect.equals(expectedName, name, 76 Expect.equals(expectedName, name,
77 "Unexpected name '$name' for $element, expected '$expectedName'."); 77 "Unexpected name '$name' for $element, expected '$expectedName'.");
78 } 78 }
79 79
80 main() { 80 main() {
81 asyncTest(() async { 81 asyncTest(() async {
82 CompilationResult result = 82 CompilationResult result =
83 await runCompiler(memorySourceFiles: {'main.dart': SOURCE}); 83 await runCompiler(memorySourceFiles: {'main.dart': SOURCE});
84 Compiler compiler = result.compiler; 84 Compiler compiler = result.compiler;
85 LibraryElement mainApp = compiler.mainApp; 85 LibraryElement mainApp =
86 compiler.frontendStrategy.elementEnvironment.mainLibrary;
86 87
87 Element lookup(String name) { 88 Element lookup(String name) {
88 Element element; 89 Element element;
89 int dotPosition = name.indexOf('.'); 90 int dotPosition = name.indexOf('.');
90 if (dotPosition != -1) { 91 if (dotPosition != -1) {
91 String clsName = name.substring(0, dotPosition); 92 String clsName = name.substring(0, dotPosition);
92 ClassElement cls = mainApp.find(clsName); 93 ClassElement cls = mainApp.find(clsName);
93 Expect.isNotNull(cls, "Class '$clsName' not found."); 94 Expect.isNotNull(cls, "Class '$clsName' not found.");
94 element = cls.localLookup(name.substring(dotPosition + 1)); 95 element = cls.localLookup(name.substring(dotPosition + 1));
95 } else { 96 } else {
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 checkName('Class.instanceAnonymous', 148 checkName('Class.instanceAnonymous',
148 ['Class.instanceAnonymous.<anonymous function>']); 149 ['Class.instanceAnonymous.<anonymous function>']);
149 checkName('Class.instanceLocal', ['Class.instanceLocal.localMethod']); 150 checkName('Class.instanceLocal', ['Class.instanceLocal.localMethod']);
150 checkName('Class.instanceNestedLocal', [ 151 checkName('Class.instanceNestedLocal', [
151 'Class.instanceNestedLocal.localMethod', 152 'Class.instanceNestedLocal.localMethod',
152 'Class.instanceNestedLocal.localMethod.<anonymous function>', 153 'Class.instanceNestedLocal.localMethod.<anonymous function>',
153 'Class.instanceNestedLocal.localMethod.nestedLocalMethod' 154 'Class.instanceNestedLocal.localMethod.nestedLocalMethod'
154 ]); 155 ]);
155 }); 156 });
156 } 157 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/simple_inferrer_callers_test.dart ('k') | tests/compiler/dart2js/trust_type_annotations2_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698