| 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:math' as math; | 9 import 'dart:math' as math; |
| 10 import 'dart:html' show HttpRequest; | 10 import 'dart:html' show HttpRequest; |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 | 139 |
| 140 var resourceProvider = new MemoryResourceProvider() | 140 var resourceProvider = new MemoryResourceProvider() |
| 141 ..newFileWithBytes(dartSdkSummaryPath, sdkBytes); | 141 ..newFileWithBytes(dartSdkSummaryPath, sdkBytes); |
| 142 | 142 |
| 143 var resourceUriResolver = new ResourceUriResolver(resourceProvider); | 143 var resourceUriResolver = new ResourceUriResolver(resourceProvider); |
| 144 | 144 |
| 145 var options = new AnalyzerOptions.basic( | 145 var options = new AnalyzerOptions.basic( |
| 146 dartSdkPath: '/dart-sdk', dartSdkSummaryPath: dartSdkSummaryPath); | 146 dartSdkPath: '/dart-sdk', dartSdkSummaryPath: dartSdkSummaryPath); |
| 147 | 147 |
| 148 var summaryDataStore = new SummaryDataStore(options.summaryPaths, | 148 var summaryDataStore = new SummaryDataStore(options.summaryPaths, |
| 149 resourceProvider: resourceProvider, recordDependencyInfo: true); | 149 resourceProvider: resourceProvider); |
| 150 for (var i = 0; i < summaryBytes.length; i++) { | 150 for (var i = 0; i < summaryBytes.length; i++) { |
| 151 var bytes = summaryBytes[i]; | 151 var bytes = summaryBytes[i]; |
| 152 | 152 |
| 153 // Packages with no dart source files will have empty invalid summaries. | 153 // Packages with no dart source files will have empty invalid summaries. |
| 154 if (bytes.length == 0) continue; | 154 if (bytes.length == 0) continue; |
| 155 | 155 |
| 156 var url = '/${moduleIds[i]}.api.ds'; | 156 var url = '/${moduleIds[i]}.api.ds'; |
| 157 var summaryBundle = new PackageBundle.fromBuffer(bytes); | 157 var summaryBundle = new PackageBundle.fromBuffer(bytes); |
| 158 summaryDataStore.addBundle(url, summaryBundle); | 158 summaryDataStore.addBundle(url, summaryBundle); |
| 159 } | 159 } |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 323 if (source is InSummarySource) { | 323 if (source is InSummarySource) { |
| 324 return source.summaryPath.substring(1).replaceAll('.api.ds', ''); | 324 return source.summaryPath.substring(1).replaceAll('.api.ds', ''); |
| 325 } | 325 } |
| 326 return source.toString().substring(1).replaceAll('.dart', ''); | 326 return source.toString().substring(1).replaceAll('.dart', ''); |
| 327 } | 327 } |
| 328 | 328 |
| 329 /// Thrown when the input source code has errors. | 329 /// Thrown when the input source code has errors. |
| 330 class CompileErrorException implements Exception { | 330 class CompileErrorException implements Exception { |
| 331 toString() => '\nPlease fix all errors before compiling (warnings are okay).'; | 331 toString() => '\nPlease fix all errors before compiling (warnings are okay).'; |
| 332 } | 332 } |
| OLD | NEW |