Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 mirrors_dart2js; | 5 library mirrors_dart2js; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:collection' show LinkedHashMap; | 8 import 'dart:collection' show LinkedHashMap; |
| 9 | 9 |
| 10 import '../../compiler.dart' as api; | 10 import '../../compiler.dart' as api; |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 220 compilationFailed = true; | 220 compilationFailed = true; |
| 221 } | 221 } |
| 222 diagnosticHandler(uri, begin, end, message, kind); | 222 diagnosticHandler(uri, begin, end, message, kind); |
| 223 } | 223 } |
| 224 | 224 |
| 225 Compiler compiler = new apiimpl.Compiler(inputProvider, | 225 Compiler compiler = new apiimpl.Compiler(inputProvider, |
| 226 null, | 226 null, |
| 227 internalDiagnosticHandler, | 227 internalDiagnosticHandler, |
| 228 libraryRoot, packageRoot, options); | 228 libraryRoot, packageRoot, options); |
| 229 compiler.librariesToAnalyzeWhenRun = libraries; | 229 compiler.librariesToAnalyzeWhenRun = libraries; |
| 230 bool success = compiler.run(null); | 230 return compiler.run(null).then((bool success) { |
| 231 if (success && !compilationFailed) { | 231 if (success && !compilationFailed) { |
| 232 return new Future<MirrorSystem>.value(new Dart2JsMirrorSystem(compiler)); | 232 return new Dart2JsMirrorSystem(compiler); |
| 233 } else { | 233 } else { |
| 234 return new Future<MirrorSystem>.error('Failed to create mirror system.'); | 234 throw 'Failed to create mirror system.'; |
|
ahe
2013/09/02 13:43:24
throw new StateError or something.
Johnni Winther
2013/09/03 07:51:39
Done.
| |
| 235 } | 235 } |
| 236 }); | |
| 236 } | 237 } |
| 237 | 238 |
| 238 //------------------------------------------------------------------------------ | 239 //------------------------------------------------------------------------------ |
| 239 // Dart2Js specific extensions of mirror interfaces | 240 // Dart2Js specific extensions of mirror interfaces |
| 240 //------------------------------------------------------------------------------ | 241 //------------------------------------------------------------------------------ |
| 241 | 242 |
| 242 abstract class Dart2JsMirror implements Mirror { | 243 abstract class Dart2JsMirror implements Mirror { |
| 243 Dart2JsMirrorSystem get mirrors; | 244 Dart2JsMirrorSystem get mirrors; |
| 244 } | 245 } |
| 245 | 246 |
| (...skipping 1504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1750 * | 1751 * |
| 1751 * All API in this class is experimental. | 1752 * All API in this class is experimental. |
| 1752 */ | 1753 */ |
| 1753 class BackDoor { | 1754 class BackDoor { |
| 1754 /// Return the compilation units comprising [library]. | 1755 /// Return the compilation units comprising [library]. |
| 1755 static List<Mirror> compilationUnitsOf(Dart2JsLibraryMirror library) { | 1756 static List<Mirror> compilationUnitsOf(Dart2JsLibraryMirror library) { |
| 1756 return library._library.compilationUnits.toList().map( | 1757 return library._library.compilationUnits.toList().map( |
| 1757 (cu) => new Dart2JsCompilationUnitMirror(cu, library)).toList(); | 1758 (cu) => new Dart2JsCompilationUnitMirror(cu, library)).toList(); |
| 1758 } | 1759 } |
| 1759 } | 1760 } |
| OLD | NEW |