This commit is contained in:
araq
2025-11-19 17:51:39 +01:00
parent 0aafbbdb71
commit e13291f805
3 changed files with 21 additions and 18 deletions

View File

@@ -2056,6 +2056,7 @@ proc genTypeInfo*(config: ConfigRef, m: BModule; t: PType; info: TLineInfo): Rop
proc genTypeSection(m: BModule, n: PNode) =
var intSet = initIntSet()
let compress = optCompress in m.config.globalOptions
for i in 0..<n.len:
if len(n[i]) == 0: continue
if n[i][0].kind != nkPragmaExpr: continue
@@ -2064,7 +2065,7 @@ proc genTypeSection(m: BModule, n: PNode) =
var s = n[i][0][p]
if s.kind == nkPostfix:
s = n[i][0][p][1]
if {sfExportc, sfCompilerProc} * s.sym.flags == {sfExportc}:
if {sfExportc, sfCompilerProc} * s.sym.flags == {sfExportc} or compress:
discard getTypeDescAux(m, s.typ, intSet, descKindFromSymKind(s.sym.kind))
if m.g.generatedHeader != nil:
discard getTypeDescAux(m.g.generatedHeader, s.typ, intSet, descKindFromSymKind(s.sym.kind))

View File

@@ -555,9 +555,6 @@ type
when defined(nimIcIntegrityChecks):
include "system/exceptions"
else:
import system/exceptions
export exceptions
when defined(js) or defined(nimdoc):
type
@@ -1651,6 +1648,25 @@ when not defined(js) and defined(nimV2):
vTable: UncheckedArray[pointer] # vtable for types
PNimTypeV2 = ptr TNimTypeV2
when notJSnotNims and defined(nimSeqsV2):
const nimStrVersion {.core.} = 2
type
NimStrPayloadBase = object
cap: int
NimStrPayload {.core.} = object
cap: int
data: UncheckedArray[char]
NimStringV2 {.core.} = object
len: int
p: ptr NimStrPayload ## can be nil if len == 0.
when not defined(nimIcIntegrityChecks):
import system/exceptions
export exceptions
when notJSnotNims and defined(nimSeqsV2):
include "system/strs_v2"
include "system/seqs_v2"

View File

@@ -9,20 +9,6 @@
## Default new string implementation used by Nim's core.
type
NimStrPayloadBase = object
cap: int
NimStrPayload {.core.} = object
cap: int
data: UncheckedArray[char]
NimStringV2 {.core.} = object
len: int
p: ptr NimStrPayload ## can be nil if len == 0.
const nimStrVersion {.core.} = 2
{.push overflowChecks: off, rangeChecks: off.}
template isLiteral(s): bool = (s.p == nil) or (s.p.cap and strlitFlag) == strlitFlag