flow icon indicating copy to clipboard operation
flow copied to clipboard

BigInt estree value is always `null`

Open mroch opened this issue 3 years ago • 1 comments

Flow version: 0.179.0

Expected behavior

The value prop of a BigIntLiteral in ESTree should be a BigInt when using flow_parser.js in an environment that supports BigInt.

Actual behavior

we always return null:

https://github.com/facebook/flow/blob/c0050829cdb3f383445962dd93ae490fbdd28cf6/src/parser/estree_translator.ml#L1324

Fix

Translator_intf needs a method similar to regexp that returns null in most implementations, but JsTranslator tries to instantiate a BigInt in flow_parser_js.ml, wrapped in a try/with so it returns null if the JS runtime doesn't support it.

mroch avatar May 30 '22 16:05 mroch

Should we change its type to Literal and add raw?

fisker avatar Feb 08 '23 08:02 fisker