check for ending dot before pushing on another when trying to fix integer member expressions - fixes #2177

This commit is contained in:
Sebastian McKenzie 2015-08-07 19:11:54 +01:00
parent 3961b720be
commit 20fa6cd8f4
3 changed files with 7 additions and 1 deletions

View File

@ -280,7 +280,7 @@ export function MemberExpression(node, print) {
} else {
if (t.isLiteral(node.object)) {
var val = this._Literal(node.object);
if (isInteger(+val) && !SCIENTIFIC_NOTATION.test(val)) {
if (isInteger(+val) && !SCIENTIFIC_NOTATION.test(val) && !this.endsWith(".")) {
this.push(".");
}
}

View File

@ -6,3 +6,6 @@ foo.bar["foo"];
foo["foo"]["bar"];
foo[test()][bar()];
0..toString();
0.5.toString();

View File

@ -6,3 +6,6 @@ foo.bar["foo"];
foo["foo"]["bar"];
foo[test()][bar()];
0..toString();
0.5.toString();