Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions mangler.nim
Original file line number Diff line number Diff line change
Expand Up @@ -67,17 +67,17 @@ proc mangleRules(s: string, p: Parser; kind: TSymKind): string =
break mangle
block prefixes:
for prefix in items(p.options.prefixes):
if s.startsWith(prefix):
if prefix.len < s.len and s.startsWith(prefix):
result = s.substr(prefix.len)
break prefixes
result = s
block suffixes:
for suffix in items(p.options.suffixes):
if result.endsWith(suffix):
if suffix.len < result.len and result.endsWith(suffix):
setLen(result, result.len - suffix.len)
break suffixes
if p.options.followNep1 and kind != skDontMangle:
result = nep1(result, kind)
if p.options.followNep1 and kind != skDontMangle:
result = nep1(result, kind)

proc mangleName(s: string, p: Parser; kind: TSymKind): string =
if p.options.toMangle.hasKey(s): result = p.options.toMangle[s]
Expand Down