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

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

Issue 18323004: Add lookupInScope to DeclarationMirror. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add test + fix implementation. Created 7 years, 5 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 | Annotate | Revision Log
OLDNEW
(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 library dart2js.test.memory_compiler;
6
7 import 'package:expect/expect.dart';
Andrei Mouravski 2013/07/03 17:49:49 Nit: we've been formatting imports as: dart:impor
8 import 'memory_source_file_helper.dart';
9
10 import '../../../sdk/lib/_internal/compiler/implementation/dart2jslib.dart'
11 show NullSink;
12
13 import '../../../sdk/lib/_internal/compiler/compiler.dart'
14 show DiagnosticHandler;
15
16 import 'dart:async';
17
18 import '../../../sdk/lib/_internal/compiler/implementation/mirrors/mirrors.dart' ;
19 import '../../../sdk/lib/_internal/compiler/implementation/mirrors/dart2js_mirro r.dart';
20
21 Compiler compilerFor(Map<String,String> memorySourceFiles,
Andrei Mouravski 2013/07/03 17:49:49 A brief doc comment for this would be useful.
22 {DiagnosticHandler diagnosticHandler,
23 List<String> options: const []}) {
24 Uri script = currentDirectory.resolve(nativeToUriPath(Platform.script));
Andrei Mouravski 2013/07/03 17:49:49 I'm always bad with paths: does this require that
25 Uri libraryRoot = script.resolve('../../../sdk/');
26 Uri packageRoot = script.resolve('./packages/');
27
28 MemorySourceFileProvider.MEMORY_SOURCE_FILES = memorySourceFiles;
29 var provider = new MemorySourceFileProvider();
30 if (diagnosticHandler == null) {
31 diagnosticHandler = new FormattingDiagnosticHandler(provider);
32 }
33
34 EventSink<String> outputProvider(String name, String extension) {
35 if (name != '') throw 'Attempt to output file "$name.$extension"';
36 return new NullSink('$name.$extension');
37 }
38
39 Compiler compiler = new Compiler(provider.readStringFromUri,
40 outputProvider,
41 diagnosticHandler,
42 libraryRoot,
43 packageRoot,
44 options);
45 return compiler;
46 }
47
48 Future<MirrorSystem> mirrorSystemFor(Map<String,String> memorySourceFiles,
49 {DiagnosticHandler diagnosticHandler,
50 List<String> options: const []}) {
51 Uri script = currentDirectory.resolve(nativeToUriPath(Platform.script));
52 Uri libraryRoot = script.resolve('../../../sdk/');
53 Uri packageRoot = script.resolve('./packages/');
54
55 MemorySourceFileProvider.MEMORY_SOURCE_FILES = memorySourceFiles;
56 var provider = new MemorySourceFileProvider();
57 if (diagnosticHandler == null) {
58 diagnosticHandler = new FormattingDiagnosticHandler(provider);
59 }
60
61 List<Uri> libraries = <Uri>[];
62 memorySourceFiles.forEach((String path, _) {
63 libraries.add(new Uri(scheme: 'memory', path: path));
64 });
65
66 return analyze(libraries, libraryRoot, packageRoot,
67 provider, diagnosticHandler, options);
68 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698