-
-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
8 Enum values in objc!UIKit.d.ts are way too large #1150
Comments
This comment was marked as abuse.
This comment was marked as abuse.
Hi @NathanaelA, I agree the ability to use full 64-bit integers is a big plus! Our obfuscator is not applied to the *.d.ts files at all - it is applied to the output from webpack, in this case However, despite our obfuscator unable to parse this, there is still a problem: These 64-bit literals are NOT processed correctly through the Typescript compiler. For instance, the source for this enum value assigns the value 18446744073709551615 to the Any/All enum values. After compiling TS to JS, this literal is rounded to 18446744073709552000 (0x10000000000000180) which flips almost all bits to 0. The offending compiled source is this (
NOTE: This is not all. Further down the build, this file is bundled into
What could be the right solution to this problem? We use Typescript 3.1.1, nativescript 5.3.2, tns-core-modules 5.3.1 and tns-ios 5.2.0. |
@bguijt You're right, these constants overflow the JSValues and indeed are not represented correctly. Since JSC still doesn't support |
@mbektchiev Would I tried your suggested literal by adding the following snippet to my Webpack
This gives me the following console warning:
However, my bundled I tried with |
|
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 `double`s because the MAX_SAFE_INTEGER is 2^53-1 refs NativeScript/ios-jsc#1150
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 `double`s because the MAX_SAFE_INTEGER is 2^53-1 refs #1150
`18446744073709551615` (`0xFFFFFFFFFFFFFFFF`) is an overflow to the JS numerical system and therefore incorrect. Integer values from `-(2^53-1)` to `(2^53-1)` only can be safely represented in JS (`Number.MIN_SAFE_INTEGER` to `Number.MAX_SAFE_INTEGER`) There's a fix in iOS Runtime's metadata generator which now automatically converts such values to signed. (NativeScript/ios-jsc#1151) refs NativeScript/ios-jsc#1150
@bguijt commented on Mon Jun 03 2019
Please check this diff: NativeScript/NativeScript@f54f71b#diff-a4508a7cbf4cc46900ecccb75a31c03d
and find all value changes from 4294967295 (which is 0xFFFFFFFF) to 18446744073709551615 (which is 0xFFFFFFFFFFFFFFFF) which is an overflow to the JS numerical system and therefore incorrect.
This is probably OK for regular JS projects, however we use a commercial code obfuscator which is unable to handle these literals.
Please change these literals back to what they were ;-)
The text was updated successfully, but these errors were encountered: