You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First of all, great job with the current dart runtime and the quick nullable release that you did in the last weeks. 👍🏽
We are using antlr4 in our flutter app which will run on the web soon. The current antlr4 dart runtime is not able to compile to js.
Here is the output when compiling the flutter web project:
../../../../../.pub-cache/git/antlr4-f0d4d129b7f146c314101bd3c99e630dc433af50/runtime/Dart/lib/src/util/bit_set.dart:31:16: Error: The integer literal 0x5555555555555555 can't be represented exactly in JavaScript.
Try changing the literal to something that can be represented in Javascript. In Javascript 0x5555555555555400 is the nearest value that can be represented exactly.
const m1 = 0x5555555555555555;
^^^^^^^^^^^^^^^^^^
../../../../../.pub-cache/git/antlr4-f0d4d129b7f146c314101bd3c99e630dc433af50/runtime/Dart/lib/src/util/bit_set.dart:32:16: Error: The integer literal 0x3333333333333333 can't be represented exactly in JavaScript.
Try changing the literal to something that can be represented in Javascript. In Javascript 0x3333333333333400 is the nearest value that can be represented exactly.
const m2 = 0x3333333333333333;
^^^^^^^^^^^^^^^^^^
../../../../../.pub-cache/git/antlr4-f0d4d129b7f146c314101bd3c99e630dc433af50/runtime/Dart/lib/src/util/bit_set.dart:33:16: Error: The integer literal 0x0F0F0F0F0F0F0F0F can't be represented exactly in JavaScript.
Try changing the literal to something that can be represented in Javascript. In Javascript 0xf0f0f0f0f0f0f00 is the nearest value that can be represented exactly.
const m4 = 0x0F0F0F0F0F0F0F0F;
^^^^^^^^^^^^^^^^^^
../../../../../.pub-cache/git/antlr4-f0d4d129b7f146c314101bd3c99e630dc433af50/runtime/Dart/lib/src/util/bit_set.dart:34:16: Error: The integer literal 0x00FF00FF00FF00FF can't be represented exactly in JavaScript.
Try changing the literal to something that can be represented in Javascript. In Javascript 0xff00ff00ff0100 is the nearest value that can be represented exactly.
const m8 = 0x00FF00FF00FF00FF;
^^^^^^^^^^^^^^^^^^
../../../../../.pub-cache/git/antlr4-f0d4d129b7f146c314101bd3c99e630dc433af50/runtime/Dart/lib/src/util/bit_set.dart:36:17: Error: The integer literal 0x0101010101010101 can't be represented exactly in JavaScript.
Try changing the literal to something that can be represented in Javascript. In Javascript 0x101010101010100 is the nearest value that can be represented exactly.
const h01 = 0x0101010101010101;
^^^^^^^^^^^^^^^^^^
../../../../../.pub-cache/git/antlr4-f0d4d129b7f146c314101bd3c99e630dc433af50/runtime/Dart/lib/src/util/bit_set.dart:75:30: Error: The operator '>>' isn't defined for the class 'num'.
Try correcting the operator to an existing operator, or defining a '>>' operator.
bitCount += ((x * h01) >> 56);
^^
../../../../../.pub-cache/git/antlr4-f0d4d129b7f146c314101bd3c99e630dc433af50/runtime/Dart/lib/src/util/bit_set.dart:75:16: Error: A value of type 'num' can't be assigned to a variable of type 'int'.
bitCount += ((x * h01) >> 56);
^
../../../../../.pub-cache/git/antlr4-f0d4d129b7f146c314101bd3c99e630dc433af50/runtime/Dart/lib/src/util/bit_set.dart:151:24: Error: The integer literal 0x03f79d71b4cb0a89 can't be represented exactly in JavaScript.
Try changing the literal to something that can be represented in Javascript. In Javascript 0x3f79d71b4cb0a80 is the nearest value that can be represented exactly.
const debruijn64 = 0x03f79d71b4cb0a89;
^^^^^^^^^^^^^^^^^^
../../../../../.pub-cache/git/antlr4-f0d4d129b7f146c314101bd3c99e630dc433af50/runtime/Dart/lib/src/util/bit_set.dart:152:58: Error: The operator '>>' isn't defined for the class 'num'.
Try correcting the operator to an existing operator, or defining a '>>' operator.
return index64[(((value ^ (value - 1)) * debruijn64) >> 58) % 64];
^^
Failed to compile application.
Maybe this requires only a small fix by using BigInt in bit_set.dart.
The text was updated successfully, but these errors were encountered:
I added a PR that fixes the compile issues and some runtime crashes.
This requires some more work because every dart:io import should be checked and replaced if needed.
I need some more input from a maintainer to finish this.
Thanks for your contribution! I have also tried to remove dart:io before:
runtime/Dart/lib/src/input_stream.dart which is for fromPath method. We could consider removing this method as users can do it easily. Or figure out a way to make this method visible only when calling from native Dart.
runtime/Dart/lib/src/parser.dart which is for stdout. We should be able to replace it with print, but it means a newline will be added. This may affect testing.
runtime/Dart/lib/src/error/src/error_listener.dart which is for stderr. Again changing this to print can affect testing.
tool/resources/org/antlr/v4/tool/templates/codegen/Dart/Dart.stg. I can't remember what these are for at the moment.
I didn't continue with it because I couldn't find a easy way making it work without breaking tests. And people can use Dart JS interop with JS target anyway.
First of all, great job with the current dart runtime and the quick nullable release that you did in the last weeks. 👍🏽
We are using antlr4 in our flutter app which will run on the web soon. The current antlr4 dart runtime is not able to compile to js.
Here is the output when compiling the flutter web project:
Maybe this requires only a small fix by using
BigInt
inbit_set.dart
.The text was updated successfully, but these errors were encountered: