OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 | 4 |
5 part of js_ast; | 5 part of js_ast; |
6 | 6 |
7 abstract class NodeVisitor<T> { | 7 abstract class NodeVisitor<T> { |
8 T visitProgram(Program node); | 8 T visitProgram(Program node); |
9 | 9 |
10 T visitBlock(Block node); | 10 T visitBlock(Block node); |
(...skipping 1183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1194 int get precedenceLevel => PRIMARY; | 1194 int get precedenceLevel => PRIMARY; |
1195 } | 1195 } |
1196 | 1196 |
1197 class Method extends Property { | 1197 class Method extends Property { |
1198 final bool isGetter; | 1198 final bool isGetter; |
1199 final bool isSetter; | 1199 final bool isSetter; |
1200 final bool isStatic; | 1200 final bool isStatic; |
1201 | 1201 |
1202 Method(Expression name, Fun function, | 1202 Method(Expression name, Fun function, |
1203 {this.isGetter: false, this.isSetter: false, this.isStatic: false}) | 1203 {this.isGetter: false, this.isSetter: false, this.isStatic: false}) |
1204 : super(name, function); | 1204 : super(name, function) { |
| 1205 assert(!isGetter || function.params.length == 0); |
| 1206 assert(!isSetter || function.params.length == 1); |
| 1207 } |
1205 | 1208 |
1206 Fun get function => super.value; | 1209 Fun get function => super.value; |
1207 | 1210 |
1208 accept(NodeVisitor visitor) => visitor.visitMethod(this); | 1211 accept(NodeVisitor visitor) => visitor.visitMethod(this); |
1209 | 1212 |
1210 void visitChildren(NodeVisitor visitor) { | 1213 void visitChildren(NodeVisitor visitor) { |
1211 name.accept(visitor); | 1214 name.accept(visitor); |
1212 function.accept(visitor); | 1215 function.accept(visitor); |
1213 } | 1216 } |
1214 | 1217 |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1404 final Expression expression; | 1407 final Expression expression; |
1405 | 1408 |
1406 CommentExpression(this.comment, this.expression); | 1409 CommentExpression(this.comment, this.expression); |
1407 | 1410 |
1408 int get precedenceLevel => PRIMARY; | 1411 int get precedenceLevel => PRIMARY; |
1409 accept(NodeVisitor visitor) => visitor.visitCommentExpression(this); | 1412 accept(NodeVisitor visitor) => visitor.visitCommentExpression(this); |
1410 CommentExpression _clone() => new CommentExpression(comment, expression); | 1413 CommentExpression _clone() => new CommentExpression(comment, expression); |
1411 | 1414 |
1412 void visitChildren(NodeVisitor visitor) => expression.accept(visitor); | 1415 void visitChildren(NodeVisitor visitor) => expression.accept(visitor); |
1413 } | 1416 } |
OLD | NEW |