Merge branch 'devel' into nimv2

This commit is contained in:
Andreas Rumpf 2018-01-08 20:04:25 +01:00
commit 437caf4358
10 changed files with 28 additions and 22 deletions

View file

@ -8,7 +8,7 @@ stages:
.linux_set_path: &linux_set_path_def .linux_set_path: &linux_set_path_def
before_script: before_script:
- export PATH=$(pwd)/bin:$PATH - export PATH=$(pwd)/bin${PATH:+:$PATH}
tags: tags:
- linux - linux

View file

@ -30,7 +30,7 @@ before_script:
- sh build.sh - sh build.sh
- cd .. - cd ..
- sed -i -e 's,cc = gcc,cc = clang,' config/nim.cfg - sed -i -e 's,cc = gcc,cc = clang,' config/nim.cfg
- export PATH=$(pwd)/bin:$PATH - export PATH=$(pwd)/bin${PATH:+:$PATH}
script: script:
- nim c koch - nim c koch
- ./koch boot - ./koch boot

View file

@ -6,7 +6,7 @@ cd csources
sh build.sh sh build.sh
cd .. cd ..
# Add Nim to the PATH # Add Nim to the PATH
export PATH=$(pwd)/bin:$PATH export PATH=$(pwd)/bin${PATH:+:$PATH}
# Bootstrap. # Bootstrap.
nim -v nim -v
nim c koch nim c koch

View file

@ -7,7 +7,7 @@ apt-get install -y -qq build-essential git libcurl4-openssl-dev libsdl1.2-dev li
gcc -v gcc -v
export PATH=$(pwd)/bin:$PATH export PATH=$(pwd)/bin${PATH:+:$PATH}
# Nimble deps # Nimble deps
nim e install_nimble.nims nim e install_nimble.nims

View file

@ -898,6 +898,14 @@ proc gsub(g: var TSrcGen, n: PNode, c: TContext) =
put(g, tkBracketLe, "[") put(g, tkBracketLe, "[")
gcomma(g, n, 2) gcomma(g, n, 2)
put(g, tkBracketRi, "]") put(g, tkBracketRi, "]")
elif n.len > 1 and n.lastSon.kind == nkStmtList:
gsub(g, n[0])
if n.len > 2:
put(g, tkParLe, "(")
gcomma(g, n, 1, -2)
put(g, tkParRi, ")")
put(g, tkColon, ":")
gsub(g, n, n.len-1)
else: else:
if sonsLen(n) >= 1: gsub(g, n.sons[0]) if sonsLen(n) >= 1: gsub(g, n.sons[0])
put(g, tkParLe, "(") put(g, tkParLe, "(")

View file

@ -1876,7 +1876,6 @@ proc semMagic(c: PContext, n: PNode, s: PSym, flags: TExprFlags): PNode =
result = magicsAfterOverloadResolution(c, result, flags) result = magicsAfterOverloadResolution(c, result, flags)
of mRunnableExamples: of mRunnableExamples:
if gCmd == cmdDoc and n.len >= 2 and n.lastSon.kind == nkStmtList: if gCmd == cmdDoc and n.len >= 2 and n.lastSon.kind == nkStmtList:
if n.sons[0].kind == nkIdent:
if sfMainModule in c.module.flags: if sfMainModule in c.module.flags:
let inp = toFullPath(c.module.info) let inp = toFullPath(c.module.info)
if c.runnableExamples == nil: if c.runnableExamples == nil:

View file

@ -918,7 +918,7 @@ This is equivalent to ``var``, but with ``nnkLetSection`` rather than
Concrete syntax: Concrete syntax:
.. code-block:: nim .. code-block:: nim
let v = 3 let a = 3
AST: AST:

View file

@ -97,7 +97,7 @@ proc exec(cmd: string, errorcode: int = QuitFailure, additionalPath = "") =
if not absolute.isAbsolute: if not absolute.isAbsolute:
absolute = getCurrentDir() / absolute absolute = getCurrentDir() / absolute
echo("Adding to $PATH: ", absolute) echo("Adding to $PATH: ", absolute)
putEnv("PATH", prevPath & PathSep & absolute) putEnv("PATH", (if prevPath.len > 0: prevPath & PathSep else: "") & absolute)
echo(cmd) echo(cmd)
if execShellCmd(cmd) != 0: quit("FAILURE", errorcode) if execShellCmd(cmd) != 0: quit("FAILURE", errorcode)
putEnv("PATH", prevPath) putEnv("PATH", prevPath)
@ -402,7 +402,7 @@ proc winReleaseArch(arch: string) =
template withMingw(path, body) = template withMingw(path, body) =
let prevPath = getEnv("PATH") let prevPath = getEnv("PATH")
putEnv("PATH", path & PathSep & prevPath) putEnv("PATH", (if path.len > 0: path & PathSep else: "") & prevPath)
try: try:
body body
finally: finally:

View file

@ -224,7 +224,7 @@ template callFormatOption(res, arg, option) {.dirty.} =
else: else:
res.add format(arg, option) res.add format(arg, option)
macro fmt*(pattern: string): untyped = macro fmt*(pattern: string{lit}): untyped =
## For a specification of the ``fmt`` macro, see the module level documentation. ## For a specification of the ``fmt`` macro, see the module level documentation.
runnableExamples: runnableExamples:
template check(actual, expected: string) = template check(actual, expected: string) =
@ -332,7 +332,7 @@ macro fmt*(pattern: string): untyped =
# works: # works:
import times import times
var nullTime: TimeInfo var nullTime: DateTime
check fmt"{nullTime:yyyy-mm-dd}", "0000-00-00" check fmt"{nullTime:yyyy-mm-dd}", "0000-00-00"
# Unicode string tests # Unicode string tests
@ -609,7 +609,6 @@ proc format*(value: string; specifier: string; res: var string) =
## sense to call this directly, but it is required to exist ## sense to call this directly, but it is required to exist
## by the ``fmt`` macro. ## by the ``fmt`` macro.
let spec = parseStandardFormatSpecifier(specifier) let spec = parseStandardFormatSpecifier(specifier)
var fmode = ffDefault
case spec.typ case spec.typ
of 's', '\0': discard of 's', '\0': discard
else: else:

View file

@ -90,7 +90,7 @@ proc runBasicDLLTest(c, r: var TResults, cat: Category, options: string) =
# posix relies on crappy LD_LIBRARY_PATH (ugh!): # posix relies on crappy LD_LIBRARY_PATH (ugh!):
var libpath = getEnv"LD_LIBRARY_PATH".string var libpath = getEnv"LD_LIBRARY_PATH".string
# Temporarily add the lib directory to LD_LIBRARY_PATH: # Temporarily add the lib directory to LD_LIBRARY_PATH:
putEnv("LD_LIBRARY_PATH", "tests/dll:" & libpath) putEnv("LD_LIBRARY_PATH", "tests/dll" & (if libpath.len > 0: ":" & libpath else: ""))
defer: putEnv("LD_LIBRARY_PATH", libpath) defer: putEnv("LD_LIBRARY_PATH", libpath)
var nimrtlDll = DynlibFormat % "nimrtl" var nimrtlDll = DynlibFormat % "nimrtl"
safeCopyFile("lib" / nimrtlDll, "tests/dll" / nimrtlDll) safeCopyFile("lib" / nimrtlDll, "tests/dll" / nimrtlDll)