diff options
-rwxr-xr-x | compiler/evals.nim | 53 | ||||
-rwxr-xr-x | lib/pure/algorithm.nim | 6 | ||||
-rwxr-xr-x | lib/pure/osproc.nim | 4 | ||||
-rwxr-xr-x | todo.txt | 13 |
4 files changed, 51 insertions, 25 deletions
diff --git a/compiler/evals.nim b/compiler/evals.nim index 6fcbd911a..4372e3179 100755 --- a/compiler/evals.nim +++ b/compiler/evals.nim @@ -355,25 +355,40 @@ proc evalFieldAccess(c: PEvalContext, n: PNode, flags: TEvalFlags): PNode = result = emptyNode proc evalAsgn(c: PEvalContext, n: PNode): PNode = - result = evalAux(c, n.sons[0], {efLValue}) - if isSpecial(result): return - var x = result - result = evalAux(c, n.sons[1], {}) - if isSpecial(result): return - myreset(x) - x.kind = result.kind - x.typ = result.typ - case x.kind - of nkCharLit..nkInt64Lit: - x.intVal = result.intVal - of nkFloatLit..nkFloat64Lit: - x.floatVal = result.floatVal - of nkStrLit..nkTripleStrLit: - x.strVal = result.strVal - else: - if not (x.kind in {nkEmpty..nkNilLit}): - discardSons(x) - for i in countup(0, sonsLen(result) - 1): addSon(x, result.sons[i]) + var a = n.sons[0] + if a.kind == nkBracketExpr and a.sons[0].typ.kind in {tyString, tyCString}: + result = evalAux(c, a.sons[0], {efLValue}) + if isSpecial(result): return + var x = result + result = evalAux(c, a.sons[1], {}) + if isSpecial(result): return + var idx = getOrdValue(result) + + result = evalAux(c, n.sons[1], {}) + if isSpecial(result): return + if result.kind != nkCharLit: InternalError(n.info, "no character") + + if (idx >= 0) and (idx < len(x.strVal)): + x.strVal[int(idx)] = chr(int(result.intVal)) + else: + stackTrace(c, n, errIndexOutOfBounds) + else: + result = evalAux(c, n.sons[0], {efLValue}) + if isSpecial(result): return + var x = result + result = evalAux(c, n.sons[1], {}) + if isSpecial(result): return + myreset(x) + x.kind = result.kind + x.typ = result.typ + case x.kind + of nkCharLit..nkInt64Lit: x.intVal = result.intVal + of nkFloatLit..nkFloat64Lit: x.floatVal = result.floatVal + of nkStrLit..nkTripleStrLit: x.strVal = result.strVal + else: + if not (x.kind in {nkEmpty..nkNilLit}): + discardSons(x) + for i in countup(0, sonsLen(result) - 1): addSon(x, result.sons[i]) result = emptyNode assert result.kind == nkEmpty diff --git a/lib/pure/algorithm.nim b/lib/pure/algorithm.nim index 517819e1c..b08770e30 100755 --- a/lib/pure/algorithm.nim +++ b/lib/pure/algorithm.nim @@ -40,7 +40,7 @@ proc merge[T](a, b: var openArray[T], lo, m, hi: int, cmp: proc (x, y: T): int, order: TSortOrder) = template `<-` (a, b: expr) = when onlySafeCode: - a = b + shallowCopy(a, b) else: copyMem(addr(a), addr(b), sizeof(T)) # optimization: If max(left) <= min(right) there is nothing to do! @@ -54,7 +54,7 @@ proc merge[T](a, b: var openArray[T], lo, m, hi: int, when onlySafeCode: var bb = 0 while j <= m: - b[bb] = a[j] + b[bb] <- a[j] inc(bb) inc(j) else: @@ -74,7 +74,7 @@ proc merge[T](a, b: var openArray[T], lo, m, hi: int, # copy rest of b: when onlySafeCode: while k < j: - a[k] = b[i] + a[k] <- b[i] inc(k) inc(i) else: diff --git a/lib/pure/osproc.nim b/lib/pure/osproc.nim index de5317717..60bef813d 100755 --- a/lib/pure/osproc.nim +++ b/lib/pure/osproc.nim @@ -475,9 +475,9 @@ elif not defined(useNimRtl): result.exitCode = -3 # for ``waitForExit`` if pipe(p_stdin) != 0'i32 or pipe(p_stdout) != 0'i32 or pipe(p_stderr) != 0'i32: - OSError("failed to create a pipe") + OSError() var Pid = fork() - if Pid < 0: OSError("failed to fork process") + if Pid < 0: OSError() if pid == 0: ## child process: diff --git a/todo.txt b/todo.txt index 5a5e77ad2..5022f869e 100755 --- a/todo.txt +++ b/todo.txt @@ -1,6 +1,5 @@ High priority (version 0.8.12) ============================== -* implement write access to ``s[i]`` for macros * implement message passing built-ins * add --deadlock_prevention:on|off switch? timeout for locks? * built-in serialization @@ -20,6 +19,18 @@ version 0.9.0 - fix overloading resolution - make ^ available as operator - implement closures; implement proper coroutines +- rethink comment syntax; people want:: + + type + TConfig* = object + limit*: int + outFile*: string + # Regex patterns to ignore. TLogEntry field -> regex pattern + # If this matches, the request will NOT be shown. + ignoreRe*: TTable[string, string] + + I think a good compromise is to define positions for the docgen in the + grammar and ignore other comments everywhere. Bugs ---- |