| 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 | 8 |
| 9 import '../../compiler.dart' as api; | 9 import '../../compiler.dart' as api; |
| 10 import '../elements/elements.dart'; | 10 import '../elements/elements.dart'; |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 if (kind == api.Diagnostic.ERROR || | 216 if (kind == api.Diagnostic.ERROR || |
| 217 kind == api.Diagnostic.CRASH) { | 217 kind == api.Diagnostic.CRASH) { |
| 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, |
| 227 options, |
| 228 const {}); |
| 227 compiler.librariesToAnalyzeWhenRun = libraries; | 229 compiler.librariesToAnalyzeWhenRun = libraries; |
| 228 return compiler.run(null).then((bool success) { | 230 return compiler.run(null).then((bool success) { |
| 229 if (success && !compilationFailed) { | 231 if (success && !compilationFailed) { |
| 230 return new Dart2JsMirrorSystem(compiler); | 232 return new Dart2JsMirrorSystem(compiler); |
| 231 } else { | 233 } else { |
| 232 throw new StateError('Failed to create mirror system.'); | 234 throw new StateError('Failed to create mirror system.'); |
| 233 } | 235 } |
| 234 }); | 236 }); |
| 235 } | 237 } |
| 236 | 238 |
| (...skipping 1510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1747 * | 1749 * |
| 1748 * All API in this class is experimental. | 1750 * All API in this class is experimental. |
| 1749 */ | 1751 */ |
| 1750 class BackDoor { | 1752 class BackDoor { |
| 1751 /// Return the compilation units comprising [library]. | 1753 /// Return the compilation units comprising [library]. |
| 1752 static List<Mirror> compilationUnitsOf(Dart2JsLibraryMirror library) { | 1754 static List<Mirror> compilationUnitsOf(Dart2JsLibraryMirror library) { |
| 1753 return library._library.compilationUnits.toList().map( | 1755 return library._library.compilationUnits.toList().map( |
| 1754 (cu) => new Dart2JsCompilationUnitMirror(cu, library)).toList(); | 1756 (cu) => new Dart2JsCompilationUnitMirror(cu, library)).toList(); |
| 1755 } | 1757 } |
| 1756 } | 1758 } |
| OLD | NEW |