Merge branch 'vm2' of github.com:Araq/Nimrod into vm2

This commit is contained in:
Araq 2013-12-24 01:30:48 +01:00
commit 1081c104d0
78 changed files with 9241 additions and 595 deletions

View file

@ -44,6 +44,10 @@ good(genericParamOnce(TFoo, TFoo))
bad(genericParamOnce(string, int))
bad(genericParamOnce(TFoo, float))
type
type1 = typedesc
type2 = typedesc
proc typePairs(A, B: type1; C, D: type2) = nil
good(typePairs(int, int, TFoo, TFOO))

View file

@ -1,16 +1,16 @@
discard """
output: '''yeah A
yeah A
yeah CD
yeah CD
yeah A
yeah CD
yeah CD
yeah A
yeah B
yeah A
yeah A
yeah A'''
output: '''yeah A enumB
yeah A enumB
yeah CD enumD
yeah CD enumE
yeah A enumB
yeah CD enumE
yeah CD enumD
yeah A enumB
yeah B enumC
yeah A enumB
yeah A enumB
yeah A enumB'''
"""
type
@ -32,13 +32,14 @@ proc vm() =
while true:
{.computedGoto.}
let instr = instructions[pc]
let ra = instr.succ # instr.regA
case instr
of enumA:
echo "yeah A"
echo "yeah A ", ra
of enumC, enumD:
echo "yeah CD"
echo "yeah CD ", ra
of enumB:
echo "yeah B"
echo "yeah B ", ra
of enumE:
break
inc(pc)

View file

@ -257,7 +257,7 @@ proc limitCommitMsg(m: string): string =
proc handleWebMessage(state: PState, line: string) =
echo("Got message from hub: " & line)
var json = parseJson(line)
if json.existsKey("payload"):
if json.hasKey("payload"):
for i in 0..min(4, json["payload"]["commits"].len-1):
var commit = json["payload"]["commits"][i]
# Create the message
@ -273,8 +273,8 @@ proc handleWebMessage(state: PState, line: string) =
# Send message to #nimrod.
state.ircClient.privmsg(joinChans[0], message)
elif json.existsKey("redisinfo"):
assert json["redisinfo"].existsKey("port")
elif json.hasKey("redisinfo"):
assert json["redisinfo"].hasKey("port")
#let redisPort = json["redisinfo"]["port"].num
state.dbConnected = true

View file

@ -26,7 +26,7 @@ macro importImpl_forward(name, returns): stmt {.immediate.} =
p2.add newIdentNode("errors")
p2.add newNimNode(nnkVarTy)
p2.add newNimNode(nnkEmpty)
p2[1].add newNimNOde(nnkBracketExpr)
p2[1].add newNimNode(nnkBracketExpr)
p2[1][0].add newIdentNode("seq")
p2[1][0].add newIdentNode("string")
res[3].add p2

View file

@ -1,5 +1,5 @@
discard """
output: '''110
output: '''3060
true'''
"""

View file

@ -1,7 +1,7 @@
discard """
file: "t99bott.nim"
line: 26
errormsg: "constant expression expected"
errormsg: "cannot evaluate at compile time: bn"
disabled: false
"""
## 99 Bottles of Beer

View file

@ -1,6 +1,6 @@
discard """
file: "tbind2.nim"
line: 12
line: 14
errormsg: "ambiguous call"
"""
# Test the new ``bind`` keyword for templates

View file

@ -1,6 +1,7 @@
discard """
line: 24
errormsg: "usage of 'disallowIf' is a user-defined error"
disabled: true
"""
template optZero{x+x}(x: int): int = x*3
@ -25,4 +26,4 @@ if s[0] != "hi":
echo "do it"
echo "more branches"
else:
nil
discard

View file

@ -1,5 +1,5 @@
discard """
line: 1804
line: 1840
file: "system.nim"
errormsg: "can raise an unlisted exception: ref EIO"
"""

View file

@ -1,6 +1,6 @@
discard """
file: "system.nim"
line: 696
file: "tenummix.nim"
line: 11
errormsg: "type mismatch"
"""

View file

@ -1,5 +1,6 @@
discard """
file: "system.nim"
file: "tnot.nim"
line: 14
errormsg: "type mismatch"
"""
# BUG: following compiles, but should not:

View file

@ -1,6 +1,6 @@
discard """
output: "Error: constant expression expected"
line: 7
output: "Error: cannot evaluate at compile time: x"
line: 10
"""
var x: array[100, char]

View file

@ -1,5 +1,5 @@
discard """
line: 14
line: 12
errormsg: "type mismatch"
"""