OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 // IrNodes are kept in a separate library to have precise control over their | 5 // IrNodes are kept in a separate library to have precise control over their |
6 // dependencies on other parts of the system. | 6 // dependencies on other parts of the system. |
7 library dart2js.ir_nodes; | 7 library dart2js.ir_nodes; |
8 | 8 |
9 import '../dart2jslib.dart' as dart2js show Constant, ConstructedConstant, | 9 import '../dart2jslib.dart' as dart2js show Constant, ConstructedConstant, |
10 StringConstant, ListConstant, MapConstant; | 10 StringConstant, ListConstant, MapConstant; |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 (selector.kind == SelectorKind.INDEX && arguments.length == 1) || | 198 (selector.kind == SelectorKind.INDEX && arguments.length == 1) || |
199 (selector.kind == SelectorKind.INDEX && arguments.length == 2)); | 199 (selector.kind == SelectorKind.INDEX && arguments.length == 2)); |
200 } | 200 } |
201 | 201 |
202 accept(Visitor visitor) => visitor.visitInvokeSuperMethod(this); | 202 accept(Visitor visitor) => visitor.visitInvokeSuperMethod(this); |
203 } | 203 } |
204 | 204 |
205 /// Non-const call to a constructor. The [target] may be a generative | 205 /// Non-const call to a constructor. The [target] may be a generative |
206 /// constructor, factory, or redirecting factory. | 206 /// constructor, factory, or redirecting factory. |
207 class InvokeConstructor extends Expression implements Invoke { | 207 class InvokeConstructor extends Expression implements Invoke { |
208 final GenericType type; | 208 final DartType type; |
209 final FunctionElement target; | 209 final FunctionElement target; |
210 final Reference continuation; | 210 final Reference continuation; |
211 final List<Reference> arguments; | 211 final List<Reference> arguments; |
212 final Selector selector; | 212 final Selector selector; |
213 | 213 |
214 /// The class being instantiated. This is the same as `target.enclosingClass` | 214 /// The class being instantiated. This is the same as `target.enclosingClass` |
215 /// and `type.element`. | 215 /// and `type.element`. |
216 ClassElement get targetClass => target.enclosingElement; | 216 ClassElement get targetClass => target.enclosingElement; |
217 | 217 |
218 /// True if this is an invocation of a factory constructor. | 218 /// True if this is an invocation of a factory constructor. |
219 bool get isFactory => target.isFactoryConstructor; | 219 bool get isFactory => target.isFactoryConstructor; |
220 | 220 |
221 InvokeConstructor(this.type, | 221 InvokeConstructor(this.type, |
222 this.target, | 222 this.target, |
223 this.selector, | 223 this.selector, |
224 Continuation cont, | 224 Continuation cont, |
225 List<Definition> args) | 225 List<Definition> args) |
226 : continuation = new Reference(cont), | 226 : continuation = new Reference(cont), |
227 arguments = _referenceList(args) { | 227 arguments = _referenceList(args) { |
228 assert(target.isConstructor); | 228 assert(target.isErroneous || target.isConstructor); |
229 assert(type.element == target.enclosingElement); | 229 assert((target.isErroneous && type.isDynamic) || |
| 230 type.element == target.enclosingElement); |
230 } | 231 } |
231 | 232 |
232 accept(Visitor visitor) => visitor.visitInvokeConstructor(this); | 233 accept(Visitor visitor) => visitor.visitInvokeConstructor(this); |
233 } | 234 } |
234 | 235 |
235 class AsCast extends Expression { | 236 class AsCast extends Expression { |
236 final Reference receiver; | 237 final Reference receiver; |
237 final DartType type; | 238 final DartType type; |
238 final Reference continuation; | 239 final Reference continuation; |
239 | 240 |
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
727 for (int i = node.parameters.length - 1; i >= 0; --i) { | 728 for (int i = node.parameters.length - 1; i >= 0; --i) { |
728 release(node.parameters[i]); | 729 release(node.parameters[i]); |
729 } | 730 } |
730 } | 731 } |
731 | 732 |
732 void visitIsTrue(IsTrue node) { | 733 void visitIsTrue(IsTrue node) { |
733 visitReference(node.value); | 734 visitReference(node.value); |
734 } | 735 } |
735 | 736 |
736 } | 737 } |
OLD | NEW |