| 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 leg_apiimpl; | 5 library leg_apiimpl; |
| 6 | 6 |
| 7 import 'dart:uri'; | 7 import 'dart:uri'; |
| 8 import 'dart:async'; |
| 8 | 9 |
| 9 import '../compiler.dart' as api; | 10 import '../compiler.dart' as api; |
| 10 import 'dart2jslib.dart' as leg; | 11 import 'dart2jslib.dart' as leg; |
| 11 import 'tree/tree.dart' as tree; | 12 import 'tree/tree.dart' as tree; |
| 12 import 'elements/elements.dart' as elements; | 13 import 'elements/elements.dart' as elements; |
| 13 import 'ssa/tracer.dart' as ssa; | 14 import 'ssa/tracer.dart' as ssa; |
| 14 import '../../libraries.dart'; | 15 import '../../libraries.dart'; |
| 15 import 'source_file.dart'; | 16 import 'source_file.dart'; |
| 16 | 17 |
| 17 class Compiler extends leg.Compiler { | 18 class Compiler extends leg.Compiler { |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 } | 101 } |
| 101 | 102 |
| 102 leg.Script readScript(Uri uri, [tree.Node node]) { | 103 leg.Script readScript(Uri uri, [tree.Node node]) { |
| 103 return fileReadingTask.measure(() { | 104 return fileReadingTask.measure(() { |
| 104 if (uri.scheme == 'dart') uri = translateDartUri(uri, node); | 105 if (uri.scheme == 'dart') uri = translateDartUri(uri, node); |
| 105 var translated = translateUri(uri, node); | 106 var translated = translateUri(uri, node); |
| 106 String text = ""; | 107 String text = ""; |
| 107 try { | 108 try { |
| 108 // TODO(ahe): We expect the future to be complete and call value | 109 // TODO(ahe): We expect the future to be complete and call value |
| 109 // directly. In effect, we don't support truly asynchronous API. | 110 // directly. In effect, we don't support truly asynchronous API. |
| 110 text = provider(translated).value; | 111 text = deprecatedFutureValue(provider(translated)); |
| 111 } catch (exception) { | 112 } catch (exception) { |
| 112 if (node != null) { | 113 if (node != null) { |
| 113 cancel("$exception", node: node); | 114 cancel("$exception", node: node); |
| 114 } else { | 115 } else { |
| 115 reportDiagnostic(null, "$exception", api.Diagnostic.ERROR); | 116 reportDiagnostic(null, "$exception", api.Diagnostic.ERROR); |
| 116 throw new leg.CompilerCancelledException("$exception"); | 117 throw new leg.CompilerCancelledException("$exception"); |
| 117 } | 118 } |
| 118 } | 119 } |
| 119 SourceFile sourceFile = new SourceFile(translated.toString(), text); | 120 SourceFile sourceFile = new SourceFile(translated.toString(), text); |
| 120 return new leg.Script(uri, sourceFile); | 121 return new leg.Script(uri, sourceFile); |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 handler(translateUri(span.uri, null), span.begin, span.end, | 184 handler(translateUri(span.uri, null), span.begin, span.end, |
| 184 message, kind); | 185 message, kind); |
| 185 } | 186 } |
| 186 } | 187 } |
| 187 | 188 |
| 188 bool get isMockCompilation { | 189 bool get isMockCompilation { |
| 189 return mockableLibraryUsed | 190 return mockableLibraryUsed |
| 190 && (options.indexOf('--allow-mock-compilation') != -1); | 191 && (options.indexOf('--allow-mock-compilation') != -1); |
| 191 } | 192 } |
| 192 } | 193 } |
| OLD | NEW |