| 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 | 7 | 
| 8 void runSanityChecks(Program program) { | 8 void runSanityChecks(Program program) { | 
| 9   CheckParentPointers.check(program); | 9   CheckParentPointers.check(program); | 
| 10   CheckReferences.check(program); | 10   CheckReferences.check(program); | 
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 68 | 68 | 
| 69   visitClass(Class node) { | 69   visitClass(Class node) { | 
| 70     currentClass = node; | 70     currentClass = node; | 
| 71     typeParameters.addAll(node.typeParameters); | 71     typeParameters.addAll(node.typeParameters); | 
| 72     node.visitChildren(this); | 72     node.visitChildren(this); | 
| 73     typeParameters.removeAll(node.typeParameters); | 73     typeParameters.removeAll(node.typeParameters); | 
| 74     currentClass = null; | 74     currentClass = null; | 
| 75   } | 75   } | 
| 76 | 76 | 
| 77   visitFunctionNode(FunctionNode node) { | 77   visitFunctionNode(FunctionNode node) { | 
|  | 78     for (int i = 1; i < node.namedParameters.length; ++i) { | 
|  | 79       if (node.namedParameters[i - 1].compareTo(node.namedParameters[i]) >= 0) { | 
|  | 80         throw 'Named parameters are not sorted on function found in $context'; | 
|  | 81       } | 
|  | 82     } | 
| 78     typeParameters.addAll(node.typeParameters); | 83     typeParameters.addAll(node.typeParameters); | 
| 79     node.visitChildren(this); | 84     node.visitChildren(this); | 
| 80     typeParameters.removeAll(node.typeParameters); | 85     typeParameters.removeAll(node.typeParameters); | 
| 81   } | 86   } | 
| 82 | 87 | 
|  | 88   visitFunctionType(FunctionType node) { | 
|  | 89     for (int i = 1; i < node.namedParameters.length; ++i) { | 
|  | 90       if (node.namedParameters[i - 1].compareTo(node.namedParameters[i]) >= 0) { | 
|  | 91         throw 'Named parameters are not sorted on function type found in ' | 
|  | 92             '$context'; | 
|  | 93       } | 
|  | 94     } | 
|  | 95     node.visitChildren(this); | 
|  | 96   } | 
|  | 97 | 
| 83   @override | 98   @override | 
| 84   defaultMemberReference(Member node) { | 99   defaultMemberReference(Member node) { | 
| 85     if (!members.contains(node)) { | 100     if (!members.contains(node)) { | 
| 86       throw 'Dangling reference to $node found in $context.\n' | 101       throw 'Dangling reference to $node found in $context.\n' | 
| 87           'Parent pointer is set to ${node.parent}'; | 102           'Parent pointer is set to ${node.parent}'; | 
| 88     } | 103     } | 
| 89   } | 104   } | 
| 90 | 105 | 
| 91   @override | 106   @override | 
| 92   visitClassReference(Class node) { | 107   visitClassReference(Class node) { | 
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 129         node.types.isEmpty) { | 144         node.types.isEmpty) { | 
| 130       ++emptyArguments; | 145       ++emptyArguments; | 
| 131     } | 146     } | 
| 132   } | 147   } | 
| 133 | 148 | 
| 134   defaultNode(Node node) { | 149   defaultNode(Node node) { | 
| 135     ++size; | 150     ++size; | 
| 136     node.visitChildren(this); | 151     node.visitChildren(this); | 
| 137   } | 152   } | 
| 138 } | 153 } | 
| OLD | NEW | 
|---|