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 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 218 compilationFailed = true; | 218 compilationFailed = true; |
| 219 } | 219 } |
| 220 diagnosticHandler(uri, begin, end, message, kind); | 220 diagnosticHandler(uri, begin, end, message, kind); |
| 221 } | 221 } |
| 222 | 222 |
| 223 Compiler compiler = new apiimpl.Compiler(inputProvider, | 223 Compiler compiler = new apiimpl.Compiler(inputProvider, |
| 224 null, | 224 null, |
| 225 internalDiagnosticHandler, | 225 internalDiagnosticHandler, |
| 226 libraryRoot, packageRoot, options); | 226 libraryRoot, packageRoot, options); |
| 227 compiler.librariesToAnalyzeWhenRun = libraries; | 227 compiler.librariesToAnalyzeWhenRun = libraries; |
| 228 bool success = compiler.run(null); | 228 return compiler.run(null).then((success) { |
| 229 if (success && !compilationFailed) { | 229 if (success && !compilationFailed) { |
| 230 return new Future<MirrorSystem>.value(new Dart2JsMirrorSystem(compiler)); | 230 return new Dart2JsMirrorSystem(compiler); |
| 231 } else { | 231 } else { |
| 232 return new Future<MirrorSystem>.error('Failed to create mirror system.'); | 232 throw 'Failed to create mirror system.'; |
| 233 } | 233 } |
| 234 }); | |
|
Bob Nystrom
2013/06/26 01:03:24
Well, at least one part of the codebase got cleane
ahe
2013/06/26 07:02:00
Indeed!
| |
| 234 } | 235 } |
| 235 | 236 |
| 236 //------------------------------------------------------------------------------ | 237 //------------------------------------------------------------------------------ |
| 237 // Dart2Js specific extensions of mirror interfaces | 238 // Dart2Js specific extensions of mirror interfaces |
| 238 //------------------------------------------------------------------------------ | 239 //------------------------------------------------------------------------------ |
| 239 | 240 |
| 240 abstract class Dart2JsMirror implements Mirror { | 241 abstract class Dart2JsMirror implements Mirror { |
| 241 Dart2JsMirrorSystem get mirrors; | 242 Dart2JsMirrorSystem get mirrors; |
| 242 } | 243 } |
| 243 | 244 |
| (...skipping 1444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1688 * | 1689 * |
| 1689 * All API in this class is experimental. | 1690 * All API in this class is experimental. |
| 1690 */ | 1691 */ |
| 1691 class BackDoor { | 1692 class BackDoor { |
| 1692 /// Return the compilation units comprising [library]. | 1693 /// Return the compilation units comprising [library]. |
| 1693 static List<Mirror> compilationUnitsOf(Dart2JsLibraryMirror library) { | 1694 static List<Mirror> compilationUnitsOf(Dart2JsLibraryMirror library) { |
| 1694 return library._library.compilationUnits.toList().map( | 1695 return library._library.compilationUnits.toList().map( |
| 1695 (cu) => new Dart2JsCompilationUnitMirror(cu, library)).toList(); | 1696 (cu) => new Dart2JsCompilationUnitMirror(cu, library)).toList(); |
| 1696 } | 1697 } |
| 1697 } | 1698 } |
| OLD | NEW |