From 856f2d895c4f18f1b7c89f4248622788e8c85fd3 Mon Sep 17 00:00:00 2001 From: vilicvane Date: Fri, 4 Sep 2015 21:47:28 +0800 Subject: [PATCH] Fix issue #4603 --- src/compiler/emitter.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index eeaab6d212..8a04be99ca 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -897,6 +897,16 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi write(text); } } + + function getEmittingNumericLiteralText(node: LiteralExpression): string { + let text = getLiteralText(node); + + if (languageVersion < ScriptTarget.ES6 && isBinaryOrOctalIntegerLiteral(node, text)) { + return node.text; + } else { + return text; + } + } function getLiteralText(node: LiteralExpression) { // Any template literal or string literal with an extended escape @@ -2352,7 +2362,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi operand.kind !== SyntaxKind.PostfixUnaryExpression && operand.kind !== SyntaxKind.NewExpression && !(operand.kind === SyntaxKind.CallExpression && node.parent.kind === SyntaxKind.NewExpression) && - !(operand.kind === SyntaxKind.FunctionExpression && node.parent.kind === SyntaxKind.CallExpression)) { + !(operand.kind === SyntaxKind.FunctionExpression && node.parent.kind === SyntaxKind.CallExpression) && + !(operand.kind === SyntaxKind.NumericLiteral && node.parent.kind === SyntaxKind.PropertyAccessExpression && !/^0[box]|[e.]/i.test(getEmittingNumericLiteralText(operand)))) { emit(operand); return; }