Always print strings for consistency
This commit is contained in:
parent
2e11839257
commit
89e6d5bc7e
@ -221,7 +221,7 @@ export function MemberExpression(node: Object) {
|
||||
this.push("]");
|
||||
} else {
|
||||
if (t.isLiteral(node.object) && !t.isTemplateLiteral(node.object)) {
|
||||
let val = this.getPossibleRaw(node.object) || this._stringLiteral(node.object);
|
||||
let val = this._stringLiteral(node.object);
|
||||
if (isInteger(+val) && !SCIENTIFIC_NOTATION.test(val) && !ZERO_DECIMAL_INTEGER.test(val) && !this.endsWith(".")) {
|
||||
this.push(".");
|
||||
}
|
||||
|
||||
@ -89,22 +89,9 @@ export default class Printer extends Buffer {
|
||||
}
|
||||
}
|
||||
|
||||
getPossibleRaw(node) {
|
||||
let extra = node.extra;
|
||||
if (extra && extra.raw != null && extra.rawValue != null && node.value === extra.rawValue) {
|
||||
return extra.raw;
|
||||
}
|
||||
}
|
||||
|
||||
_print(node, parent) {
|
||||
let extra = this.getPossibleRaw(node);
|
||||
if (extra) {
|
||||
this.push("");
|
||||
this._push(extra);
|
||||
} else {
|
||||
let printMethod = this[node.type];
|
||||
printMethod.call(this, node, parent);
|
||||
}
|
||||
let printMethod = this[node.type];
|
||||
printMethod.call(this, node, parent);
|
||||
}
|
||||
|
||||
printJoin(nodes: ?Array, parent: Object, opts = {}) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user