| 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 dart2js.source_mirrors.analyze; | 5 library dart2js.source_mirrors.analyze; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'source_mirrors.dart'; | 9 import 'source_mirrors.dart'; |
| 10 import 'dart2js_mirrors.dart' show Dart2JsMirrorSystem; | 10 import 'dart2js_mirrors.dart' show Dart2JsMirrorSystem; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 bool compilationFailed = false; | 47 bool compilationFailed = false; |
| 48 void internalDiagnosticHandler(Uri uri, int begin, int end, | 48 void internalDiagnosticHandler(Uri uri, int begin, int end, |
| 49 String message, api.Diagnostic kind) { | 49 String message, api.Diagnostic kind) { |
| 50 if (kind == api.Diagnostic.ERROR || | 50 if (kind == api.Diagnostic.ERROR || |
| 51 kind == api.Diagnostic.CRASH) { | 51 kind == api.Diagnostic.CRASH) { |
| 52 compilationFailed = true; | 52 compilationFailed = true; |
| 53 } | 53 } |
| 54 diagnosticHandler(uri, begin, end, message, kind); | 54 diagnosticHandler(uri, begin, end, message, kind); |
| 55 } | 55 } |
| 56 | 56 |
| 57 Compiler compiler = new apiimpl.Compiler( | 57 Compiler compiler = new apiimpl.CompilerImpl( |
| 58 new LegacyCompilerInput(inputProvider), | 58 new LegacyCompilerInput(inputProvider), |
| 59 new LegacyCompilerOutput(), | 59 new LegacyCompilerOutput(), |
| 60 new LegacyCompilerDiagnostics(internalDiagnosticHandler), | 60 new LegacyCompilerDiagnostics(internalDiagnosticHandler), |
| 61 libraryRoot, | 61 libraryRoot, |
| 62 packageRoot, | 62 packageRoot, |
| 63 options, | 63 options, |
| 64 const {}, | 64 const {}, |
| 65 packageConfig, | 65 packageConfig, |
| 66 findPackages); | 66 findPackages); |
| 67 compiler.librariesToAnalyzeWhenRun = libraries; | 67 compiler.librariesToAnalyzeWhenRun = libraries; |
| 68 return compiler.run(null).then((bool success) { | 68 return compiler.run(null).then((bool success) { |
| 69 if (success && !compilationFailed) { | 69 if (success && !compilationFailed) { |
| 70 return new Dart2JsMirrorSystem(compiler); | 70 return new Dart2JsMirrorSystem(compiler); |
| 71 } else { | 71 } else { |
| 72 throw new StateError('Failed to create mirror system.'); | 72 throw new StateError('Failed to create mirror system.'); |
| 73 } | 73 } |
| 74 }); | 74 }); |
| 75 } | 75 } |
| OLD | NEW |