@@ -150,12 +150,13 @@ class Evaluation {
150
150
*/
151
151
constructor ( scope , expression ) {
152
152
switch ( expression . type ) {
153
- case 'Literal' :
153
+ case 'Literal' : {
154
154
this . values . add ( expression . value ) ;
155
155
break ;
156
+ }
156
157
157
- case 'Identifier' :
158
- var binding = scope . get ( expression . name ) ;
158
+ case 'Identifier' : {
159
+ const binding = scope . get ( expression . name ) ;
159
160
160
161
if ( binding ) {
161
162
if (
@@ -187,10 +188,11 @@ class Evaluation {
187
188
188
189
this . values . add ( UNKNOWN ) ;
189
190
break ;
191
+ }
190
192
191
- case 'BinaryExpression' :
192
- var a = scope . evaluate ( /** @type {Expression } */ ( expression . left ) ) ; // `left` cannot be `PrivateIdentifier` unless operator is `in`
193
- var b = scope . evaluate ( expression . right ) ;
193
+ case 'BinaryExpression' : {
194
+ const a = scope . evaluate ( /** @type {Expression } */ ( expression . left ) ) ; // `left` cannot be `PrivateIdentifier` unless operator is `in`
195
+ const b = scope . evaluate ( expression . right ) ;
194
196
195
197
if ( a . is_known && b . is_known ) {
196
198
this . values . add ( binary [ expression . operator ] ( a . value , b . value ) ) ;
@@ -241,11 +243,12 @@ class Evaluation {
241
243
this . values . add ( UNKNOWN ) ;
242
244
}
243
245
break ;
246
+ }
244
247
245
- case 'ConditionalExpression' :
246
- var test = scope . evaluate ( expression . test ) ;
247
- var consequent = scope . evaluate ( expression . consequent ) ;
248
- var alternate = scope . evaluate ( expression . alternate ) ;
248
+ case 'ConditionalExpression' : {
249
+ const test = scope . evaluate ( expression . test ) ;
250
+ const consequent = scope . evaluate ( expression . consequent ) ;
251
+ const alternate = scope . evaluate ( expression . alternate ) ;
249
252
250
253
if ( test . is_known ) {
251
254
for ( const value of ( test . value ? consequent : alternate ) . values ) {
@@ -261,10 +264,11 @@ class Evaluation {
261
264
}
262
265
}
263
266
break ;
267
+ }
264
268
265
- case 'LogicalExpression' :
266
- a = scope . evaluate ( expression . left ) ;
267
- b = scope . evaluate ( expression . right ) ;
269
+ case 'LogicalExpression' : {
270
+ const a = scope . evaluate ( expression . left ) ;
271
+ const b = scope . evaluate ( expression . right ) ;
268
272
269
273
if ( a . is_known ) {
270
274
if ( b . is_known ) {
@@ -295,9 +299,10 @@ class Evaluation {
295
299
this . values . add ( value ) ;
296
300
}
297
301
break ;
302
+ }
298
303
299
- case 'UnaryExpression' :
300
- var argument = scope . evaluate ( expression . argument ) ;
304
+ case 'UnaryExpression' : {
305
+ const argument = scope . evaluate ( expression . argument ) ;
301
306
302
307
if ( argument . is_known ) {
303
308
this . values . add ( unary [ expression . operator ] ( argument . value ) ) ;
@@ -329,9 +334,11 @@ class Evaluation {
329
334
this . values . add ( UNKNOWN ) ;
330
335
}
331
336
break ;
337
+ }
332
338
333
- default :
339
+ default : {
334
340
this . values . add ( UNKNOWN ) ;
341
+ }
335
342
}
336
343
337
344
for ( const value of this . values ) {
0 commit comments