| 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.debug_registry; | 5 library fletchc.debug_registry; |
| 6 | 6 |
| 7 import 'package:compiler/src/universe/universe.dart' show | 7 import 'package:compiler/src/universe/selector.dart' show |
| 8 Selector; | 8 Selector; |
| 9 | 9 |
| 10 import 'package:compiler/src/elements/elements.dart' show | 10 import 'package:compiler/src/elements/elements.dart' show |
| 11 ClassElement, | 11 ClassElement, |
| 12 FieldElement, | 12 FieldElement, |
| 13 FunctionElement, | 13 FunctionElement, |
| 14 LocalElement; | 14 LocalElement; |
| 15 | 15 |
| 16 import 'package:compiler/src/dart_types.dart' show | 16 import 'package:compiler/src/dart_types.dart' show |
| 17 DartType; | 17 DartType; |
| 18 | 18 |
| 19 import 'package:compiler/src/util/util.dart' show | 19 import 'package:compiler/src/diagnostics/spannable.dart' show |
| 20 Spannable; | 20 Spannable; |
| 21 | 21 |
| 22 import 'package:compiler/src/universe/use.dart' show |
| 23 DynamicUse, |
| 24 StaticUse; |
| 25 |
| 22 import 'fletch_context.dart' show | 26 import 'fletch_context.dart' show |
| 23 FletchContext; | 27 FletchContext; |
| 24 | 28 |
| 25 import 'fletch_function_builder.dart' show | 29 import 'fletch_function_builder.dart' show |
| 26 FletchFunctionBuilder; | 30 FletchFunctionBuilder; |
| 27 | 31 |
| 28 /// Turns off enqueuing when generating debug information. | 32 /// Turns off enqueuing when generating debug information. |
| 29 /// | 33 /// |
| 30 /// We generate debug information for one element at the time, on | 34 /// We generate debug information for one element at the time, on |
| 31 /// demand. Generating this information shouldn't interact with the | 35 /// demand. Generating this information shouldn't interact with the |
| 32 /// enqueuer/registry/tree-shaking algorithm. | 36 /// enqueuer/registry/tree-shaking algorithm. |
| 33 abstract class DebugRegistry { | 37 abstract class DebugRegistry { |
| 34 FletchContext get context; | 38 FletchContext get context; |
| 35 FletchFunctionBuilder get functionBuilder; | 39 FletchFunctionBuilder get functionBuilder; |
| 36 | 40 |
| 37 void registerDynamicInvocation(Selector selector) { } | 41 void registerDynamicUse(Selector selector) { } |
| 38 void registerDynamicGetter(Selector selector) { } | 42 void registerDynamicGetter(Selector selector) { } |
| 39 void registerDynamicSetter(Selector selector) { } | 43 void registerDynamicSetter(Selector selector) { } |
| 40 void registerStaticInvocation(FunctionElement function) { } | 44 void registerStaticUse(StaticUse use) { } |
| 41 void registerInstantiatedClass(ClassElement klass) { } | 45 void registerInstantiatedClass(ClassElement klass) { } |
| 42 void registerIsCheck(DartType type) { } | 46 void registerIsCheck(DartType type) { } |
| 43 void registerLocalInvoke(LocalElement element, Selector selector) { } | 47 void registerLocalInvoke(LocalElement element, Selector selector) { } |
| 44 void registerClosurization(FunctionElement element, _) { } | 48 void registerClosurization(FunctionElement element, _) { } |
| 45 | 49 |
| 46 int compileLazyFieldInitializer(FieldElement field) { | 50 int compileLazyFieldInitializer(FieldElement field) { |
| 47 int index = context.getStaticFieldIndex(field, null); | 51 int index = context.getStaticFieldIndex(field, null); |
| 48 | 52 |
| 49 if (field.initializer == null) return index; | 53 if (field.initializer == null) return index; |
| 50 | 54 |
| 51 if (context.backend.lazyFieldInitializers.containsKey(field)) return index; | 55 if (context.backend.lazyFieldInitializers.containsKey(field)) return index; |
| 52 | 56 |
| 53 context.compiler.internalError( | 57 context.compiler.reporter.internalError( |
| 54 field, "not compiled before use in debugger"); | 58 field, "not compiled before use in debugger"); |
| 59 throw null; |
| 55 } | 60 } |
| 56 | 61 |
| 57 void generateUnimplementedError(Spannable spannable, String reason) { | 62 void generateUnimplementedError(Spannable spannable, String reason) { |
| 58 context.backend.generateUnimplementedError( | 63 context.backend.generateUnimplementedError( |
| 59 spannable, reason, functionBuilder, suppressHint: true); | 64 spannable, reason, functionBuilder, suppressHint: true); |
| 60 } | 65 } |
| 61 } | 66 } |
| OLD | NEW |