Skip to content

Commit

Permalink
more fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jmgomez committed Jan 29, 2024
1 parent 6f9893e commit d0a0316
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions compiler/ccgutils.nim
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import
ast, types, msgs, wordrecg,
platform, trees, options, cgendata

import std/[hashes, strutils]
import std/[hashes, strutils, formatFloat]

when defined(nimPreviewSlimSystem):
import std/assertions
Expand Down Expand Up @@ -201,10 +201,14 @@ proc encodeType*(m: BModule; t: PType): string =
name.add "E"
name
of tyRange:
let val =
if t.n[0].typ.kind == tyFloat: $t.n[0].floatVal.int & "_" & $t.n[1].floatVal.int
else: $t.n[0].intVal & "_" & $t.n[1].intVal
encodeName("range_" & val)
var val = "range_"
if t.n[0].typ.kind in {tyFloat..tyFloat128}:
val.addFloat t.n[0].floatVal
val.add "_"
val.addFloat t.n[1].floatVal
else:
val.add $t.n[0].intVal & "_" & $t.n[1].intVal
encodeName(val)
of tyString..tyUInt64, tyPointer, tyBool, tyChar, tyVoid, tyAnything, tyNil, tyEmpty:
encodeName(kindName)
of tyAlias, tyInferred, tyOwned:
Expand Down

0 comments on commit d0a0316

Please sign in to comment.