| 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 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 | 330 |
| 331 visitVariableDeclaration(VariableDeclaration node) { | 331 visitVariableDeclaration(VariableDeclaration node) { |
| 332 var parent = node.parent; | 332 var parent = node.parent; |
| 333 if (parent is! Block && | 333 if (parent is! Block && |
| 334 !(parent is Catch && parent.body != node) && | 334 !(parent is Catch && parent.body != node) && |
| 335 !(parent is FunctionNode && parent.body != node) && | 335 !(parent is FunctionNode && parent.body != node) && |
| 336 parent is! FunctionDeclaration && | 336 parent is! FunctionDeclaration && |
| 337 !(parent is ForStatement && parent.body != node) && | 337 !(parent is ForStatement && parent.body != node) && |
| 338 !(parent is ForInStatement && parent.body != node) && | 338 !(parent is ForInStatement && parent.body != node) && |
| 339 parent is! Let && | 339 parent is! Let && |
| 340 parent is! LocalInitializer && | 340 parent is! LocalInitializer) { |
| 341 parent is! Typedef) { | |
| 342 problem( | 341 problem( |
| 343 node, | 342 node, |
| 344 "VariableDeclaration must be a direct child of a Block, " | 343 "VariableDeclaration must be a direct child of a Block, " |
| 345 "not ${parent.runtimeType}."); | 344 "not ${parent.runtimeType}."); |
| 346 } | 345 } |
| 347 visitChildren(node); | 346 visitChildren(node); |
| 348 declareVariable(node); | 347 declareVariable(node); |
| 349 } | 348 } |
| 350 | 349 |
| 351 visitVariableGet(VariableGet node) { | 350 visitVariableGet(VariableGet node) { |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 602 var oldParent = parent; | 601 var oldParent = parent; |
| 603 parent = node; | 602 parent = node; |
| 604 node.visitChildren(this); | 603 node.visitChildren(this); |
| 605 parent = oldParent; | 604 parent = oldParent; |
| 606 } | 605 } |
| 607 } | 606 } |
| 608 | 607 |
| 609 void checkInitializers(Constructor constructor) { | 608 void checkInitializers(Constructor constructor) { |
| 610 // TODO(ahe): I'll add more here in other CLs. | 609 // TODO(ahe): I'll add more here in other CLs. |
| 611 } | 610 } |
| OLD | NEW |