OLD | NEW |
1 // Copyright (c) 2015, the Fletch project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Fletch 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.md file. | 3 // BSD-style license that can be found in the LICENSE.md file. |
4 | 4 |
5 library fletchc.fletch_compiler_implementation; | 5 library fletchc.fletch_compiler_implementation; |
6 | 6 |
7 import 'dart:async' show | 7 import 'dart:async' show |
8 EventSink; | 8 EventSink; |
9 | 9 |
10 import 'package:sdk_library_metadata/libraries.dart' show | 10 import 'package:sdk_library_metadata/libraries.dart' show |
(...skipping 24 matching lines...) Expand all Loading... |
35 Message, | 35 Message, |
36 MessageKind, | 36 MessageKind, |
37 MessageTemplate; | 37 MessageTemplate; |
38 | 38 |
39 import 'package:compiler/src/util/util.dart' show | 39 import 'package:compiler/src/util/util.dart' show |
40 Spannable; | 40 Spannable; |
41 | 41 |
42 import 'fletch_registry.dart' show | 42 import 'fletch_registry.dart' show |
43 FletchRegistry; | 43 FletchRegistry; |
44 | 44 |
| 45 import 'please_report_crash.dart' show |
| 46 crashReportRequested, |
| 47 requestBugReportOnCompilerCrashMessage; |
| 48 |
45 import 'fletch_function_builder.dart'; | 49 import 'fletch_function_builder.dart'; |
46 import 'debug_info.dart'; | 50 import 'debug_info.dart'; |
47 import 'find_position_visitor.dart'; | 51 import 'find_position_visitor.dart'; |
48 import 'fletch_context.dart'; | 52 import 'fletch_context.dart'; |
49 | 53 |
50 import '../fletch_system.dart'; | 54 import '../fletch_system.dart'; |
51 | 55 |
52 const EXTRA_DART2JS_OPTIONS = const <String>[ | 56 const EXTRA_DART2JS_OPTIONS = const <String>[ |
53 // TODO(ahe): This doesn't completely disable type inference. Investigate. | 57 // TODO(ahe): This doesn't completely disable type inference. Investigate. |
54 '--disable-type-inference', | 58 '--disable-type-inference', |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 String message, | 272 String message, |
269 {bool forceVerbose: false}) { | 273 {bool forceVerbose: false}) { |
270 // TODO(johnniwinther): Use super.reportVerboseInfo once added. | 274 // TODO(johnniwinther): Use super.reportVerboseInfo once added. |
271 if (forceVerbose || verbose) { | 275 if (forceVerbose || verbose) { |
272 MessageTemplate template = MessageTemplate.TEMPLATES[MessageKind.GENERIC]; | 276 MessageTemplate template = MessageTemplate.TEMPLATES[MessageKind.GENERIC]; |
273 reportDiagnostic( | 277 reportDiagnostic( |
274 node, template.message({'text': message}, true), api.Diagnostic.HINT); | 278 node, template.message({'text': message}, true), api.Diagnostic.HINT); |
275 } | 279 } |
276 } | 280 } |
277 | 281 |
| 282 void pleaseReportCrash() { |
| 283 crashReportRequested = true; |
| 284 print(requestBugReportOnCompilerCrashMessage); |
| 285 } |
| 286 |
278 void reportError( | 287 void reportError( |
279 Spannable node, | 288 Spannable node, |
280 MessageKind messageKind, | 289 MessageKind messageKind, |
281 [Map arguments = const {}]) { | 290 [Map arguments = const {}]) { |
282 if (messageKind == MessageKind.MIRRORS_LIBRARY_NOT_SUPPORT_BY_BACKEND) { | 291 if (messageKind == MessageKind.MIRRORS_LIBRARY_NOT_SUPPORT_BY_BACKEND) { |
283 const String noMirrors = | 292 const String noMirrors = |
284 "Fletch doesn't support 'dart:mirrors'. See https://goo.gl/Kwrd0O"; | 293 "Fletch doesn't support 'dart:mirrors'. See https://goo.gl/Kwrd0O"; |
285 messageKind = MessageKind.GENERIC; | 294 messageKind = MessageKind.GENERIC; |
286 arguments = {'text': noMirrors}; | 295 arguments = {'text': noMirrors}; |
287 } | 296 } |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 } | 336 } |
328 } | 337 } |
329 | 338 |
330 SourceFile getSourceFile(api.CompilerInput provider, Uri uri) { | 339 SourceFile getSourceFile(api.CompilerInput provider, Uri uri) { |
331 if (provider is SourceFileProvider) { | 340 if (provider is SourceFileProvider) { |
332 return provider.sourceFiles[uri]; | 341 return provider.sourceFiles[uri]; |
333 } else { | 342 } else { |
334 return null; | 343 return null; |
335 } | 344 } |
336 } | 345 } |
OLD | NEW |