Files
brolang/examples/interop/recursive/app/main.bro
T

17 lines
452 B
Plaintext

native :: import "../include/native.h"
# Exercises a self-referential imported C record (`struct Node { struct Node *next; int value; }`):
# the importer must not recurse forever populating it, and the checker must accept the
# self-referential `?*mut Node` field as C-layout-compatible.
main :: func() i32 {
node native.Node = native.Node { next = none, value = 7 }
if node.next |_| {
return 1
}
if node.value == 7 {
return 0
}
return 2
}