made more tests green; fixes #201
This commit is contained in:
parent
8178cd4fab
commit
a59abdf8e4
13 changed files with 43 additions and 30 deletions
|
|
@ -66,12 +66,12 @@ proc setItem[T,D] (AKey: T, AValue: D, ANode: PNode[T,D]): ref TItem[T,D] {.inli
|
|||
proc cmp[T:Int8|Int16|Int32|Int64|Int] (a,b: T): T {.inline.} =
|
||||
return a-b
|
||||
|
||||
template binSearchImpl *(docmp: expr) =
|
||||
template binSearchImpl *(docmp: expr) {.immediate.} =
|
||||
var bFound = false
|
||||
result = 0
|
||||
var H = haystack.len -1
|
||||
while result <= H :
|
||||
var I = (result + H) shr 1
|
||||
var I {.inject.} = (result + H) shr 1
|
||||
var SW = docmp
|
||||
if SW < 0: result = I + 1
|
||||
else:
|
||||
|
|
|
|||
|
|
@ -1,8 +1,12 @@
|
|||
|
||||
template tmp[T](x: var seq[T]) =
|
||||
var yz: T
|
||||
#var yz: T # XXX doesn't work yet
|
||||
x = @[1, 2, 3]
|
||||
|
||||
macro tmp2[T](x: var seq[T]): stmt =
|
||||
nil
|
||||
|
||||
var y: seq[int]
|
||||
tmp(y)
|
||||
tmp(y)
|
||||
echo y.repr
|
||||
|
|
|
|||
|
|
@ -1,6 +1,10 @@
|
|||
discard """
|
||||
output: "123100"
|
||||
"""
|
||||
|
||||
template hygienic(val: expr) =
|
||||
var `*x` = val
|
||||
stdout.write `*x`
|
||||
var x = val
|
||||
stdout.write x
|
||||
|
||||
var x = 100
|
||||
|
||||
|
|
@ -8,7 +8,7 @@ type
|
|||
TA = tuple[a: int]
|
||||
PA = ref TA
|
||||
|
||||
macro test*(a: stmt): stmt =
|
||||
macro test*(a: stmt): stmt {.immediate.} =
|
||||
var val: PA
|
||||
new(val)
|
||||
val.a = 4
|
||||
|
|
@ -16,7 +16,7 @@ macro test*(a: stmt): stmt =
|
|||
test:
|
||||
"hi"
|
||||
|
||||
macro test2*(a: stmt): stmt =
|
||||
macro test2*(a: stmt): stmt {.immediate.} =
|
||||
proc testproc(recurse: int) =
|
||||
echo "Thats weird"
|
||||
var o : PNimrodNode = nil
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ discard """
|
|||
import
|
||||
macros, strutils
|
||||
|
||||
macro test_macro*(n: stmt): stmt =
|
||||
macro test_macro*(n: stmt): stmt {.immediate.} =
|
||||
result = newNimNode(nnkStmtList)
|
||||
var ass : PNimrodNode = newNimNode(nnkAsgn)
|
||||
add(ass, newIdentNode("str"))
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ discard """
|
|||
import
|
||||
macros, strutils
|
||||
|
||||
macro outterMacro*(n: stmt): stmt =
|
||||
macro outterMacro*(n: stmt): stmt {.immediate.} =
|
||||
let n = callsite()
|
||||
var j : string = "hi"
|
||||
proc innerProc(i: int): string =
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
discard """
|
||||
output: '''true'''
|
||||
cmd: "nimrod cc --gc:none --hints:on $# $#"
|
||||
cmd: "nimrod cc --hints:on $# $#"
|
||||
"""
|
||||
|
||||
import hashes, sets
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue