no :: in func decls
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
|
||||
# The return value is captured before defers run, so the mutation here does not
|
||||
# change what is returned (Zig semantics).
|
||||
spill_check :: func() i32 {
|
||||
spill_check func() i32 {
|
||||
x i32 = 5
|
||||
defer x = 999
|
||||
return x
|
||||
@@ -14,7 +14,7 @@ spill_check :: func() i32 {
|
||||
|
||||
# A function-scope defer runs only at function exit; a `break` runs the loop-body
|
||||
# defer but NOT the enclosing function-scope defer.
|
||||
enclosing_defer_check :: func() i32 {
|
||||
enclosing_defer_check func() i32 {
|
||||
v i32 = 0
|
||||
defer v = v + 100
|
||||
for 0..3 |i| {
|
||||
@@ -24,7 +24,7 @@ enclosing_defer_check :: func() i32 {
|
||||
return v # 0->1 (i=0 fall-through), ->2 (i=1 break); the +100 runs after capture
|
||||
}
|
||||
|
||||
main :: func() i32 {
|
||||
main func() i32 {
|
||||
# 1. return value captured before defers run.
|
||||
if (spill_check() != 5) return 101
|
||||
|
||||
|
||||
Reference in New Issue
Block a user