Nullable pointer and loop inlining tests. #22
|
@ -1042,16 +1042,32 @@ main := fn(): uint {
|
|||
}
|
||||
```
|
||||
|
||||
#### inlining_loops
|
||||
```hb
|
||||
x := 1
|
||||
|
||||
foo := fn(): int {
|
||||
loop if true break
|
||||
x = 0
|
||||
}
|
||||
|
||||
main := fn(): int {
|
||||
@inline(foo)
|
||||
return x
|
||||
}
|
||||
```
|
||||
|
||||
#### null_check_test
|
||||
```hb
|
||||
main := fn(): unit {
|
||||
main := fn(): uint {
|
||||
ptr := @as(?^uint, null)
|
||||
*ptr = 0
|
||||
value := 0
|
||||
ptr = &value
|
||||
|
||||
if ptr == null {
|
||||
return 1
|
||||
}
|
||||
|
||||
|
||||
return *ptr
|
||||
}
|
||||
```
|
||||
|
|
0
lang/tests/son_tests_null_check_test.txt
Normal file
0
lang/tests/son_tests_null_check_test.txt
Normal file
Loading…
Reference in a new issue