| Index: pkg/compiler/lib/src/tree_ir/tree_ir_integrity.dart
|
| diff --git a/pkg/compiler/lib/src/tree_ir/tree_ir_integrity.dart b/pkg/compiler/lib/src/tree_ir/tree_ir_integrity.dart
|
| index 20225c932f89b0efb76ce4f5d9d1d4bceaae83ab..5afd2da9d73baaec13081fe6f81a3f870cbfc49c 100644
|
| --- a/pkg/compiler/lib/src/tree_ir/tree_ir_integrity.dart
|
| +++ b/pkg/compiler/lib/src/tree_ir/tree_ir_integrity.dart
|
| @@ -16,7 +16,7 @@ import 'tree_ir_nodes.dart';
|
| /// - Variables must not have more than one declaration.
|
| ///
|
| class CheckTreeIntegrity extends RecursiveVisitor {
|
| - RootNode topLevelNode;
|
| + FunctionDefinition topLevelNode;
|
|
|
| Map<Variable, int> varReads = <Variable, int>{};
|
| Map<Variable, int> varWrites = <Variable, int>{};
|
| @@ -65,13 +65,6 @@ class CheckTreeIntegrity extends RecursiveVisitor {
|
| read(node.variable);
|
| }
|
|
|
| - visitVariableDeclaration(VariableDeclaration node) {
|
| - visitExpression(node.value);
|
| - declare(node.variable);
|
| - visitStatement(node.next);
|
| - undeclare(node.variable);
|
| - }
|
| -
|
| visitAssign(Assign node) {
|
| visitExpression(node.value);
|
| write(node.variable);
|
| @@ -84,16 +77,6 @@ class CheckTreeIntegrity extends RecursiveVisitor {
|
| node.catchParameters.forEach(undeclare);
|
| }
|
|
|
| - visitFunctionDeclaration(FunctionDeclaration node) {
|
| - declare(node.variable);
|
| - checkBody(node.definition);
|
| - visitStatement(node.next);
|
| - undeclare(node.variable);
|
| - if (varWrites[node.variable] > 1) {
|
| - error('Assignment to function declaration ${node.variable}');
|
| - }
|
| - }
|
| -
|
| visitJumpTargetBody(JumpTarget target) {
|
| Label label = target.label;
|
| if (label2declaration.containsKey(label)) {
|
| @@ -149,9 +132,9 @@ class CheckTreeIntegrity extends RecursiveVisitor {
|
| checkBody(node);
|
| }
|
|
|
| - void checkBody(RootNode node) {
|
| + void checkBody(FunctionDefinition node) {
|
| node.parameters.forEach(declare);
|
| - node.forEachBody(visitStatement);
|
| + visitStatement(node.body);
|
| node.parameters.forEach(undeclare);
|
| }
|
|
|
| @@ -159,7 +142,7 @@ class CheckTreeIntegrity extends RecursiveVisitor {
|
| throw 'Tree IR integrity violation in ${topLevelNode.element}:\n$message';
|
| }
|
|
|
| - void check(RootNode node) {
|
| + void check(FunctionDefinition node) {
|
| topLevelNode = node;
|
| checkBody(node);
|
|
|
|
|