mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-05 08:11:30 -06:00
Replace native division with integer division
This commit is contained in:
parent
2fa24a7e7a
commit
fd43211d6a
@ -121,6 +121,10 @@ module ts {
|
||||
}
|
||||
|
||||
return ~low;
|
||||
}
|
||||
|
||||
export function integerDivide(numerator: number, denominator: number): number {
|
||||
return (numerator / denominator) >> 0;
|
||||
}
|
||||
|
||||
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
||||
|
||||
@ -487,7 +487,7 @@ module ts.SignatureHelp {
|
||||
// the applicable span and that we are typing the last argument
|
||||
// Alternatively, we could be in range of one of the arguments, in which case we need to divide
|
||||
// by 2 to exclude commas
|
||||
var argumentIndex = indexOfNodeContainingPosition < 0 ? argumentCount - 1 : indexOfNodeContainingPosition / 2;
|
||||
var argumentIndex = indexOfNodeContainingPosition < 0 ? argumentCount - 1 : integerDivide(indexOfNodeContainingPosition, 2);
|
||||
return new SignatureHelpState(argumentIndex, argumentCount);
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user