mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-29 02:33:58 +00:00
[backport 1.0] add backend support for js bigint (#16606)
* add backend support for js bigint
* cleanup
* add tests
* add -d:nimHasJsBigIntBackend
* cleanup
* more tests
(cherry picked from commit 025ca660f7)
This commit is contained in:
@@ -117,3 +117,4 @@ proc initDefines*(symbols: StringTableRef) =
|
||||
defineSymbol("nimHasInvariant")
|
||||
defineSymbol("nimHasStacktraceMsgs")
|
||||
defineSymbol("nimHasStacktracesModule")
|
||||
defineSymbol("nimHasJsBigIntBackend")
|
||||
|
||||
@@ -1591,7 +1591,10 @@ proc createVar(p: PProc, typ: PType, indirect: bool): Rope =
|
||||
var t = skipTypes(typ, abstractInst)
|
||||
case t.kind
|
||||
of tyInt..tyInt64, tyUInt..tyUInt64, tyEnum, tyChar:
|
||||
result = putToSeq("0", indirect)
|
||||
if $t.sym.loc.r == "bigint":
|
||||
result = putToSeq("0n", indirect)
|
||||
else:
|
||||
result = putToSeq("0", indirect)
|
||||
of tyFloat..tyFloat128:
|
||||
result = putToSeq("0.0", indirect)
|
||||
of tyRange, tyGenericInst, tyAlias, tySink, tyOwned:
|
||||
|
||||
Reference in New Issue
Block a user