Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(28)

Side by Side Diff: pkg/fletchc/lib/src/debug_info_function_codegen.dart

Issue 1659163007: Rename fletch -> dartino (Closed) Base URL: https://github.com/dartino/sdk.git@master
Patch Set: address comments Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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_function_codegen;
6
7 import 'package:compiler/src/elements/elements.dart';
8 import 'package:compiler/src/resolution/tree_elements.dart';
9 import 'package:compiler/src/tree/tree.dart';
10 import 'package:compiler/src/universe/selector.dart';
11
12 import 'package:compiler/src/dart_types.dart' show
13 DartType;
14
15 import 'package:compiler/src/diagnostics/spannable.dart' show
16 Spannable;
17
18 import 'bytecode_assembler.dart';
19 import 'closure_environment.dart';
20 import 'codegen_visitor.dart';
21
22 import 'fletch_function_builder.dart' show
23 FletchFunctionBuilder;
24
25 import 'debug_registry.dart' show
26 DebugRegistry;
27
28 import 'fletch_context.dart';
29 import 'function_codegen.dart';
30 import 'debug_info.dart';
31
32 class DebugInfoFunctionCodegen extends FunctionCodegen with DebugRegistry {
33 final FletchCompilerImplementation compiler;
34 final DebugInfo debugInfo;
35
36 DebugInfoFunctionCodegen(this.debugInfo,
37 FletchFunctionBuilder functionBuilder,
38 FletchContext context,
39 TreeElements elements,
40 ClosureEnvironment closureEnvironment,
41 FunctionElement function,
42 this.compiler)
43 : super(functionBuilder, context, elements, null,
44 closureEnvironment, function) {
45 if (functionBuilder.isInstanceMember) pushVariableDeclaration(thisValue);
46 }
47
48 void recordDebugInfo(Node node) {
49 debugInfo.addLocation(compiler, assembler.byteSize, node);
50 }
51
52 void pushVariableDeclaration(LocalValue value) {
53 super.pushVariableDeclaration(value);
54 debugInfo.pushScope(assembler.byteSize, value);
55 }
56
57 void popVariableDeclaration(Element element) {
58 super.popVariableDeclaration(element);
59 debugInfo.popScope(assembler.byteSize);
60 }
61
62 void callIsSelector(
63 Node node,
64 DartType type,
65 Spannable diagnosticLocation) {
66 recordDebugInfo(node);
67 super.callIsSelector(node, type, diagnosticLocation);
68 }
69
70 void invokeMethod(Node node, Selector selector) {
71 recordDebugInfo(node);
72 super.invokeMethod(node, selector);
73 }
74
75 void invokeGetter(Node node, Name name) {
76 recordDebugInfo(node);
77 super.invokeGetter(node, name);
78 }
79
80 void invokeSetter(Node node, Name name) {
81 recordDebugInfo(node);
82 super.invokeSetter(node, name);
83 }
84
85 void invokeFactory(Node node, int constId, int arity) {
86 recordDebugInfo(node);
87 super.invokeFactory(node, constId, arity);
88 }
89
90 void invokeStatic(Node node, int constId, int arity) {
91 recordDebugInfo(node);
92 super.invokeStatic(node, constId, arity);
93 }
94
95 void generateReturn(Node node) {
96 recordDebugInfo(node);
97 super.generateReturn(node);
98 }
99
100 void generateReturnNull(Node node) {
101 recordDebugInfo(node);
102 super.generateReturnNull(node);
103 }
104
105 void generateImplicitReturn(FunctionExpression node) {
106 // If the method is empty, generate debug information for the
107 // implicit 'return null' that covers the entire method. That was,
108 // the debugger will use the entire (empty) method as the source
109 // listing is a breakpoint is set in the method.
110 if (node.body is Block) {
111 Block body = node.body;
112 if (body.statements.isEmpty) recordDebugInfo(node);
113 }
114 super.generateImplicitReturn(node);
115 }
116
117 void generateSwitchCaseMatch(CaseMatch caseMatch, BytecodeLabel ifTrue) {
118 // We do not want to break on the evaluation of the individual
119 // case equality tests.
120 recordDebugInfo(null);
121 super.generateSwitchCaseMatch(caseMatch, ifTrue);
122 }
123
124 void generateEmptyInitializer(Node node) {
125 recordDebugInfo(node);
126 super.generateEmptyInitializer(node);
127 }
128
129 void generateIdentical(Node node) {
130 recordDebugInfo(node);
131 super.generateIdentical(node);
132 }
133
134 void generateIdenticalNonNumeric(Node node) {
135 recordDebugInfo(node);
136 super.generateIdenticalNonNumeric(node);
137 }
138
139 void generateThrow(Node node) {
140 recordDebugInfo(node);
141 super.generateThrow(node);
142 }
143
144 void visitForValue(Node node) {
145 recordDebugInfo(node);
146 super.visitForValue(node);
147 }
148
149 void visitForEffect(Node node) {
150 recordDebugInfo(node);
151 super.visitForEffect(node);
152 }
153 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698