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

Side by Side Diff: pkg/compiler/lib/src/tree_ir/tree_ir_integrity.dart

Issue 1088493002: Assignment expressions in tree IR. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Comments Created 5 years, 8 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 tree_ir.integrity; 1 library tree_ir.integrity;
2 2
3 import 'tree_ir_nodes.dart'; 3 import 'tree_ir_nodes.dart';
4 4
5 /// Performs integrity checks on the tree_ir. 5 /// Performs integrity checks on the tree_ir.
6 /// 6 ///
7 /// Should only be run for debugging purposes, not in production. 7 /// Should only be run for debugging purposes, not in production.
8 /// 8 ///
9 /// - Reference counts on must match the actual number of references. 9 /// - Reference counts on must match the actual number of references.
10 /// - Labels must be in scope when referenced. 10 /// - Labels must be in scope when referenced.
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 } 58 }
59 59
60 void undeclare(Variable variable) { 60 void undeclare(Variable variable) {
61 scope.remove(variable); 61 scope.remove(variable);
62 } 62 }
63 63
64 visitVariableUse(VariableUse node) { 64 visitVariableUse(VariableUse node) {
65 read(node.variable); 65 read(node.variable);
66 } 66 }
67 67
68 visitVariableDeclaration(VariableDeclaration node) {
69 visitExpression(node.value);
70 declare(node.variable);
71 visitStatement(node.next);
72 undeclare(node.variable);
73 }
74
68 visitAssign(Assign node) { 75 visitAssign(Assign node) {
69 visitExpression(node.value); 76 visitExpression(node.value);
70 if (node.isDeclaration) { 77 write(node.variable);
71 declare(node.variable);
72 } else {
73 write(node.variable);
74 }
75 visitStatement(node.next);
76 if (node.isDeclaration) {
77 undeclare(node.variable);
78 }
79 } 78 }
80 79
81 visitTry(Try node) { 80 visitTry(Try node) {
82 visitStatement(node.tryBody); 81 visitStatement(node.tryBody);
83 node.catchParameters.forEach(declare); 82 node.catchParameters.forEach(declare);
84 visitStatement(node.catchBody); 83 visitStatement(node.catchBody);
85 node.catchParameters.forEach(undeclare); 84 node.catchParameters.forEach(undeclare);
86 } 85 }
87 86
88 visitFunctionDeclaration(FunctionDeclaration node) { 87 visitFunctionDeclaration(FunctionDeclaration node) {
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 if (reads != variable.readCount || writes != variable.writeCount) { 173 if (reads != variable.readCount || writes != variable.writeCount) {
175 error('Invalid reference count for $variable:\n' 174 error('Invalid reference count for $variable:\n'
176 '- Variable has $reads reads and $writes writes\n' 175 '- Variable has $reads reads and $writes writes\n'
177 '- Reference count is ${variable.readCount} reads and ' 176 '- Reference count is ${variable.readCount} reads and '
178 '${variable.writeCount} writes'); 177 '${variable.writeCount} writes');
179 } 178 }
180 } 179 }
181 } 180 }
182 181
183 } 182 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/tree_ir/tree_ir_builder.dart ('k') | pkg/compiler/lib/src/tree_ir/tree_ir_nodes.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698