transf and vmgen compile again

This commit is contained in:
Andreas Rumpf 2018-05-12 09:38:41 +02:00
commit fedc136985
9 changed files with 234 additions and 223 deletions

View file

@ -9,18 +9,18 @@
import ast, types, msgs, os, streams, options, idents
proc opSlurp*(file: string, info: TLineInfo, module: PSym): string =
proc opSlurp*(file: string, info: TLineInfo, module: PSym; conf: ConfigRef): string =
try:
var filename = parentDir(info.toFullPath) / file
if not fileExists(filename):
filename = file.findFile
filename = findFile(conf, file)
result = readFile(filename)
# we produce a fake include statement for every slurped filename, so that
# the module dependencies are accurate:
appendToModule(module, newNode(nkIncludeStmt, info, @[
newStrNode(nkStrLit, filename)]))
except IOError:
localError(info, errCannotOpenFile, file)
localError(conf, info, "cannot open file: " & file)
result = ""
proc atomicTypeX(name: string; m: TMagic; t: PType; info: TLineInfo): PNode =
@ -271,7 +271,7 @@ proc mapTypeToAstX(t: PType; info: TLineInfo;
of tyOr: result = mapTypeToBracket("or", mOr, t, info)
of tyNot: result = mapTypeToBracket("not", mNot, t, info)
of tyAnything: result = atomicType("anything", mNone)
of tyInferred: internalAssert false
of tyInferred: assert false
of tyStatic, tyFromExpr:
if inst:
if t.n != nil: result = t.n.copyTree
@ -281,7 +281,7 @@ proc mapTypeToAstX(t: PType; info: TLineInfo;
result.add atomicType("static", mNone)
if t.n != nil:
result.add t.n.copyTree
of tyUnused, tyOptAsRef: internalError("mapTypeToAstX")
of tyUnused, tyOptAsRef: assert(false, "mapTypeToAstX")
proc opMapTypeToAst*(t: PType; info: TLineInfo): PNode =
result = mapTypeToAstX(t, info, false, true)