File tree Expand file tree Collapse file tree 2 files changed +30
-3
lines changed Expand file tree Collapse file tree 2 files changed +30
-3
lines changed Original file line number Diff line number Diff line change 23122312 }
23132313 }
23142314
2315+ if ( expr . regex ) {
2316+ return '/' + expr . regex . pattern + '/' + expr . regex . flags ;
2317+ }
2318+
23152319 if ( expr . value === null ) {
23162320 return 'null' ;
23172321 }
23282332 return expr . value ? 'true' : 'false' ;
23292333 }
23302334
2331- if ( expr . regex ) {
2332- return '/' + expr . regex . pattern + '/' + expr . regex . flags ;
2333- }
23342335 return generateRegExp ( expr . value ) ;
23352336 } ,
23362337
Original file line number Diff line number Diff line change @@ -4429,6 +4429,32 @@ data = {
44294429 value : '/[P QR]/\\g' ,
44304430 range : [ 8 , 18 ]
44314431 } ]
4432+ } ,
4433+
4434+ 'var x = /foo/i;' : {
4435+ generateFrom : {
4436+ type : 'Program' ,
4437+ body : [ {
4438+ type : 'VariableDeclaration' ,
4439+ kind : 'var' ,
4440+ declarations : [ {
4441+ type : 'VariableDeclarator' ,
4442+ id : {
4443+ type : 'Identifier' ,
4444+ name : 'x' ,
4445+ } ,
4446+ init : {
4447+ type : 'Literal' ,
4448+ value : null ,
4449+ raw : '/foo/i' ,
4450+ regex : {
4451+ pattern : 'foo' ,
4452+ flags : 'i'
4453+ }
4454+ } ,
4455+ } ]
4456+ } ] ,
4457+ }
44324458 }
44334459
44344460 } ,
You can’t perform that action at this time.
0 commit comments