diff options
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/pragmas.nim | 20 | ||||
-rw-r--r-- | compiler/semfold.nim | 10 |
2 files changed, 21 insertions, 9 deletions
diff --git a/compiler/pragmas.nim b/compiler/pragmas.nim index 85e850834..3bed7fa03 100644 --- a/compiler/pragmas.nim +++ b/compiler/pragmas.nim @@ -402,10 +402,22 @@ proc relativeFile(c: PContext; n: PNode; ext=""): string = if result.len == 0: result = s proc processCompile(c: PContext, n: PNode) = - let found = relativeFile(c, n) - let trunc = found.changeFileExt("") - extccomp.addExternalFileToCompile(found) - extccomp.addFileToLink(completeCFilePath(trunc, false)) + var s = expectStrLit(c, n) + var found = parentDir(n.info.toFullPath) / s + if '*' in found: + for f in os.walkFiles(found): + let trunc = f.changeFileExt("") + extccomp.addExternalFileToCompile(f) + extccomp.addFileToLink(completeCFilePath(trunc, false)) + else: + if not fileExists(found): + if isAbsolute(s): found = s + else: + found = findFile(s) + if found.len == 0: found = s + let trunc = found.changeFileExt("") + extccomp.addExternalFileToCompile(found) + extccomp.addFileToLink(completeCFilePath(trunc, false)) proc processCommonLink(c: PContext, n: PNode, feature: TLinkFeature) = let found = relativeFile(c, n, CC[cCompiler].objExt) diff --git a/compiler/semfold.nim b/compiler/semfold.nim index e3469c602..05e398c9a 100644 --- a/compiler/semfold.nim +++ b/compiler/semfold.nim @@ -216,24 +216,24 @@ proc getIntervalType*(m: TMagic, n: PNode): PType = if b.kind in ordIntLit: let x = b.intVal|+|1 if (x and -x) == x and x >= 0: - result = makeRange(a.typ, 0, b.intVal) + result = makeRange(n.typ, 0, b.intVal) of mModU: let a = n.sons[1] let b = n.sons[2] if b.kind in ordIntLit: if b.intVal >= 0: - result = makeRange(a.typ, 0, b.intVal-1) + result = makeRange(n.typ, 0, b.intVal-1) else: - result = makeRange(a.typ, b.intVal+1, 0) + result = makeRange(n.typ, b.intVal+1, 0) of mModI: # so ... if you ever wondered about modulo's signedness; this defines it: let a = n.sons[1] let b = n.sons[2] if b.kind in {nkIntLit..nkUInt64Lit}: if b.intVal >= 0: - result = makeRange(a.typ, -(b.intVal-1), b.intVal-1) + result = makeRange(n.typ, -(b.intVal-1), b.intVal-1) else: - result = makeRange(a.typ, b.intVal+1, -(b.intVal+1)) + result = makeRange(n.typ, b.intVal+1, -(b.intVal+1)) of mDivI, mDivU: binaryOp(`|div|`) of mMinI: |