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

Side by Side Diff: pkg/compiler/lib/src/cps_ir/cps_ir_integrity.dart

Issue 1021813002: Redo "Use an explicit 'this' parameter instead of 'This' nodes." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 9 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 | Annotate | Revision Log
OLDNEW
1 library dart2js.cps_ir_integrity; 1 library dart2js.cps_ir_integrity;
2 2
3 import 'cps_ir_nodes.dart'; 3 import 'cps_ir_nodes.dart';
4 import 'cps_ir_nodes_sexpr.dart'; 4 import 'cps_ir_nodes_sexpr.dart';
5 import '../tracer.dart' as tracer; 5 import '../tracer.dart' as tracer;
6 6
7 /// Dump S-expressions on error if the tracer is enabled. 7 /// Dump S-expressions on error if the tracer is enabled.
8 /// 8 ///
9 /// Technically this has nothing to do with the tracer, but if you want one 9 /// Technically this has nothing to do with the tracer, but if you want one
10 /// enabled, you typically want the other as well, so we use the same flag. 10 /// enabled, you typically want the other as well, so we use the same flag.
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 95
96 @override 96 @override
97 visitLetMutable(LetMutable node) { 97 visitLetMutable(LetMutable node) {
98 markAsSeen(node.variable); 98 markAsSeen(node.variable);
99 processReference(node.value); 99 processReference(node.value);
100 doInScope([node.variable], node, () => visit(node.body)); 100 doInScope([node.variable], node, () => visit(node.body));
101 } 101 }
102 102
103 @override 103 @override
104 visitFunctionDefinition(FunctionDefinition node) { 104 visitFunctionDefinition(FunctionDefinition node) {
105 if (node.thisParameter != null) {
106 markAsSeen(node.thisParameter);
107 }
105 node.parameters.forEach(markAsSeen); 108 node.parameters.forEach(markAsSeen);
106 if (node.body != null) { 109 if (node.body != null) {
107 doInScope(node.parameters, node, () => visit(node.body)); 110 doInOptionalScope(node.thisParameter, node,
111 () => doInScope(node.parameters, node, () => visit(node.body)));
108 } 112 }
109 } 113 }
110 114
111 @override 115 @override
112 visitConstructorDefinition(ConstructorDefinition node) { 116 visitConstructorDefinition(ConstructorDefinition node) {
117 if (node.thisParameter != null) {
118 markAsSeen(node.thisParameter);
119 }
113 node.parameters.forEach(markAsSeen); 120 node.parameters.forEach(markAsSeen);
114 doInScope(node.parameters, node, () { 121 doInScope(node.parameters, node, () {
115 if (node.initializers != null) node.initializers.forEach(visit); 122 if (node.initializers != null) node.initializers.forEach(visit);
116 if (node.body != null) visit(node.body); 123 if (node.body != null) {
124 doInOptionalScope(node.thisParameter, node, () => visit(node.body));
125 }
117 }); 126 });
118 } 127 }
119 128
129 doInOptionalScope(Parameter parameter, Node node, action) {
130 return (parameter == null)
131 ? action()
132 : doInScope([parameter], node, action);
133 }
134
120 @override 135 @override
121 visitDeclareFunction(DeclareFunction node) { 136 visitDeclareFunction(DeclareFunction node) {
122 markAsSeen(node.variable); 137 markAsSeen(node.variable);
123 doInScope([node.variable], node, () { 138 doInScope([node.variable], node, () {
124 visit(node.definition); 139 visit(node.definition);
125 visit(node.body); 140 visit(node.body);
126 }); 141 });
127 } 142 }
128 143
129 @override 144 @override
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 void check(ExecutableDefinition node) { 212 void check(ExecutableDefinition node) {
198 topLevelNode = node; 213 topLevelNode = node;
199 visit(node); 214 visit(node);
200 215
201 // Check this last, so out-of-scope references are not classified as 216 // Check this last, so out-of-scope references are not classified as
202 // a broken reference chain. 217 // a broken reference chain.
203 seenDefinitions.forEach(checkReferenceChain); 218 seenDefinitions.forEach(checkReferenceChain);
204 } 219 }
205 220
206 } 221 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/cps_ir/cps_ir_builder_task.dart ('k') | pkg/compiler/lib/src/cps_ir/cps_ir_nodes.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698