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

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

Issue 46063010: Change dart:io Platform.script to return a Uri. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rebased Created 7 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 import 'dart:async'; 5 import 'dart:async';
6 import 'package:expect/expect.dart'; 6 import 'package:expect/expect.dart';
7 7
8 import 'memory_source_file_helper.dart'; 8 import 'memory_source_file_helper.dart';
9 9
10 Future<Map<String, String>> generate(String code, 10 Future<Map<String, String>> generate(String code,
11 [List<String> options = const []]) { 11 [List<String> options = const []]) {
12 Uri script = currentDirectory.resolve(nativeToUriPath(Platform.script)); 12 Uri script = currentDirectory.resolveUri(Platform.script);
13 Uri libraryRoot = script.resolve('../../../sdk/'); 13 Uri libraryRoot = script.resolve('../../../sdk/');
14 Uri packageRoot = script.resolve('./packages/'); 14 Uri packageRoot = script.resolve('./packages/');
15 15
16 var provider = new MemorySourceFileProvider({ 'main.dart': code }); 16 var provider = new MemorySourceFileProvider({ 'main.dart': code });
17 var handler = new FormattingDiagnosticHandler(provider); 17 var handler = new FormattingDiagnosticHandler(provider);
18 18
19 Compiler compiler = new Compiler(provider.readStringFromUri, 19 Compiler compiler = new Compiler(provider.readStringFromUri,
20 null, 20 null,
21 handler.diagnosticHandler, 21 handler.diagnosticHandler,
22 libraryRoot, 22 libraryRoot,
23 packageRoot, 23 packageRoot,
24 options); 24 options);
25 Uri uri = Uri.parse('memory:main.dart'); 25 Uri uri = Uri.parse('memory:main.dart');
26 return compiler.run(uri).then((success) { 26 return compiler.run(uri).then((success) {
27 Expect.isTrue(success); 27 Expect.isTrue(success);
28 Map<String, String> result = new Map<String, String>(); 28 Map<String, String> result = new Map<String, String>();
29 for (var element in compiler.backend.generatedCode.keys) { 29 for (var element in compiler.backend.generatedCode.keys) {
30 if (element.getCompilationUnit().script.uri != uri) continue; 30 if (element.getCompilationUnit().script.uri != uri) continue;
31 var name = element.name; 31 var name = element.name;
32 var code = compiler.backend.assembleCode(element); 32 var code = compiler.backend.assembleCode(element);
33 result[name] = code; 33 result[name] = code;
34 } 34 }
35 return result; 35 return result;
36 }); 36 });
37 } 37 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/bad_loop_test.dart ('k') | tests/compiler/dart2js/deferred_load_graph_segmentation_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698