move up regex Literal generation
This commit is contained in:
parent
2d7a2b5e6d
commit
3d416a6fbe
@ -137,16 +137,16 @@ export function Literal(node, print) {
|
||||
export function _Literal(node) {
|
||||
var val = node.value;
|
||||
|
||||
if (node.regex) {
|
||||
return `/${node.regex.pattern}/${node.regex.flags}`;
|
||||
}
|
||||
|
||||
// just use the raw property if our current value is equivalent to the one we got
|
||||
// when we populated raw
|
||||
if (node.raw != null && node.rawValue != null && val === node.rawValue) {
|
||||
return node.raw;
|
||||
}
|
||||
|
||||
if (node.regex) {
|
||||
return `/${node.regex.pattern}/${node.regex.flags}`;
|
||||
}
|
||||
|
||||
switch (typeof val) {
|
||||
case "string":
|
||||
return this._stringLiteral(val);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user