Commit 44aa4345 authored by Christoph Reichenbach's avatar Christoph Reichenbach
Browse files

Fixed examples wrt new location code and added one more

parent 331f4bd0
N 4 6 -> obj 14 4
NI 5 9 -> null 9 25
NI 5 9 -> obj 9 21
N 10 2 -> null 12 7
N 10 2 -> obj 9 15
NO 16 9 -> null 12 7
NO 16 9 -> obj 9 15
type T(x : string, y : int);
fun f(a : nonnull array[int], y : int) : int = {
return a[y];
}
fun main() = {
var b : T := new T("", null);
var c : nonnull T := b;
b := null;
f([1, 2], c.y);
return b.x;
}
N 6 29 -> obj 6 29
N 8 4 -> null 3 50
N 14 4 -> null 12 13
N 14 4 -> null 5 14
N 14 4 -> obj 11 29
N 14 4 -> obj 11 32
type Pair(fst : nonnull int, snd : int);
fun null_producer(n : int) = if (n == 0) { return null; } else { return n; }
fun null_producer(n : int) = {
if (n == 0) {
return null;
}
return n;
}
fun main(n : int) = {
fun main(n : int) : nonnull int = {
var p : Pair := new Pair(0, 1);
p.snd := null; // this should be fine
p.snd := null;
p.fst := null_producer(n);
return p.fst;
}
\ No newline at end of file
}
N 4 25 -> obj 4 25
N 4 28 -> obj 4 28
N 5 15 -> obj 5 15
N 5 18 -> obj 5 18
N 8 6 -> obj 4 17
N 8 6 -> obj 5 7
N 8 6 -> null 4 31
\ No newline at end of file
N 8 2 -> null 4 31
N 8 2 -> obj 4 17
N 8 2 -> obj 4 25
N 8 2 -> obj 4 28
N 8 2 -> obj 5 15
N 8 2 -> obj 5 18
N 8 2 -> obj 5 7
type ABC(a : nonnull int, b : nonnull int, c : ABC);
type ABC(a : int, b : int, c : ABC);
fun main() = {
var x : ABC := new ABC(1, 2, null);
x := new ABC(3, 4, x);
var sum : int := 0;
var it : nonnull ABC := x;
var it : nonnull ABC := x;
while it != null {
print(it.a);
sum := sum + it.b;
it := it.c;
}
return sum;
}
\ No newline at end of file
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment