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> implements TypeRefVisitor<T> { | 7 abstract class NodeVisitor<T> implements TypeRefVisitor<T> { |
8 T visitProgram(Program node); | 8 T visitProgram(Program node); |
9 | 9 |
10 T visitBlock(Block node); | 10 T visitBlock(Block node); |
(...skipping 1157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1168 List<Identifier> get typeParams; | 1168 List<Identifier> get typeParams; |
1169 /// Return type of this function, if any. `null` otherwise. | 1169 /// Return type of this function, if any. `null` otherwise. |
1170 TypeRef get returnType; | 1170 TypeRef get returnType; |
1171 } | 1171 } |
1172 | 1172 |
1173 class Fun extends FunctionExpression { | 1173 class Fun extends FunctionExpression { |
1174 final List<Parameter> params; | 1174 final List<Parameter> params; |
1175 final Block body; | 1175 final Block body; |
1176 @override final List<Identifier> typeParams; | 1176 @override final List<Identifier> typeParams; |
1177 @override final TypeRef returnType; | 1177 @override final TypeRef returnType; |
| 1178 |
1178 /** Whether this is a JS generator (`function*`) that may contain `yield`. */ | 1179 /** Whether this is a JS generator (`function*`) that may contain `yield`. */ |
1179 final bool isGenerator; | 1180 final bool isGenerator; |
1180 | 1181 |
1181 final AsyncModifier asyncModifier; | 1182 final AsyncModifier asyncModifier; |
1182 | 1183 |
1183 Fun(this.params, this.body, {this.isGenerator: false, | 1184 Fun(this.params, this.body, {this.isGenerator: false, |
1184 this.asyncModifier: const AsyncModifier.sync(), | 1185 this.asyncModifier: const AsyncModifier.sync(), |
1185 this.typeParams, this.returnType}); | 1186 this.typeParams, this.returnType}); |
1186 | 1187 |
1187 accept(NodeVisitor visitor) => visitor.visitFun(this); | 1188 accept(NodeVisitor visitor) => visitor.visitFun(this); |
(...skipping 676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1864 | 1865 |
1865 final List<ModuleItem> body; | 1866 final List<ModuleItem> body; |
1866 Module(this.body, {this.name}); | 1867 Module(this.body, {this.name}); |
1867 | 1868 |
1868 accept(NodeVisitor visitor) => visitor.visitModule(this); | 1869 accept(NodeVisitor visitor) => visitor.visitModule(this); |
1869 void visitChildren(NodeVisitor visitor) { | 1870 void visitChildren(NodeVisitor visitor) { |
1870 for (ModuleItem item in body) item.accept(visitor); | 1871 for (ModuleItem item in body) item.accept(visitor); |
1871 } | 1872 } |
1872 Module _clone() => new Module(body); | 1873 Module _clone() => new Module(body); |
1873 } | 1874 } |
OLD | NEW |