Fix invalid codegen for number member expr

This commit is contained in:
Amjad Masad
2015-12-15 17:46:42 -08:00
parent 59f5e7f218
commit 320cede9be
2 changed files with 7 additions and 8 deletions

View File

@@ -221,14 +221,8 @@ export function MemberExpression(node: Object) {
this.print(node.property, node);
this.push("]");
} else {
if (t.isLiteral(node.object) && !t.isTemplateLiteral(node.object)) {
let val;
if (this.format.minified) {
val = this._stringLiteral(node.object);
} else {
val = this.getPossibleRaw(node.object) || this._stringLiteral(node.object);
}
if (t.isNumericLiteral(node.object)) {
let val = this.getPossibleRaw(node.object) || node.object.value;
if (isInteger(+val) && !SCIENTIFIC_NOTATION.test(val) && !ZERO_DECIMAL_INTEGER.test(val) && !this.endsWith(".")) {
this.push(".");
}