| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 source_file_provider; | 5 library source_file_provider; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:convert'; | 8 import 'dart:convert'; |
| 9 import 'dart:io'; | 9 import 'dart:io'; |
| 10 import 'dart:math' as math; | 10 import 'dart:math' as math; |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 case api.Diagnostic.CRASH: | 163 case api.Diagnostic.CRASH: |
| 164 return 'Internal Error: $message'; | 164 return 'Internal Error: $message'; |
| 165 case api.Diagnostic.INFO: | 165 case api.Diagnostic.INFO: |
| 166 case api.Diagnostic.VERBOSE_INFO: | 166 case api.Diagnostic.VERBOSE_INFO: |
| 167 return 'Info: $message'; | 167 return 'Info: $message'; |
| 168 } | 168 } |
| 169 throw 'Unexpected diagnostic kind: $kind (${kind.ordinal})'; | 169 throw 'Unexpected diagnostic kind: $kind (${kind.ordinal})'; |
| 170 } | 170 } |
| 171 | 171 |
| 172 @override | 172 @override |
| 173 void report(Uri uri, int begin, int end, String message, | 173 void report(var code, Uri uri, int begin, int end, String message, |
| 174 api.Diagnostic kind) { | 174 api.Diagnostic kind) { |
| 175 // TODO(ahe): Remove this when source map is handled differently. | 175 // TODO(ahe): Remove this when source map is handled differently. |
| 176 if (identical(kind.name, 'source map')) return; | 176 if (identical(kind.name, 'source map')) return; |
| 177 | 177 |
| 178 if (isAborting) return; | 178 if (isAborting) return; |
| 179 isAborting = (kind == api.Diagnostic.CRASH); | 179 isAborting = (kind == api.Diagnostic.CRASH); |
| 180 | 180 |
| 181 bool fatal = (kind.ordinal & FATAL) != 0; | 181 bool fatal = (kind.ordinal & FATAL) != 0; |
| 182 bool isInfo = (kind.ordinal & INFO) != 0; | 182 bool isInfo = (kind.ordinal & INFO) != 0; |
| 183 if (isInfo && uri == null && kind != api.Diagnostic.INFO) { | 183 if (isInfo && uri == null && kind != api.Diagnostic.INFO) { |
| 184 info(message, kind); | 184 info(message, kind); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 } | 229 } |
| 230 if (fatal && ++fatalCount >= throwOnErrorCount && throwOnError) { | 230 if (fatal && ++fatalCount >= throwOnErrorCount && throwOnError) { |
| 231 isAborting = true; | 231 isAborting = true; |
| 232 throw new AbortLeg(message); | 232 throw new AbortLeg(message); |
| 233 } | 233 } |
| 234 } | 234 } |
| 235 | 235 |
| 236 // TODO(johnniwinther): Remove this when no longer needed for the old compiler | 236 // TODO(johnniwinther): Remove this when no longer needed for the old compiler |
| 237 // API. | 237 // API. |
| 238 void call(Uri uri, int begin, int end, String message, api.Diagnostic kind) { | 238 void call(Uri uri, int begin, int end, String message, api.Diagnostic kind) { |
| 239 return report(uri, begin, end, message, kind); | 239 return report(null, uri, begin, end, message, kind); |
| 240 } | 240 } |
| 241 } | 241 } |
| 242 | 242 |
| 243 typedef void MessageCallback(String message); | 243 typedef void MessageCallback(String message); |
| 244 | 244 |
| 245 class RandomAccessFileOutputProvider { | 245 class RandomAccessFileOutputProvider { |
| 246 final Uri out; | 246 final Uri out; |
| 247 final Uri sourceMapOut; | 247 final Uri sourceMapOut; |
| 248 final MessageCallback onInfo; | 248 final MessageCallback onInfo; |
| 249 final MessageCallback onFailure; | 249 final MessageCallback onFailure; |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 var onAdd, onClose; | 337 var onAdd, onClose; |
| 338 | 338 |
| 339 EventSinkWrapper(this.onAdd, this.onClose); | 339 EventSinkWrapper(this.onAdd, this.onClose); |
| 340 | 340 |
| 341 void add(String data) => onAdd(data); | 341 void add(String data) => onAdd(data); |
| 342 | 342 |
| 343 void addError(error, [StackTrace stackTrace]) => throw error; | 343 void addError(error, [StackTrace stackTrace]) => throw error; |
| 344 | 344 |
| 345 void close() => onClose(); | 345 void close() => onClose(); |
| 346 } | 346 } |
| OLD | NEW |