@@ -14,7 +14,10 @@ function _argsList(list) {
14
14
15
15
export class AST {
16
16
constructor ( expression ) {
17
- if ( typeof expression !== "string" ) throw "expression must be a string" ;
17
+ if ( typeof expression !== "string" ) {
18
+ throw "expression must be a string" ;
19
+ }
20
+
18
21
this . expression = expression . indexOf ( '#.' ) === 0
19
22
? expression . substr ( 2 )
20
23
: expression ;
@@ -43,10 +46,14 @@ export class ContextReferenceAST extends AST {
43
46
44
47
export class ConstantAST extends AST {
45
48
constructor ( constant , expression ) {
46
- if ( arguments . length < 2 ) expression = null ;
49
+ if ( arguments . length < 2 ) {
50
+ expression = null ;
51
+ }
52
+
47
53
super ( expression === null
48
54
? ( typeof constant === "string" ? `"${ constant } "` : `${ constant } ` )
49
55
: expression ) ;
56
+
50
57
this . constant = constant ;
51
58
}
52
59
@@ -59,6 +66,7 @@ export class FieldReadAST extends AST {
59
66
constructor ( lhs , name ) {
60
67
this . lhs = lhs ;
61
68
this . name = name ;
69
+
62
70
super ( `${ lhs } .${ name } ` ) ;
63
71
}
64
72
@@ -72,6 +80,7 @@ export class PureFunctionAST extends AST {
72
80
this . fn = fn ;
73
81
this . argsAST = argsAST ;
74
82
this . name = name ;
83
+
75
84
super ( `${ name } (${ _argsList ( argsAST ) } )` ) ;
76
85
}
77
86
@@ -85,6 +94,7 @@ export class MethodAST extends AST {
85
94
this . lhsAST = lhsAST ;
86
95
this . name = name ;
87
96
this . argsAST = argsAST ;
97
+
88
98
super ( `${ lhsAST } .${ name } (${ _argsList ( argsAST ) } )` ) ;
89
99
}
90
100
@@ -96,6 +106,7 @@ export class MethodAST extends AST {
96
106
export class CollectionAST extends AST {
97
107
constructor ( valueAST ) {
98
108
this . valueAST = valueAST ;
109
+
99
110
super ( `#collection(${ valueAST } )` ) ;
100
111
}
101
112
@@ -108,6 +119,7 @@ class _ConstantWatchRecord {
108
119
constructor ( watchGroup , expression , currentValue ) {
109
120
this . currentValue = currentValue ;
110
121
this . handler = new _ConstantHandler ( watchGroup , expression , currentValue ) ;
122
+ this . field = this . previousValue = this . object = this . nextChange = null ;
111
123
}
112
124
113
125
check ( ) {
@@ -117,24 +129,4 @@ class _ConstantWatchRecord {
117
129
remove ( ) {
118
130
return null ;
119
131
}
120
-
121
- get field ( ) {
122
- return null ;
123
- }
124
-
125
- get previousValue ( ) {
126
- return null ;
127
- }
128
-
129
- get object ( ) {
130
- return null ;
131
- }
132
-
133
- set object ( value ) {
134
- return null ;
135
- }
136
-
137
- get nextChange ( ) {
138
- return null ;
139
- }
140
132
}
0 commit comments