| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 library backend_ast_nodes; | 5 library backend_ast_nodes; |
| 6 | 6 |
| 7 import '../constants/values.dart' as values; | 7 import '../constants/values.dart' as values; |
| 8 import '../dart_types.dart' as types; | 8 import '../dart_types.dart' as types; |
| 9 import '../elements/elements.dart' as elements; | 9 import '../elements/elements.dart' as elements; |
| 10 import '../tree/tree.dart' as tree; | 10 import '../tree/tree.dart' as tree; |
| 11 import '../util/characters.dart' as characters; | 11 import '../util/characters.dart' as characters; |
| 12 | 12 |
| 13 /// The following nodes correspond to [tree.Send] expressions: | 13 /// The following nodes correspond to [tree.Send] expressions: |
| 14 /// [FieldExpression], [IndexExpression], [Assignment], [Increment], | 14 /// [FieldExpression], [IndexExpression], [Assignment], [Increment], |
| 15 /// [CallFunction], [CallMethod], [CallNew], [CallStatic], [UnaryOperator], | 15 /// [CallFunction], [CallMethod], [CallNew], [CallStatic], [UnaryOperator], |
| 16 /// [BinaryOperator], and [TypeOperator]. | 16 /// [BinaryOperator], and [TypeOperator]. |
| 17 abstract class Node {} | 17 abstract class Node {} |
| 18 | 18 |
| 19 /// Receiver is an [Expression] or the [SuperReceiver]. | 19 /// Receiver is an [Expression] or the [SuperReceiver]. |
| 20 abstract class Receiver extends Node {} | 20 abstract class Receiver extends Node {} |
| 21 | 21 |
| 22 /// Argument is an [Expression] or a [NamedArgument]. | 22 /// Argument is an [Expression] or a [NamedArgument]. |
| 23 abstract class Argument extends Node {} | 23 abstract class Argument extends Node {} |
| 24 | 24 |
| 25 abstract class Expression extends Node implements Receiver, Argument { | 25 abstract class Expression extends Node implements Receiver, Argument { |
| 26 bool get assignable => false; | 26 bool get assignable => false; |
| 27 } | 27 } |
| 28 | 28 |
| 29 abstract class ExecutableDefinition extends Node { | 29 abstract class RootNode extends Node { |
| 30 elements.Element get element; | 30 elements.Element get element; |
| 31 } | 31 } |
| 32 | 32 |
| 33 class FieldDefinition extends ExecutableDefinition { | 33 class FieldDefinition extends RootNode { |
| 34 final elements.Element element; | 34 final elements.Element element; |
| 35 final Expression initializer; | 35 final Expression initializer; |
| 36 FieldDefinition(this.element, this.initializer); | 36 FieldDefinition(this.element, this.initializer); |
| 37 } | 37 } |
| 38 | 38 |
| 39 abstract class Statement extends Node {} | 39 abstract class Statement extends Node {} |
| 40 | 40 |
| 41 /// Used as receiver in expressions that dispatch to the super class. | 41 /// Used as receiver in expressions that dispatch to the super class. |
| 42 /// For instance, an expression such as `super.f()` is represented | 42 /// For instance, an expression such as `super.f()` is represented |
| 43 /// by a [CallMethod] node with [SuperReceiver] as its receiver. | 43 /// by a [CallMethod] node with [SuperReceiver] as its receiver. |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 FieldInitializer(this.element, this.body); | 315 FieldInitializer(this.element, this.body); |
| 316 } | 316 } |
| 317 | 317 |
| 318 class SuperInitializer extends Initializer { | 318 class SuperInitializer extends Initializer { |
| 319 final elements.ConstructorElement target; | 319 final elements.ConstructorElement target; |
| 320 final List<Argument> arguments; | 320 final List<Argument> arguments; |
| 321 | 321 |
| 322 SuperInitializer(this.target, this.arguments); | 322 SuperInitializer(this.target, this.arguments); |
| 323 } | 323 } |
| 324 | 324 |
| 325 class FunctionExpression extends Expression implements ExecutableDefinition { | 325 class FunctionExpression extends Expression implements RootNode { |
| 326 final TypeAnnotation returnType; | 326 final TypeAnnotation returnType; |
| 327 String name; | 327 String name; |
| 328 final Parameters parameters; | 328 final Parameters parameters; |
| 329 final Statement body; | 329 final Statement body; |
| 330 final bool isGetter; | 330 final bool isGetter; |
| 331 final bool isSetter; | 331 final bool isSetter; |
| 332 | 332 |
| 333 elements.FunctionElement element; | 333 elements.FunctionElement element; |
| 334 | 334 |
| 335 FunctionExpression(this.parameters, | 335 FunctionExpression(this.parameters, |
| (...skipping 1234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1570 final StringChunk previous; | 1570 final StringChunk previous; |
| 1571 final tree.StringQuoting quoting; | 1571 final tree.StringQuoting quoting; |
| 1572 num cost; | 1572 num cost; |
| 1573 | 1573 |
| 1574 OpenStringChunk(this.previous, this.quoting, this.cost); | 1574 OpenStringChunk(this.previous, this.quoting, this.cost); |
| 1575 | 1575 |
| 1576 StringChunk end(int endIndex) { | 1576 StringChunk end(int endIndex) { |
| 1577 return new StringChunk(previous, quoting, endIndex); | 1577 return new StringChunk(previous, quoting, endIndex); |
| 1578 } | 1578 } |
| 1579 } | 1579 } |
| OLD | NEW |