Merge branch 'devel' of github.com:Araq/Nimrod into devel
This commit is contained in:
commit
12e247acc6
4 changed files with 39 additions and 3 deletions
|
|
@ -225,8 +225,16 @@ proc semArray(c: PContext, n: PNode, prev: PType): PType =
|
||||||
# properly filled-out in semtypinst (see how tyStaticExpr
|
# properly filled-out in semtypinst (see how tyStaticExpr
|
||||||
# is handled there).
|
# is handled there).
|
||||||
indx = makeRangeWithStaticExpr(c, e)
|
indx = makeRangeWithStaticExpr(c, e)
|
||||||
else:
|
elif e.kind == nkIdent:
|
||||||
indx = e.typ.skipTypes({tyTypeDesc})
|
indx = e.typ.skipTypes({tyTypeDesc})
|
||||||
|
else:
|
||||||
|
let x = semConstExpr(c, e)
|
||||||
|
if x.kind in {nkIntLit..nkUInt64Lit}:
|
||||||
|
indx = makeRangeType(c, 0, x.intVal-1, n.info,
|
||||||
|
x.typ.skipTypes({tyTypeDesc}))
|
||||||
|
else:
|
||||||
|
indx = x.typ.skipTypes({tyTypeDesc})
|
||||||
|
#localError(n[1].info, errConstExprExpected)
|
||||||
addSonSkipIntLit(result, indx)
|
addSonSkipIntLit(result, indx)
|
||||||
if indx.kind == tyGenericInst: indx = lastSon(indx)
|
if indx.kind == tyGenericInst: indx = lastSon(indx)
|
||||||
if indx.kind notin {tyGenericParam, tyStatic, tyFromExpr}:
|
if indx.kind notin {tyGenericParam, tyStatic, tyFromExpr}:
|
||||||
|
|
|
||||||
|
|
@ -1501,7 +1501,7 @@ proc gen(c: PCtx; n: PNode; dest: var TDest; flags: TGenFlags = {}) =
|
||||||
else:
|
else:
|
||||||
localError(n.info, errGenerated, "VM is not allowed to 'cast'")
|
localError(n.info, errGenerated, "VM is not allowed to 'cast'")
|
||||||
else:
|
else:
|
||||||
internalError n.info, "too implement " & $n.kind
|
internalError n.info, "cannot generate VM code for " & n.renderTree
|
||||||
|
|
||||||
proc removeLastEof(c: PCtx) =
|
proc removeLastEof(c: PCtx) =
|
||||||
let last = c.code.len-1
|
let last = c.code.len-1
|
||||||
|
|
|
||||||
23
tests/vm/tarrayboundeval.nim
Normal file
23
tests/vm/tarrayboundeval.nim
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
discard """
|
||||||
|
output: '''7
|
||||||
|
8 8'''
|
||||||
|
"""
|
||||||
|
|
||||||
|
#bug 1063
|
||||||
|
|
||||||
|
const
|
||||||
|
KeyMax = 227
|
||||||
|
myconst = int((KeyMax + 31) / 32)
|
||||||
|
|
||||||
|
type
|
||||||
|
FU = array[int((KeyMax + 31) / 32), cuint]
|
||||||
|
|
||||||
|
echo FU.high
|
||||||
|
|
||||||
|
type
|
||||||
|
PKeyboard* = ptr object
|
||||||
|
TKeyboardState* = object
|
||||||
|
display*: pointer
|
||||||
|
internal: array[int((KeyMax + 31)/32), cuint]
|
||||||
|
|
||||||
|
echo myconst, " ", int((KeyMax + 31) / 32)
|
||||||
|
|
@ -30,7 +30,7 @@ kqueue has not been implemented yet but will be in the future.
|
||||||
The Asynchronous IO API provides both
|
The Asynchronous IO API provides both
|
||||||
a callback interface and an interface which allows you to write code as you
|
a callback interface and an interface which allows you to write code as you
|
||||||
would if you were writing synchronous code. The latter is done through
|
would if you were writing synchronous code. The latter is done through
|
||||||
the use of an ``await`` keyword which behaves similar to C#'s await. The
|
the use of an ``await`` macro which behaves similar to C#'s await. The
|
||||||
following is a very simple chat server demonstrating Nimrod's new async
|
following is a very simple chat server demonstrating Nimrod's new async
|
||||||
capabilities.
|
capabilities.
|
||||||
|
|
||||||
|
|
@ -59,6 +59,11 @@ capabilities.
|
||||||
serve()
|
serve()
|
||||||
runForever()
|
runForever()
|
||||||
|
|
||||||
|
|
||||||
|
Note that this feature has been implemented with Nimrod's macro system and so
|
||||||
|
``await`` and ``async`` are no keywords.
|
||||||
|
|
||||||
|
|
||||||
Library Additions
|
Library Additions
|
||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue