@@ -1142,7 +1142,7 @@ export function createScanner(languageVersion: ScriptTarget,
11421142 // | NonOctalDecimalIntegerLiteral
11431143 // LegacyOctalIntegerLiteral ::= '0' [0-7]+
11441144 // NonOctalDecimalIntegerLiteral ::= '0' [0-7]* [89] [0-9]*
1145- function scanNumber ( ) : { type : SyntaxKind , value : string } {
1145+ function scanNumber ( ) : SyntaxKind {
11461146 let start = pos ;
11471147 let mainFragment : string ;
11481148 if ( text . charCodeAt ( pos ) === CharacterCodes . _0 ) {
@@ -1173,7 +1173,7 @@ export function createScanner(languageVersion: ScriptTarget,
11731173 const literal = ( withMinus ? "-" : "" ) + "0o" + ( + tokenValue ) . toString ( 8 ) ;
11741174 if ( withMinus ) start -- ;
11751175 error ( Diagnostics . Octal_literals_are_not_allowed_Use_the_syntax_0 , start , pos - start , literal ) ;
1176- return { type : SyntaxKind . NumericLiteral , value : tokenValue } ;
1176+ return SyntaxKind . NumericLiteral ;
11771177 }
11781178 }
11791179 else {
@@ -1217,21 +1217,21 @@ export function createScanner(languageVersion: ScriptTarget,
12171217 if ( tokenFlags & TokenFlags . ContainsLeadingZero ) {
12181218 error ( Diagnostics . Decimals_with_leading_zeros_are_not_allowed , start , end - start ) ;
12191219 // if a literal has a leading zero, it must not be bigint
1220- return { type : SyntaxKind . NumericLiteral , value : "" + + result } ;
1220+ tokenValue = "" + + result ;
1221+ return SyntaxKind . NumericLiteral ;
12211222 }
12221223
12231224 if ( decimalFragment !== undefined || tokenFlags & TokenFlags . Scientific ) {
12241225 checkForIdentifierStartAfterNumericLiteral ( start , decimalFragment === undefined && ! ! ( tokenFlags & TokenFlags . Scientific ) ) ;
1225- return {
1226- type : SyntaxKind . NumericLiteral ,
1227- value : "" + + result // if value is not an integer, it can be safely coerced to a number
1228- } ;
1226+ // if value is not an integer, it can be safely coerced to a number
1227+ tokenValue = "" + + result ;
1228+ return SyntaxKind . NumericLiteral ;
12291229 }
12301230 else {
12311231 tokenValue = result ;
12321232 const type = checkBigIntSuffix ( ) ; // if value is an integer, check whether it is a bigint
12331233 checkForIdentifierStartAfterNumericLiteral ( start ) ;
1234- return { type, value : tokenValue } ;
1234+ return type ;
12351235 }
12361236 }
12371237
@@ -1937,7 +1937,7 @@ export function createScanner(languageVersion: ScriptTarget,
19371937 return token = SyntaxKind . MinusToken ;
19381938 case CharacterCodes . dot :
19391939 if ( isDigit ( text . charCodeAt ( pos + 1 ) ) ) {
1940- tokenValue = scanNumber ( ) . value ;
1940+ scanNumber ( ) ;
19411941 return token = SyntaxKind . NumericLiteral ;
19421942 }
19431943 if ( text . charCodeAt ( pos + 1 ) === CharacterCodes . dot && text . charCodeAt ( pos + 2 ) === CharacterCodes . dot ) {
@@ -2065,8 +2065,7 @@ export function createScanner(languageVersion: ScriptTarget,
20652065 case CharacterCodes . _7 :
20662066 case CharacterCodes . _8 :
20672067 case CharacterCodes . _9 :
2068- ( { type : token , value : tokenValue } = scanNumber ( ) ) ;
2069- return token ;
2068+ return token = scanNumber ( ) ;
20702069 case CharacterCodes . colon :
20712070 pos ++ ;
20722071 return token = SyntaxKind . ColonToken ;
0 commit comments