| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2015, the Dartino project authors. Please see the AUTHORS file | |
| 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. | |
| 4 | |
| 5 library fletchc.debug_info_constructor_codegen; | |
| 6 | |
| 7 import 'package:compiler/src/elements/elements.dart'; | |
| 8 import 'package:compiler/src/universe/selector.dart' show | |
| 9 Selector; | |
| 10 import 'package:compiler/src/tree/tree.dart'; | |
| 11 import 'package:compiler/src/resolution/tree_elements.dart' show | |
| 12 TreeElements; | |
| 13 | |
| 14 import 'package:compiler/src/dart_types.dart' show | |
| 15 DartType; | |
| 16 | |
| 17 import 'package:compiler/src/diagnostics/spannable.dart' show | |
| 18 Spannable; | |
| 19 | |
| 20 import 'bytecode_assembler.dart'; | |
| 21 import 'closure_environment.dart'; | |
| 22 import 'codegen_visitor.dart'; | |
| 23 | |
| 24 import 'fletch_function_builder.dart' show | |
| 25 FletchFunctionBuilder; | |
| 26 | |
| 27 import 'fletch_class_builder.dart' show | |
| 28 FletchClassBuilder; | |
| 29 | |
| 30 import 'fletch_registry.dart' show | |
| 31 FletchRegistry; | |
| 32 | |
| 33 import 'debug_registry.dart' show | |
| 34 DebugRegistry; | |
| 35 | |
| 36 import 'fletch_context.dart'; | |
| 37 import 'constructor_codegen.dart'; | |
| 38 import 'lazy_field_initializer_codegen.dart'; | |
| 39 import 'debug_info_lazy_field_initializer_codegen.dart'; | |
| 40 import 'debug_info.dart'; | |
| 41 | |
| 42 class DebugInfoConstructorCodegen extends ConstructorCodegen | |
| 43 with DebugRegistry { | |
| 44 final DebugInfo debugInfo; | |
| 45 final FletchCompilerImplementation compiler; | |
| 46 | |
| 47 DebugInfoConstructorCodegen(this.debugInfo, | |
| 48 FletchFunctionBuilder functionBuilder, | |
| 49 FletchContext context, | |
| 50 TreeElements elements, | |
| 51 ClosureEnvironment closureEnvironment, | |
| 52 ConstructorElement constructor, | |
| 53 FletchClassBuilder classBuilder, | |
| 54 this.compiler) | |
| 55 : super(functionBuilder, context, elements, null, | |
| 56 closureEnvironment, constructor, classBuilder); | |
| 57 | |
| 58 LazyFieldInitializerCodegen lazyFieldInitializerCodegenFor( | |
| 59 FletchFunctionBuilder function, | |
| 60 FieldElement field) { | |
| 61 TreeElements elements = field.resolvedAst.elements; | |
| 62 return new DebugInfoLazyFieldInitializerCodegen( | |
| 63 debugInfo, | |
| 64 function, | |
| 65 context, | |
| 66 elements, | |
| 67 context.backend.createClosureEnvironment(field, elements), | |
| 68 field, | |
| 69 compiler); | |
| 70 } | |
| 71 | |
| 72 void recordDebugInfo(Node node) { | |
| 73 debugInfo.addLocation(compiler, assembler.byteSize, node); | |
| 74 } | |
| 75 | |
| 76 void pushVariableDeclaration(LocalValue value) { | |
| 77 super.pushVariableDeclaration(value); | |
| 78 debugInfo.pushScope(assembler.byteSize, value); | |
| 79 } | |
| 80 | |
| 81 void popVariableDeclaration(Element element) { | |
| 82 super.popVariableDeclaration(element); | |
| 83 debugInfo.popScope(assembler.byteSize); | |
| 84 } | |
| 85 | |
| 86 void doFieldInitializerSet(Send node, FieldElement field) { | |
| 87 recordDebugInfo(node); | |
| 88 super.doFieldInitializerSet(node, field); | |
| 89 } | |
| 90 | |
| 91 void handleAllocationAndBodyCall() { | |
| 92 // Clear out debug information after the initializer list. This avoids | |
| 93 // seeing the code that sets up for the body call as part of the last | |
| 94 // initializer evaluation. | |
| 95 recordDebugInfo(null); | |
| 96 super.handleAllocationAndBodyCall(); | |
| 97 } | |
| 98 | |
| 99 void callIsSelector( | |
| 100 Node node, | |
| 101 DartType type, | |
| 102 Spannable diagnosticLocation) { | |
| 103 recordDebugInfo(node); | |
| 104 super.callIsSelector(node, type, diagnosticLocation); | |
| 105 } | |
| 106 | |
| 107 void invokeMethod(Node node, Selector selector) { | |
| 108 recordDebugInfo(node); | |
| 109 super.invokeMethod(node, selector); | |
| 110 } | |
| 111 | |
| 112 void invokeGetter(Node node, Name name) { | |
| 113 recordDebugInfo(node); | |
| 114 super.invokeGetter(node, name); | |
| 115 } | |
| 116 | |
| 117 void invokeSetter(Node node, Name name) { | |
| 118 recordDebugInfo(node); | |
| 119 super.invokeSetter(node, name); | |
| 120 } | |
| 121 | |
| 122 void invokeFactory(Node node, int constId, int arity) { | |
| 123 recordDebugInfo(node); | |
| 124 super.invokeFactory(node, constId, arity); | |
| 125 } | |
| 126 | |
| 127 void invokeStatic(Node node, int constId, int arity) { | |
| 128 recordDebugInfo(node); | |
| 129 super.invokeStatic(node, constId, arity); | |
| 130 } | |
| 131 | |
| 132 void generateReturn(Node node) { | |
| 133 recordDebugInfo(node); | |
| 134 super.generateReturn(node); | |
| 135 } | |
| 136 | |
| 137 void generateSwitchCaseMatch(CaseMatch caseMatch, BytecodeLabel ifTrue) { | |
| 138 // We do not want to break on the evaluation of the individual | |
| 139 // case equality tests. | |
| 140 recordDebugInfo(null); | |
| 141 super.generateSwitchCaseMatch(caseMatch, ifTrue); | |
| 142 } | |
| 143 | |
| 144 void generateIdentical(Node node) { | |
| 145 recordDebugInfo(node); | |
| 146 super.generateIdentical(node); | |
| 147 } | |
| 148 | |
| 149 void generateIdenticalNonNumeric(Node node) { | |
| 150 recordDebugInfo(node); | |
| 151 super.generateIdenticalNonNumeric(node); | |
| 152 } | |
| 153 | |
| 154 void generateThrow(Node node) { | |
| 155 recordDebugInfo(node); | |
| 156 super.generateThrow(node); | |
| 157 } | |
| 158 | |
| 159 void visitForValue(Node node) { | |
| 160 recordDebugInfo(node); | |
| 161 super.visitForValue(node); | |
| 162 } | |
| 163 | |
| 164 void visitForEffect(Node node) { | |
| 165 recordDebugInfo(node); | |
| 166 super.visitForEffect(node); | |
| 167 } | |
| 168 } | |
| OLD | NEW |