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

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

Issue 717103004: Revert "Emit warning on import of dart:mirrors." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 1 month 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 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 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 dart2js.test.memory_compiler; 5 library dart2js.test.memory_compiler;
6 6
7 import 'memory_source_file_helper.dart'; 7 import 'memory_source_file_helper.dart';
8 8
9 import 'package:compiler/src/dart2jslib.dart' 9 import 'package:compiler/src/dart2jslib.dart'
10 show NullSink; 10 show NullSink;
11 11
12 import 'package:compiler/compiler.dart' 12 import 'package:compiler/compiler.dart'
13 show Diagnostic, DiagnosticHandler, CompilerOutputProvider; 13 show Diagnostic, DiagnosticHandler, CompilerOutputProvider;
14 14
15 import 'dart:async'; 15 import 'dart:async';
16 16
17 import 'package:compiler/src/mirrors/source_mirrors.dart'; 17 import 'package:compiler/src/mirrors/source_mirrors.dart';
18 import 'package:compiler/src/mirrors/analyze.dart'; 18 import 'package:compiler/src/mirrors/analyze.dart';
19 19
20 import 'package:compiler/src/library_loader.dart'
21 show LoadedLibraries;
22
23 class DiagnosticMessage { 20 class DiagnosticMessage {
24 final Uri uri; 21 final Uri uri;
25 final int begin; 22 final int begin;
26 final int end; 23 final int end;
27 final String message; 24 final String message;
28 final Diagnostic kind; 25 final Diagnostic kind;
29 26
30 DiagnosticMessage(this.uri, this.begin, this.end, this.message, this.kind); 27 DiagnosticMessage(this.uri, this.begin, this.end, this.message, this.kind);
31 28
32 String toString() => '$uri:$begin:$end:$message:$kind'; 29 String toString() => '$uri:$begin:$end:$message:$kind';
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 if (library.isPatched) { 176 if (library.isPatched) {
180 var patchLibrary = library.patch; 177 var patchLibrary = library.patch;
181 compiler.onLibraryCreated(patchLibrary); 178 compiler.onLibraryCreated(patchLibrary);
182 compiler.onLibraryScanned(patchLibrary, null); 179 compiler.onLibraryScanned(patchLibrary, null);
183 } 180 }
184 copiedLibraries[library.canonicalUri] = library; 181 copiedLibraries[library.canonicalUri] = library;
185 } 182 }
186 }); 183 });
187 // TODO(johnniwinther): Assert that no libraries are loaded lazily from 184 // TODO(johnniwinther): Assert that no libraries are loaded lazily from
188 // this call. 185 // this call.
189 compiler.onLibrariesLoaded(new MemoryLoadedLibraries(copiedLibraries)); 186 compiler.onLibrariesLoaded(copiedLibraries);
190 187
191 compiler.symbolConstructor = cachedCompiler.symbolConstructor; 188 compiler.symbolConstructor = cachedCompiler.symbolConstructor;
192 compiler.mirrorSystemClass = cachedCompiler.mirrorSystemClass; 189 compiler.mirrorSystemClass = cachedCompiler.mirrorSystemClass;
193 compiler.mirrorsUsedClass = cachedCompiler.mirrorsUsedClass; 190 compiler.mirrorsUsedClass = cachedCompiler.mirrorsUsedClass;
194 compiler.mirrorSystemGetNameFunction = 191 compiler.mirrorSystemGetNameFunction =
195 cachedCompiler.mirrorSystemGetNameFunction; 192 cachedCompiler.mirrorSystemGetNameFunction;
196 compiler.symbolImplementationClass = 193 compiler.symbolImplementationClass =
197 cachedCompiler.symbolImplementationClass; 194 cachedCompiler.symbolImplementationClass;
198 compiler.symbolValidatedConstructor = 195 compiler.symbolValidatedConstructor =
199 cachedCompiler.symbolValidatedConstructor; 196 cachedCompiler.symbolValidatedConstructor;
(...skipping 25 matching lines...) Expand all
225 // Don't null out the enqueuer as it prevents us from using cachedCompiler 222 // Don't null out the enqueuer as it prevents us from using cachedCompiler
226 // more than once. 223 // more than once.
227 cachedCompiler.deferredLoadTask = null; 224 cachedCompiler.deferredLoadTask = null;
228 cachedCompiler.mirrorUsageAnalyzerTask = null; 225 cachedCompiler.mirrorUsageAnalyzerTask = null;
229 cachedCompiler.dumpInfoTask = null; 226 cachedCompiler.dumpInfoTask = null;
230 cachedCompiler.buildId = null; 227 cachedCompiler.buildId = null;
231 } 228 }
232 return compiler; 229 return compiler;
233 } 230 }
234 231
235 class MemoryLoadedLibraries implements LoadedLibraries {
236 final Map copiedLibraries;
237
238 MemoryLoadedLibraries(this.copiedLibraries);
239
240 @override
241 bool containsLibrary(Uri uri) => copiedLibraries.containsKey(uri);
242
243 @override
244 void forEachImportChain(f) {}
245
246 @override
247 void forEachLibrary(f) {}
248
249 @override
250 getLibrary(Uri uri) => copiedLibraries[uri];
251
252 @override
253 Uri get rootUri => null;
254 }
255
256 Future<MirrorSystem> mirrorSystemFor(Map<String,String> memorySourceFiles, 232 Future<MirrorSystem> mirrorSystemFor(Map<String,String> memorySourceFiles,
257 {DiagnosticHandler diagnosticHandler, 233 {DiagnosticHandler diagnosticHandler,
258 List<String> options: const [], 234 List<String> options: const [],
259 bool showDiagnostics: true}) { 235 bool showDiagnostics: true}) {
260 Uri libraryRoot = Uri.base.resolve('sdk/'); 236 Uri libraryRoot = Uri.base.resolve('sdk/');
261 Uri packageRoot = Uri.base.resolveUri( 237 Uri packageRoot = Uri.base.resolveUri(
262 new Uri.file('${Platform.packageRoot}/')); 238 new Uri.file('${Platform.packageRoot}/'));
263 239
264 var provider = new MemorySourceFileProvider(memorySourceFiles); 240 var provider = new MemorySourceFileProvider(memorySourceFiles);
265 var handler = 241 var handler =
266 createDiagnosticHandler(diagnosticHandler, provider, showDiagnostics); 242 createDiagnosticHandler(diagnosticHandler, provider, showDiagnostics);
267 243
268 List<Uri> libraries = <Uri>[]; 244 List<Uri> libraries = <Uri>[];
269 memorySourceFiles.forEach((String path, _) { 245 memorySourceFiles.forEach((String path, _) {
270 libraries.add(new Uri(scheme: 'memory', path: path)); 246 libraries.add(new Uri(scheme: 'memory', path: path));
271 }); 247 });
272 248
273 return analyze(libraries, libraryRoot, packageRoot, 249 return analyze(libraries, libraryRoot, packageRoot,
274 provider, handler, options); 250 provider, handler, options);
275 } 251 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/import_mirrors_test.dart ('k') | tests/compiler/dart2js/message_kind_helper.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698