| 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 1120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1131 Fun _clone() => new Fun(params, body, | 1131 Fun _clone() => new Fun(params, body, |
| 1132 isGenerator: isGenerator, asyncModifier: asyncModifier); | 1132 isGenerator: isGenerator, asyncModifier: asyncModifier); |
| 1133 | 1133 |
| 1134 int get precedenceLevel => PRIMARY_LOW_PRECEDENCE; | 1134 int get precedenceLevel => PRIMARY_LOW_PRECEDENCE; |
| 1135 } | 1135 } |
| 1136 | 1136 |
| 1137 class ArrowFun extends FunctionExpression { | 1137 class ArrowFun extends FunctionExpression { |
| 1138 final List<Parameter> params; | 1138 final List<Parameter> params; |
| 1139 final body; // Expression or Block | 1139 final body; // Expression or Block |
| 1140 | 1140 |
| 1141 bool _closesOverThis; // lazy initialized | |
| 1142 | |
| 1143 ArrowFun(this.params, this.body); | 1141 ArrowFun(this.params, this.body); |
| 1144 | 1142 |
| 1145 accept(NodeVisitor visitor) => visitor.visitArrowFun(this); | 1143 accept(NodeVisitor visitor) => visitor.visitArrowFun(this); |
| 1146 | 1144 |
| 1147 void visitChildren(NodeVisitor visitor) { | 1145 void visitChildren(NodeVisitor visitor) { |
| 1148 for (Parameter param in params) param.accept(visitor); | 1146 for (Parameter param in params) param.accept(visitor); |
| 1149 body.accept(visitor); | 1147 body.accept(visitor); |
| 1150 } | 1148 } |
| 1151 /// True if this function actually closes of `this`. We use this in some | |
| 1152 /// situations to generate different code. | |
| 1153 bool get closesOverThis { | |
| 1154 if (_closesOverThis == null) _closesOverThis = This.foundIn(this); | |
| 1155 return _closesOverThis; | |
| 1156 } | |
| 1157 | 1149 |
| 1158 int get precedenceLevel => PRIMARY_LOW_PRECEDENCE; | 1150 int get precedenceLevel => PRIMARY_LOW_PRECEDENCE; |
| 1159 | 1151 |
| 1160 ArrowFun _clone() => new ArrowFun(params, body); | 1152 ArrowFun _clone() => new ArrowFun(params, body); |
| 1161 } | 1153 } |
| 1162 | 1154 |
| 1163 /** | 1155 /** |
| 1164 * The Dart sync, sync*, async, and async* modifier. | 1156 * The Dart sync, sync*, async, and async* modifier. |
| 1165 * See [DartYield]. | 1157 * See [DartYield]. |
| 1166 * | 1158 * |
| (...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1763 | 1755 |
| 1764 final List<ModuleItem> body; | 1756 final List<ModuleItem> body; |
| 1765 Module(this.body, {this.name}); | 1757 Module(this.body, {this.name}); |
| 1766 | 1758 |
| 1767 accept(NodeVisitor visitor) => visitor.visitModule(this); | 1759 accept(NodeVisitor visitor) => visitor.visitModule(this); |
| 1768 void visitChildren(NodeVisitor visitor) { | 1760 void visitChildren(NodeVisitor visitor) { |
| 1769 for (ModuleItem item in body) item.accept(visitor); | 1761 for (ModuleItem item in body) item.accept(visitor); |
| 1770 } | 1762 } |
| 1771 Module _clone() => new Module(body); | 1763 Module _clone() => new Module(body); |
| 1772 } | 1764 } |
| OLD | NEW |