| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 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 file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 library kernel.checks; | 4 library kernel.checks; |
| 5 | 5 |
| 6 import 'ast.dart'; | 6 import 'ast.dart'; |
| 7 import 'transformations/flags.dart'; | 7 import 'transformations/flags.dart'; |
| 8 | 8 |
| 9 void verifyProgram(Program program) { | 9 void verifyProgram(Program program) { |
| 10 VerifyingVisitor.check(program); | 10 VerifyingVisitor.check(program); |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 problem(TreeNode node, String details, {TreeNode context}) { | 74 problem(TreeNode node, String details, {TreeNode context}) { |
| 75 context ??= this.context; | 75 context ??= this.context; |
| 76 throw new VerificationError(context, node, details); | 76 throw new VerificationError(context, node, details); |
| 77 } | 77 } |
| 78 | 78 |
| 79 TreeNode enterParent(TreeNode node) { | 79 TreeNode enterParent(TreeNode node) { |
| 80 if (!identical(node.parent, currentParent)) { | 80 if (!identical(node.parent, currentParent)) { |
| 81 problem( | 81 problem( |
| 82 node, | 82 node, |
| 83 "Incorrect parent pointer on ${node.runtimeType}:" | 83 "Incorrect parent pointer on ${node.runtimeType}:" |
| 84 " expected '${node.parent.runtimeType}'," | 84 " expected '${currentParent.runtimeType}'," |
| 85 " but found: '${currentParent.runtimeType}'."); | 85 " but found: '${node.parent.runtimeType}'."); |
| 86 } | 86 } |
| 87 var oldParent = currentParent; | 87 var oldParent = currentParent; |
| 88 currentParent = node; | 88 currentParent = node; |
| 89 return oldParent; | 89 return oldParent; |
| 90 } | 90 } |
| 91 | 91 |
| 92 void exitParent(TreeNode oldParent) { | 92 void exitParent(TreeNode oldParent) { |
| 93 currentParent = oldParent; | 93 currentParent = oldParent; |
| 94 } | 94 } |
| 95 | 95 |
| (...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 601 var oldParent = parent; | 601 var oldParent = parent; |
| 602 parent = node; | 602 parent = node; |
| 603 node.visitChildren(this); | 603 node.visitChildren(this); |
| 604 parent = oldParent; | 604 parent = oldParent; |
| 605 } | 605 } |
| 606 } | 606 } |
| 607 | 607 |
| 608 void checkInitializers(Constructor constructor) { | 608 void checkInitializers(Constructor constructor) { |
| 609 // TODO(ahe): I'll add more here in other CLs. | 609 // TODO(ahe): I'll add more here in other CLs. |
| 610 } | 610 } |
| OLD | NEW |