@@ -9,7 +9,7 @@ part 'ast_visitor.dart';
9
9
abstract class Node {
10
10
/// The parent of this node, or null if this is the [Program] node.
11
11
///
12
- /// If you transform the AST in any way, it is your own responsibility to update pointer pointers accordingly.
12
+ /// If you transform the AST in any way, it is your own responsibility to update parent pointers accordingly.
13
13
Node parent;
14
14
15
15
/// Source-code offset.
@@ -149,8 +149,6 @@ class Name extends Node {
149
149
visitBy (Visitor v) => v.visitName (this );
150
150
}
151
151
152
- ///// STATEMENTS /////
153
-
154
152
/// Superclass for all nodes that are statements.
155
153
abstract class Statement extends Node {}
156
154
@@ -547,10 +545,17 @@ class ObjectExpression extends Expression {
547
545
}
548
546
549
547
/// Property initializer `[key]: [value]` , or getter `get [key] [value]` , or setter `set [key] [value]` .
548
+ ///
549
+ /// For getters and setters, [value] is a [FunctionNode] , otherwise it is an [Expression] .
550
550
class Property extends Node {
551
- Node key; // Literal or Name
552
- Node value; // Will be FunctionNode with no name for getters and setters
553
- String kind; // May be: init, get, set
551
+ /// Literal or Name indicating the name of the property. Use [nameString] to get the name as a string.
552
+ Node key;
553
+
554
+ /// A [FunctionNode] (for getters and setters) or an [Expression] (for ordinary properties).
555
+ Node value;
556
+
557
+ /// May be "init", "get", or "set".
558
+ String kind;
554
559
555
560
Property (this .key, this .value, [this .kind = 'init' ]);
556
561
Property .getter (this .key, FunctionExpression this .value) : kind = 'get' ;
0 commit comments