| OLD | NEW |
| 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:io'; | 5 import 'dart:io'; |
| 6 import 'dart:convert'; | 6 import 'dart:convert'; |
| 7 | 7 |
| 8 // TODO(ahe): Should be dart:mirrors. | 8 // TODO(ahe): Should be dart:mirrors. |
| 9 import '../../implementation/mirrors/mirrors.dart'; | 9 import '../../implementation/mirrors/mirrors.dart'; |
| 10 | 10 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 | 25 |
| 26 bool isPublicDart2jsLibrary(String name) { | 26 bool isPublicDart2jsLibrary(String name) { |
| 27 return !name.startsWith('_') && LIBRARIES[name].isDart2jsLibrary; | 27 return !name.startsWith('_') && LIBRARIES[name].isDart2jsLibrary; |
| 28 } | 28 } |
| 29 | 29 |
| 30 var handler; | 30 var handler; |
| 31 RandomAccessFile output; | 31 RandomAccessFile output; |
| 32 Uri outputUri; | 32 Uri outputUri; |
| 33 Uri sdkRoot; | 33 Uri sdkRoot; |
| 34 | 34 |
| 35 main() { | 35 main(List<String> arguments) { |
| 36 mainWithOptions(new Options()); | |
| 37 } | |
| 38 | |
| 39 mainWithOptions(Options options) { | |
| 40 handler = new FormattingDiagnosticHandler() | 36 handler = new FormattingDiagnosticHandler() |
| 41 ..throwOnError = true; | 37 ..throwOnError = true; |
| 42 | 38 |
| 43 outputUri = | 39 outputUri = |
| 44 handler.provider.cwd.resolve(nativeToUriPath(options.arguments.first)); | 40 handler.provider.cwd.resolve(nativeToUriPath(arguments.first)); |
| 45 output = new File(options.arguments.first).openSync(mode: FileMode.WRITE); | 41 output = new File(arguments.first).openSync(mode: FileMode.WRITE); |
| 46 | 42 |
| 47 Uri myLocation = | 43 Uri myLocation = |
| 48 handler.provider.cwd.resolve(nativeToUriPath(options.script)); | 44 handler.provider.cwd.resolve(nativeToUriPath(Platform.script)); |
| 49 | 45 |
| 50 sdkRoot = myLocation.resolve(SDK_ROOT).resolve('../'); | 46 sdkRoot = myLocation.resolve(SDK_ROOT).resolve('../'); |
| 51 | 47 |
| 52 // Get the names of public dart2js libraries. | 48 // Get the names of public dart2js libraries. |
| 53 Iterable<String> names = LIBRARIES.keys.where(isPublicDart2jsLibrary); | 49 Iterable<String> names = LIBRARIES.keys.where(isPublicDart2jsLibrary); |
| 54 | 50 |
| 55 // Turn the names into uris by prepending dart: to them. | 51 // Turn the names into uris by prepending dart: to them. |
| 56 List<Uri> uris = names.map((String name) => Uri.parse('dart:$name')).toList(); | 52 List<Uri> uris = names.map((String name) => Uri.parse('dart:$name')).toList(); |
| 57 | 53 |
| 58 analyze(uris, myLocation.resolve(SDK_ROOT), null, handler.provider, handler) | 54 analyze(uris, myLocation.resolve(SDK_ROOT), null, handler.provider, handler) |
| (...skipping 30 matching lines...) Expand all Loading... |
| 89 // DO NOT EDIT. | 85 // DO NOT EDIT. |
| 90 // This file is generated by jsonify.dart. | 86 // This file is generated by jsonify.dart. |
| 91 | 87 |
| 92 library dart.sdk_sources; | 88 library dart.sdk_sources; |
| 93 | 89 |
| 94 const Map<String, String> SDK_SOURCES = const <String, String>'''); | 90 const Map<String, String> SDK_SOURCES = const <String, String>'''); |
| 95 output.writeStringSync(JSON.encode(map).replaceAll(r'$', r'\$')); | 91 output.writeStringSync(JSON.encode(map).replaceAll(r'$', r'\$')); |
| 96 output.writeStringSync(';\n'); | 92 output.writeStringSync(';\n'); |
| 97 output.closeSync(); | 93 output.closeSync(); |
| 98 } | 94 } |
| OLD | NEW |