mirror of
https://github.com/nim-lang/Nim.git
synced 2026-02-12 06:18:51 +00:00
bugfix: package names should not contain '.'
This commit is contained in:
@@ -219,8 +219,10 @@ proc getPackageName*(path: string): string =
|
||||
else:
|
||||
let x = path.substr(i+1, b-1)
|
||||
case x.normalize
|
||||
of "lib", "src", "source", "package", "pckg", "library": b = i
|
||||
else: return x
|
||||
of "lib", "src", "source", "package", "pckg", "library", "private":
|
||||
b = i
|
||||
else:
|
||||
return x.replace('.', '_')
|
||||
result = ""
|
||||
|
||||
proc withPackageName*(path: string): string =
|
||||
|
||||
@@ -231,11 +231,11 @@ proc compile(c: PCtx, s: PSym): int =
|
||||
result = vmgen.genProc(c, s)
|
||||
#c.echoCode
|
||||
|
||||
proc execute(c: PCtx, start: int) =
|
||||
proc rawExecute(c: PCtx, start: int, tos: PStackFrame) =
|
||||
var pc = start
|
||||
var tos = tos
|
||||
var regs: TNodeSeq # alias to tos.slots for performance
|
||||
var tos: PStackFrame
|
||||
newSeq(regs, c.prc.maxSlots)
|
||||
move(regs, tos.slots)
|
||||
while true:
|
||||
{.computedGoto.}
|
||||
let instr = c.code[pc]
|
||||
@@ -841,6 +841,13 @@ proc execute(c: PCtx, start: int) =
|
||||
regs[ra].strVal = typ.typeToString(preferExported)
|
||||
inc pc
|
||||
|
||||
proc execute(c: PCtx, start: int) =
|
||||
var pc = start
|
||||
var regs: TNodeSeq # alias to tos.slots for performance
|
||||
var tos: PStackFrame
|
||||
newSeq(tos.slots, c.prc.maxSlots)
|
||||
rawExecute(c, start, tos)
|
||||
|
||||
proc evalStmt*(c: PCtx, n: PNode) =
|
||||
let start = genStmt(c, n)
|
||||
# execute new instructions; this redundant opcEof check saves us lots
|
||||
@@ -892,6 +899,9 @@ proc setupMacroParam(x: PNode): PNode =
|
||||
result = x
|
||||
if result.kind in {nkHiddenSubConv, nkHiddenStdConv}: result = result.sons[1]
|
||||
|
||||
type
|
||||
PEvalContext* = PCtx
|
||||
|
||||
proc evalMacroCall(c: PEvalContext, n, nOrig: PNode, sym: PSym): PNode =
|
||||
# XXX GlobalError() is ugly here, but I don't know a better solution for now
|
||||
inc(evalTemplateCounter)
|
||||
|
||||
Reference in New Issue
Block a user