Always print strings for consistency

This commit is contained in:
Amjad Masad 2015-12-07 02:30:14 -08:00
parent 2e11839257
commit 89e6d5bc7e
2 changed files with 3 additions and 16 deletions

View File

@ -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(".");
}

View File

@ -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 = {}) {