Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/nim-lang/nif into inst-ca…
Browse files Browse the repository at this point in the history
…ll-return-type
  • Loading branch information
metagn committed Jan 6, 2025
2 parents 67f1487 + 72cd3be commit ff9cce1
Show file tree
Hide file tree
Showing 19 changed files with 274 additions and 272 deletions.
4 changes: 3 additions & 1 deletion src/lib/nifbuilder.nim
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,6 @@ template addLineIgnoreZero*(b: var string; x: int32) =
addLine b, x

proc addLineInfo*(b: var Builder; col, line: int32; file = "") =
addSep b
var format = LineInfoNone
if col != 0'i32:
format = LineInfoCol
Expand All @@ -224,12 +223,15 @@ proc addLineInfo*(b: var Builder; col, line: int32; file = "") =
drainPending b
case format
of LineInfoCol:
addSep b
b.buf.addLine col
of LineInfoColLine:
addSep b
b.buf.addLineIgnoreZero col
b.buf.add ','
b.buf.addLine line
of LineInfoFile:
addSep b
b.buf.addLineIgnoreZero col
b.buf.add ','
b.buf.addLineIgnoreZero line
Expand Down
14 changes: 7 additions & 7 deletions tests/nimony/basics/t2.nif
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
(.nif24)
,2,tests/nimony/basics/t2.nim(stmts 2,1
(type :int.0.t277k7ei1
(type :int.0.t277k7ei1
(i -1) . 5
(pragmas 2
(magic 7 Int)) .) 2,3
(type :float.0.t277k7ei1
(type :float.0.t277k7ei1
(f +64) . 7
(pragmas 2
(magic 7 Float)) .) 2,4
(type :string.0.t277k7ei1
(type :string.0.t277k7ei1
(string) . 8
(pragmas 2
(magic 7 String)) .) ,7
(proc 5 :\2B.0.t277k7ei1
(proc 5 :\2B.0.t277k7ei1
(add -3) . . 9
(params 1
(param :x.0 . . ~8,~6
Expand Down Expand Up @@ -53,9 +53,9 @@
(param :x.2 . . ~14,~17
(i -1) .)) 2,~17
(i -1) . . 31
(stmts
(stmts
(result :result.1 . . ~29,~17
(i -1) .)
(asgn result.1
(i -1) .)
(asgn result.1
(expr x.2)) ~31
(ret result.1))))
2 changes: 1 addition & 1 deletion tests/nimony/basics/tbinarytree.nif
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
(.nif24)
,1,tests/nimony/basics/tbinarytree.nim(stmts 5
(type :int.0.tbivahh0m
(type :int.0.tbivahh0m
(i -1) . 5
(pragmas 2
(magic 7 Int)) .) 10,3
Expand Down
36 changes: 18 additions & 18 deletions tests/nimony/basics/tbool.nif
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
(.nif24)
,1,tests/nimony/basics/tbool.nim(stmts 26
(type ~21 :bool.0.tbojn1uzv
(type ~21 :bool.0.tbojn1uzv
(bool) . ~16
(pragmas 2
(magic 7 Bool)) 2
(enum
(u +8) ~18,1
(efld ~8 :false.0.tbojn1uzv
(false) .
(bool)
(efld ~8 :false.0.tbojn1uzv
(false) .
(bool)
(tup +0 "false")) ~8,1
(efld ~7 :true.0.tbojn1uzv
(true) .
(bool)
(efld ~7 :true.0.tbojn1uzv
(true) .
(bool)
(tup +1 "true")))) 5
(proc :dollar`.bool.0.tbojn1uzv x . .
(params
(proc :dollar`.bool.0.tbojn1uzv x . .
(params
(param :e.0 . . 21
(bool) .))
(string) . .
(string) . .
(stmts 23
(result :result.0 . .
(string) .) 23
(case e.0 ~18,1
(of
(set
(false))
(stmts
(of
(set
(false))
(stmts
(ret "false"))) ~8,1
(of
(set
(true))
(stmts
(of
(set
(true))
(stmts
(ret "true"))))
(ret result.0))) 4,3
(let :x.0.tbojn1uzv . . 22,~3
Expand Down
16 changes: 8 additions & 8 deletions tests/nimony/basics/tcstring.nif
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
(.nif24)
,2,tests/nimony/basics/tcstring.nim(stmts 2,1
(type :int.0.tcs1re56a
(type :int.0.tcs1re56a
(i -1) . 5
(pragmas 2
(magic 7 Int)) .) 2,2
(type :bool.0.tcs1re56a
(type :bool.0.tcs1re56a
(bool) . 6
(pragmas 2
(magic 7 Bool)) .) 2,4
(type :cstring.0.tcs1re56a
(type :cstring.0.tcs1re56a
(cstring) . 9
(pragmas 2
(magic 7 Cstring)) .) 2,5
(type :pointer.0.tcs1re56a
(type :pointer.0.tcs1re56a
(pointer) . 9
(pragmas 2
(magic 7 Pointer)) .) ,8
(proc 5 :\2B.0.tcs1re56a
(proc 5 :\2B.0.tcs1re56a
(add -3) . . 9
(params 1
(param :x.0 . . ~8,~7
Expand All @@ -26,7 +26,7 @@
(i -1) 26
(pragmas 2
(magic 7 "AddI")) . .) ,9
(proc 5 :\2D.0.tcs1re56a
(proc 5 :\2D.0.tcs1re56a
(sub -3) . . 9
(params 1
(param :x.1 . . ~8,~8
Expand All @@ -36,7 +36,7 @@
(i -1) 26
(pragmas 2
(magic 7 "SubI")) . .) ,11
(proc 5 :<=.0.tcs1re56a
(proc 5 :<=.0.tcs1re56a
(le -3) . . 10
(params 1
(param :x.2 . . ~9,~10
Expand All @@ -56,7 +56,7 @@
(const :myconst.0.tcs1re56a . . ,~14
(cstring) 17
(conv ~17,~14
(cstring)
(cstring)
(suf "abc" "R"))) 4,20
(var :zz.0.tcs1re56a . . ~2,~16
(cstring)
Expand Down
4 changes: 2 additions & 2 deletions tests/nimony/basics/tdefinedarg.nif
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
(.nif24)
,1,tests/nimony/basics/tdefinedarg.nim(stmts 5
(type :untyped.0.tdetxkbxo
(type :untyped.0.tdetxkbxo
(untyped) . 9
(pragmas 2
(magic 7 Expr)) .) ,2
(proc 5 :defined.0.tdetxkbxo
(proc 5 :defined.0.tdetxkbxo
(defined) . . 12
(params 1
(param :x.0 . . ~8,~2
Expand Down
26 changes: 13 additions & 13 deletions tests/nimony/basics/tdistinct.nif
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
(.nif24)
,2,tests/nimony/basics/tdistinct.nim(stmts 2,1
(type :int.0.tdikoa9tc1
(type :int.0.tdikoa9tc1
(i -1) . 5
(pragmas 2
(magic 7 Int)) .) 2,2
(type :bool.0.tdikoa9tc1
(type :bool.0.tdikoa9tc1
(bool) . 6
(pragmas 2
(magic 7 Bool)) .) 2,3
(type :char.0.tdikoa9tc1
(type :char.0.tdikoa9tc1
(c +8) . 6
(pragmas 2
(magic 7 Char)) .) 2,4
(type :string.0.tdikoa9tc1
(type :string.0.tdikoa9tc1
(string) . 8
(pragmas 2
(magic 7 String)) .) 2,6
(type :int8.0.tdikoa9tc1
(type :int8.0.tdikoa9tc1
(i +8) . 6
(pragmas 2
(magic 7 Int8)) .) ,8
(proc 5 :\2B.0.tdikoa9tc1
(proc 5 :\2B.0.tdikoa9tc1
(add -3) . . 9
(params 1
(param :x.0 . . ~8,~7
Expand All @@ -30,7 +30,7 @@
(i -1) 26
(pragmas 2
(magic 7 "AddI")) . .) ,9
(proc 5 :\2D.0.tdikoa9tc1
(proc 5 :\2D.0.tdikoa9tc1
(sub -3) . . 9
(params 1
(param :x.1 . . ~8,~8
Expand All @@ -40,7 +40,7 @@
(i -1) 26
(pragmas 2
(magic 7 "SubI")) . .) ,11
(proc 5 :<=.0.tdikoa9tc1
(proc 5 :<=.0.tdikoa9tc1
(le -3) . . 10
(params 1
(param :x.2 . . ~9,~10
Expand All @@ -59,13 +59,13 @@
(param :y.3 . . 3 VarId.0.tdikoa9tc1 .)) 15 VarId.0.tdikoa9tc1 30
(pragmas 2
(borrow)) . 9
(stmts
(ret
(dconv 6 VarId.0.tdikoa9tc1
(stmts
(ret
(dconv 6 VarId.0.tdikoa9tc1
(add ~7,~16
(i -1)
(i -1)
(dconv ~7,~16
(i -1) x.3)
(i -1) x.3)
(dconv ~7,~16
(i -1) y.3)))))) 4,24
(var :x.0.tdikoa9tc1 . . 3 VarId.0.tdikoa9tc1 .) 2,26
Expand Down
Loading

0 comments on commit ff9cce1

Please sign in to comment.