mutable decl syntax change
This commit is contained in:
@@ -32,8 +32,8 @@ make_point func() Point {
|
||||
}
|
||||
|
||||
sum_loop func(limit i32) i32 {
|
||||
total i32 = 0
|
||||
i i32 = 0
|
||||
total i32 := 0
|
||||
i i32 := 0
|
||||
while i < limit {
|
||||
i += 1
|
||||
if i == 2 {
|
||||
@@ -45,8 +45,8 @@ sum_loop func(limit i32) i32 {
|
||||
}
|
||||
|
||||
sum_for func() i32 {
|
||||
total i32 = 0
|
||||
values [_]i32 = [1, 2, 3]
|
||||
total i32 := 0
|
||||
values [_]i32 := [1, 2, 3]
|
||||
for values |value, index| {
|
||||
total += value + index
|
||||
}
|
||||
@@ -54,7 +54,7 @@ sum_for func() i32 {
|
||||
}
|
||||
|
||||
defer_value func() i32 {
|
||||
value i32 = 1
|
||||
value i32 := 1
|
||||
{
|
||||
defer value += 10
|
||||
value += 1
|
||||
@@ -140,7 +140,7 @@ use_try func() i32 ! Error {
|
||||
}
|
||||
|
||||
ct_errdefer func(fail bool) i32 ! Error {
|
||||
trace i32 = 0
|
||||
trace i32 := 0
|
||||
defer trace = trace * 10 + 1
|
||||
errdefer |err| {
|
||||
if (err == .bad) trace = trace * 10 + 2
|
||||
@@ -151,7 +151,7 @@ ct_errdefer func(fail bool) i32 ! Error {
|
||||
}
|
||||
|
||||
ct_try_errdefer func() i32 ! Error {
|
||||
trace i32 = 0
|
||||
trace i32 := 0
|
||||
defer trace = trace * 10 + 4
|
||||
errdefer |err| {
|
||||
if (err == .bad) trace = trace * 10 + 5
|
||||
@@ -185,20 +185,20 @@ alias_add func(left @mut i32, right @mut i32) void {
|
||||
}
|
||||
|
||||
storage_mutation func() i32 {
|
||||
values [3]mut i32 = [1, 2, 3]
|
||||
values [3]mut i32 := [1, 2, 3]
|
||||
values[0] += 1
|
||||
bump_ptr(&values[1])
|
||||
|
||||
view []mut i32 = values[..]
|
||||
view []mut i32 := values[..]
|
||||
for view |@item| {
|
||||
item^ += 1
|
||||
}
|
||||
|
||||
pointer *mut i32 = view.ptr
|
||||
pointer *mut i32 := view.ptr
|
||||
pointer[2] += 1
|
||||
alias_add(&values[0], &view[0])
|
||||
|
||||
box Box = Box { point = Point { x = 2, y = 3 } }
|
||||
box Box := Box { point = Point { x = 2, y = 3 } }
|
||||
match box {
|
||||
.point |@p|: p.x += values[1]
|
||||
.empty: values[0] = values[0]
|
||||
|
||||
Reference in New Issue
Block a user