OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 @JS() | 4 @JS() |
5 library dev_compiler.web.web_command; | 5 library dev_compiler.web.web_command; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:convert'; | 8 import 'dart:convert'; |
9 import 'dart:html' show HttpRequest; | 9 import 'dart:html' show HttpRequest; |
10 | 10 |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 moduleCode = module | 200 moduleCode = module |
201 .getCode(ModuleFormat.legacy, unit.name, unit.name + '.map', | 201 .getCode(ModuleFormat.legacy, unit.name, unit.name + '.map', |
202 singleOutFile: true) | 202 singleOutFile: true) |
203 .code; | 203 .code; |
204 } | 204 } |
205 | 205 |
206 return new CompileResult( | 206 return new CompileResult( |
207 code: moduleCode, isValid: module.isValid, errors: module.errors); | 207 code: moduleCode, isValid: module.isValid, errors: module.errors); |
208 }; | 208 }; |
209 | 209 |
210 return allowInterop(compileFn); | 210 // TODO(vsm): Cast is due to https://github.com/dart-lang/sdk/issues/28507 |
| 211 return allowInterop(compileFn) as CompileModule; |
211 } | 212 } |
212 } | 213 } |
213 | 214 |
214 // Given path, determine corresponding dart library. | 215 // Given path, determine corresponding dart library. |
215 String _moduleForLibrary(source) { | 216 String _moduleForLibrary(source) { |
216 if (source is InSummarySource) { | 217 if (source is InSummarySource) { |
217 return source.summaryPath.substring(1).replaceAll('.api.ds', ''); | 218 return source.summaryPath.substring(1).replaceAll('.api.ds', ''); |
218 } | 219 } |
219 return source.toString().substring(1).replaceAll('.dart', ''); | 220 return source.toString().substring(1).replaceAll('.dart', ''); |
220 } | 221 } |
221 | 222 |
222 /// Thrown when the input source code has errors. | 223 /// Thrown when the input source code has errors. |
223 class CompileErrorException implements Exception { | 224 class CompileErrorException implements Exception { |
224 toString() => '\nPlease fix all errors before compiling (warnings are okay).'; | 225 toString() => '\nPlease fix all errors before compiling (warnings are okay).'; |
225 } | 226 } |
OLD | NEW |