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