Permalink
Browse files

fixes #104: member expression on number may alter its raw value

  • Loading branch information...
1 parent 719de30 commit 7bd0e2ed1a7c0c404b29bf5576551dc1bf7a86bb @michaelficarra michaelficarra committed with michaelficarra Jul 20, 2017
Showing with 24 additions and 2 deletions.
  1. +1 −1 escodegen.js
  2. +21 −1 test/ast.js
  3. +1 −0 test/compare/floating-point.expected.js
  4. +1 −0 test/compare/floating-point.js
View
@@ -1942,7 +1942,7 @@
esutils.code.isDecimalDigit(fragment.charCodeAt(fragment.length - 1)) &&
!(fragment.length >= 2 && fragment.charCodeAt(0) === 48) // '0'
) {
- result.push('.');
+ result.push(' ');
}
}
result.push('.');
View
@@ -144,7 +144,27 @@ data = {
},
}],
expected: '/(?:)/i;'
- }
+ },
+ {
+ type: 'Program',
+ body: [{
+ type: 'ExpressionStatement',
+ expression: {
+ type: 'MemberExpression',
+ computed: false,
+ object: {
+ type: 'Literal',
+ value: 1,
+ raw: '1'
+ },
+ property: {
+ type: 'Identifier',
+ name: 'a'
+ }
+ }
+ }],
+ expected: '1 .a;'
+ },
]
};
@@ -1,2 +1,3 @@
+1 .valueOf();
1.1.valueOf();
1e+300.valueOf();
@@ -1,2 +1,3 @@
+(1).valueOf();
1.1.valueOf();
(1e+300).valueOf();

0 comments on commit 7bd0e2e

Please sign in to comment.