diff options
Diffstat (limited to 'testsuite/runnable/recursive_record.elna')
| -rw-r--r-- | testsuite/runnable/recursive_record.elna | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/testsuite/runnable/recursive_record.elna b/testsuite/runnable/recursive_record.elna index 48fb873..1667bf4 100644 --- a/testsuite/runnable/recursive_record.elna +++ b/testsuite/runnable/recursive_record.elna @@ -10,10 +10,10 @@ var second: ^Node third: ^Node -proc malloc(size: Word) -> Pointer +proc malloc#[T](size: Word) -> ^T extern -proc free(ptr: Pointer) +proc free#[T](ptr: ^T) extern proc sum(node: ^Node) -> Int @@ -21,7 +21,7 @@ var result: Int begin result := 0; - if node = nil then + if node = cast(0u: ^Node) then result := 0 else result := node^.value + sum(node^.next) @@ -29,16 +29,16 @@ begin return result begin - first := malloc(#size(Node)); - second := malloc(#size(Node)); - third := malloc(#size(Node)); + first := malloc#[Node](#size(Node)); + second := malloc#[Node](#size(Node)); + third := malloc#[Node](#size(Node)); first^.value := 1; first^.next := second; second^.value := 2; second^.next := third; third^.value := 3; - third^.next := nil; + third^.next := cast(0u: ^Node); assert(sum(first) = 6); assert(first^.next^.next^.value = 3); |
