| OLD | NEW |
| 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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 | 103 |
| 104 // Put the primitive in scope when visiting the body. | 104 // Put the primitive in scope when visiting the body. |
| 105 enterScope([node.primitive]); | 105 enterScope([node.primitive]); |
| 106 | 106 |
| 107 return node.body; | 107 return node.body; |
| 108 } | 108 } |
| 109 | 109 |
| 110 @override | 110 @override |
| 111 Expression traverseLetMutable(LetMutable node) { | 111 Expression traverseLetMutable(LetMutable node) { |
| 112 handleDeclaration(node.variable); | 112 handleDeclaration(node.variable); |
| 113 processReference(node.value); | 113 processReference(node.valueRef); |
| 114 | 114 |
| 115 // Put the primitive in scope when visiting the body. | 115 // Put the primitive in scope when visiting the body. |
| 116 enterScope([node.variable]); | 116 enterScope([node.variable]); |
| 117 | 117 |
| 118 return node.body; | 118 return node.body; |
| 119 } | 119 } |
| 120 | 120 |
| 121 @override | 121 @override |
| 122 Expression traverseContinuation(Continuation cont) { | 122 Expression traverseContinuation(Continuation cont) { |
| 123 if (cont.isReturnContinuation) { | 123 if (cont.isReturnContinuation) { |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 } | 159 } |
| 160 if (ref.previous == null && def.firstRef != ref || | 160 if (ref.previous == null && def.firstRef != ref || |
| 161 ref.previous != null && ref.previous.next != ref) { | 161 ref.previous != null && ref.previous.next != ref) { |
| 162 error('Broken .previous link in reference to $def', def); | 162 error('Broken .previous link in reference to $def', def); |
| 163 } | 163 } |
| 164 ref.previous = ref; // Mark reference as "seen". We will repair it later. | 164 ref.previous = ref; // Mark reference as "seen". We will repair it later. |
| 165 } | 165 } |
| 166 | 166 |
| 167 @override | 167 @override |
| 168 processInvokeContinuation(InvokeContinuation node) { | 168 processInvokeContinuation(InvokeContinuation node) { |
| 169 Continuation target = node.continuation.definition; | 169 Continuation target = node.continuation; |
| 170 if (node.isRecursive && inScope[target] == ScopeType.InScope) { | 170 if (node.isRecursive && inScope[target] == ScopeType.InScope) { |
| 171 error('Non-recursive InvokeContinuation marked as recursive', node); | 171 error('Non-recursive InvokeContinuation marked as recursive', node); |
| 172 } | 172 } |
| 173 if (!node.isRecursive && inScope[target] == ScopeType.InDefinition) { | 173 if (!node.isRecursive && inScope[target] == ScopeType.InDefinition) { |
| 174 error('Recursive InvokeContinuation marked as non-recursive', node); | 174 error('Recursive InvokeContinuation marked as non-recursive', node); |
| 175 } | 175 } |
| 176 if (node.isRecursive && !target.isRecursive) { | 176 if (node.isRecursive && !target.isRecursive) { |
| 177 error('Recursive Continuation was not marked as recursive', node); | 177 error('Recursive Continuation was not marked as recursive', node); |
| 178 } | 178 } |
| 179 if (node.arguments.length != target.parameters.length) { | 179 if (node.argumentRefs.length != target.parameters.length) { |
| 180 error('Arity mismatch in InvokeContinuation', node); | 180 error('Arity mismatch in InvokeContinuation', node); |
| 181 } | 181 } |
| 182 } | 182 } |
| 183 | 183 |
| 184 void checkReferenceChain(Definition def) { | 184 void checkReferenceChain(Definition def) { |
| 185 Reference previous = null; | 185 Reference previous = null; |
| 186 for (Reference ref = def.firstRef; ref != null; ref = ref.next) { | 186 for (Reference ref = def.firstRef; ref != null; ref = ref.next) { |
| 187 if (ref.previous != ref) { | 187 if (ref.previous != ref) { |
| 188 // Reference was not seen during IR traversal, so it is orphaned. | 188 // Reference was not seen during IR traversal, so it is orphaned. |
| 189 error('Orphaned reference in reference chain for $def', def); | 189 error('Orphaned reference in reference chain for $def', def); |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 } | 248 } |
| 249 | 249 |
| 250 @override | 250 @override |
| 251 processReference(Reference node) { | 251 processReference(Reference node) { |
| 252 if (node.parent != _parent) { | 252 if (node.parent != _parent) { |
| 253 error('Parent pointer on $node is ${node.parent} but should be $_parent', | 253 error('Parent pointer on $node is ${node.parent} but should be $_parent', |
| 254 node); | 254 node); |
| 255 } | 255 } |
| 256 } | 256 } |
| 257 } | 257 } |
| OLD | NEW |