preparations for Nimble NimScript integrations; minor cleanups
This commit is contained in:
parent
10a7830ba2
commit
9659540b18
7 changed files with 74 additions and 6 deletions
|
|
@ -92,7 +92,6 @@ proc resetAllModulesHard* =
|
||||||
magicsys.resetSysTypes()
|
magicsys.resetSysTypes()
|
||||||
# XXX
|
# XXX
|
||||||
#gOwners = @[]
|
#gOwners = @[]
|
||||||
#rangeDestructorProc = nil
|
|
||||||
|
|
||||||
proc checkDepMem(fileIdx: int32): TNeedRecompile =
|
proc checkDepMem(fileIdx: int32): TNeedRecompile =
|
||||||
template markDirty =
|
template markDirty =
|
||||||
|
|
|
||||||
|
|
@ -17,5 +17,4 @@ define:useStdoutAsStdmsg
|
||||||
|
|
||||||
cs:partial
|
cs:partial
|
||||||
#define:useNodeIds
|
#define:useNodeIds
|
||||||
symbol:nimfix
|
|
||||||
#gc:markAndSweep
|
#gc:markAndSweep
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,8 @@ proc listDirs(a: VmArgs, filter: set[PathComponent]) =
|
||||||
if kind in filter: result.add path
|
if kind in filter: result.add path
|
||||||
setResult(a, result)
|
setResult(a, result)
|
||||||
|
|
||||||
proc setupVM(module: PSym; scriptName: string): PEvalContext =
|
proc setupVM*(module: PSym; scriptName: string): PEvalContext =
|
||||||
|
# For Nimble we need to export 'setupVM'.
|
||||||
result = newCtx(module)
|
result = newCtx(module)
|
||||||
result.mode = emRepl
|
result.mode = emRepl
|
||||||
registerAdditionalOps(result)
|
registerAdditionalOps(result)
|
||||||
|
|
|
||||||
|
|
@ -1401,6 +1401,10 @@ proc evalExpr*(c: PCtx, n: PNode): PNode =
|
||||||
assert c.code[start].opcode != opcEof
|
assert c.code[start].opcode != opcEof
|
||||||
result = execute(c, start)
|
result = execute(c, start)
|
||||||
|
|
||||||
|
proc getGlobalValue*(c: PCtx; s: PSym): PNode =
|
||||||
|
internalAssert s.kind in {skLet, skVar} and sfGlobal in s.flags
|
||||||
|
result = c.globals.sons[s.position-1]
|
||||||
|
|
||||||
include vmops
|
include vmops
|
||||||
|
|
||||||
# for now we share the 'globals' environment. XXX Coming soon: An API for
|
# for now we share the 'globals' environment. XXX Coming soon: An API for
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,6 @@ path="$lib/js"
|
||||||
path="$lib/pure/unidecode"
|
path="$lib/pure/unidecode"
|
||||||
|
|
||||||
@if nimbabel:
|
@if nimbabel:
|
||||||
babelpath="$home/.babel/pkgs/"
|
|
||||||
nimblepath="$home/.nimble/pkgs/"
|
nimblepath="$home/.nimble/pkgs/"
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -150,3 +150,30 @@ template task*(name: untyped; description: string; body: untyped): untyped =
|
||||||
elif cmd ==? astToStr(name):
|
elif cmd ==? astToStr(name):
|
||||||
setCommand "nop"
|
setCommand "nop"
|
||||||
`name Task`()
|
`name Task`()
|
||||||
|
|
||||||
|
type
|
||||||
|
VersionReq* = distinct string ## Describes a version requirement.
|
||||||
|
|
||||||
|
template v*(name: string{lit}): VersionReq = VersionReq(name)
|
||||||
|
template special*(name: string): VersionReq = VersionReq(name)
|
||||||
|
template `<`*(v: VersionReq): VersionReq = VersionReq("<" & string(v))
|
||||||
|
template `<=`*(v: VersionReq): VersionReq = VersionReq("<=" & string(v))
|
||||||
|
template `>`*(v: VersionReq): VersionReq = VersionReq(">" & string(v))
|
||||||
|
template `>=`*(v: VersionReq): VersionReq = VersionReq(">=" & string(v))
|
||||||
|
template `&`*(a, b: VersionReq): VersionReq =
|
||||||
|
VersionReq(string(a) & " & " & string(b))
|
||||||
|
|
||||||
|
const
|
||||||
|
anyVersion* = VersionReq("*")
|
||||||
|
|
||||||
|
var
|
||||||
|
packageName* = ""
|
||||||
|
version*, author*, description*, license*, srcdir*,
|
||||||
|
binDir*, backend*: string
|
||||||
|
|
||||||
|
skipDirs*, skipFiles*, skipExt*, installDirs*, installFiles*,
|
||||||
|
installExt*, bin*: seq[string]
|
||||||
|
requiresData*: seq[(string, VersionReq)]
|
||||||
|
|
||||||
|
proc requires*(name: string; v: VersionReq) =
|
||||||
|
requiresData.add((name, v))
|
||||||
|
|
|
||||||
43
todo.txt
43
todo.txt
|
|
@ -1,6 +1,9 @@
|
||||||
version 0.11.4
|
version 0.11.4
|
||||||
==============
|
==============
|
||||||
|
|
||||||
|
- make tuple unpacking work in a non-var/let context
|
||||||
|
- built-in 'getImpl'
|
||||||
|
|
||||||
- document special cased varargs[untyped] and varargs[typed]
|
- document special cased varargs[untyped] and varargs[typed]
|
||||||
|
|
||||||
- The remaining bugs of the lambda lifting pass that is responsible to enable
|
- The remaining bugs of the lambda lifting pass that is responsible to enable
|
||||||
|
|
@ -50,14 +53,50 @@ Low priority:
|
||||||
Misc
|
Misc
|
||||||
----
|
----
|
||||||
|
|
||||||
- make tuple unpacking work in a non-var/let context
|
|
||||||
- built-in 'getImpl'
|
|
||||||
- prevent 'alloc(TypeWithGCedMemory)'
|
- prevent 'alloc(TypeWithGCedMemory)'
|
||||||
|
|
||||||
|
|
||||||
Bugs
|
Bugs
|
||||||
====
|
====
|
||||||
|
|
||||||
|
- Can lead to wrong C code:
|
||||||
|
|
||||||
|
template cd*(dir: string, body: stmt) =
|
||||||
|
## Sets the current dir to ``dir``, executes ``body`` and restores the
|
||||||
|
## previous working dir.
|
||||||
|
let lastDir = getCurrentDir()
|
||||||
|
setCurrentDir(dir)
|
||||||
|
try:
|
||||||
|
body
|
||||||
|
finally:
|
||||||
|
setCurrentDir(lastDir)
|
||||||
|
|
||||||
|
proc test =
|
||||||
|
cd dir:
|
||||||
|
var output = execProcess("git tag")
|
||||||
|
case meth
|
||||||
|
of DownloadMethod.git:
|
||||||
|
output = execProcess("git tag")
|
||||||
|
of DownloadMethod.hg:
|
||||||
|
output = execProcess("hg tags")
|
||||||
|
if output.len > 0:
|
||||||
|
case meth
|
||||||
|
of DownloadMethod.git:
|
||||||
|
result = @[]
|
||||||
|
for i in output.splitLines():
|
||||||
|
if i == "": continue
|
||||||
|
result.add(i)
|
||||||
|
of DownloadMethod.hg:
|
||||||
|
result = @[]
|
||||||
|
for i in output.splitLines():
|
||||||
|
if i == "": continue
|
||||||
|
var tag = ""
|
||||||
|
discard parseUntil(i, tag, ' ')
|
||||||
|
if tag != "tip":
|
||||||
|
result.add(tag)
|
||||||
|
else:
|
||||||
|
result = @[]
|
||||||
|
|
||||||
- VM: Pegs do not work at compile-time
|
- VM: Pegs do not work at compile-time
|
||||||
- VM: ptr/ref T cannot work in general
|
- VM: ptr/ref T cannot work in general
|
||||||
- blocks can "export" an identifier but the CCG generates {} for them ...
|
- blocks can "export" an identifier but the CCG generates {} for them ...
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue