NativeScript / ios-jsc

NativeScript for iOS using JavaScriptCore
http://docs.nativescript.org/runtimes/ios
Apache License 2.0
299 stars 59 forks source link

fix(metadata-generator): Convert unsigned 64-bit enum values to signed #1151

Closed mbektchiev closed 5 years ago

mbektchiev commented 5 years ago

This way most negative values will be correctly represented in JS and TS. Still values between 2^53 and 2^63 will have their representation converted to inexact doubles because the MAX_SAFE_INTEGER is 2^53-1

PR Checklist

What is the current behavior?

.d.ts files define enum constants which have their 64th bit set as unsigned decimal integers

What is the new behavior?

.d.ts files define enum constants which have their 64th bit set as signed (negative) decimal integers to avoid misrepresenting them in JS due to the limitation that only integers up to 2^53-1(MAX_SAFE_INTEGER) can be represented exactly.

refs #1150