mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-12-08 20:38:47 +00:00
samples: add Terra samples
source: https://github.com/zdevito/terra/tree/master/tests
This commit is contained in:
17
samples/Terra/multimacro.t
Normal file
17
samples/Terra/multimacro.t
Normal file
@@ -0,0 +1,17 @@
|
||||
|
||||
local bar = terralib.internalmacro(function(ctx,tree,typ,x)
|
||||
return {terralib.newtree(typ.tree, { kind = terralib.kinds.literal, type = double, value = 4.0 }), x }
|
||||
end)
|
||||
|
||||
local x,y,z = 1,2,3
|
||||
|
||||
terra foo() : int
|
||||
var a,b = bar(int,x + y + z)
|
||||
var c = bar(int,0)._0 + 1
|
||||
--bar2(int) = bar2(int) + 5
|
||||
--bar3(up(&a),up(&a))
|
||||
return a + b + c
|
||||
end
|
||||
|
||||
local test = require("test")
|
||||
test.eq(15,foo())
|
||||
Reference in New Issue
Block a user