Skip to content

Commit fdc7a89

Browse files
committed
good commit
1 parent 76bd483 commit fdc7a89

File tree

16 files changed

+37
-37
lines changed

16 files changed

+37
-37
lines changed

lib/core/src/StaticBuffer.c.ri

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import c/libc;
66

77
struct StaticBuffer {
8-
buf: [25]mut uint8;
8+
mut buf: [25]mut uint8;
99
mut len: uint;
1010

1111
pub func push(mut self, byte: uint8) {
@@ -16,22 +16,22 @@ struct StaticBuffer {
1616
self.len += 1;
1717
}
1818

19-
pub func as_uint64(&self) -> uint64 {
19+
pub func as_uint64(mut self) -> uint64 {
2020
self.buf[self.len] = 0;
2121
return unsafe { libc.strtoul(&self.buf[0], none, 10) };
2222
}
2323

24-
pub func as_uint(&self) -> uint {
24+
pub func as_uint(mut self) -> uint {
2525
self.buf[self.len] = 0;
2626
return unsafe { @as(uint, libc.strtoul(&self.buf[0], none, 10)) };
2727
}
2828

29-
pub func as_int(&self) -> int {
29+
pub func as_int(mut self) -> int {
3030
self.buf[self.len] = 0;
3131
return unsafe { @as(int, libc.strtol(&self.buf[0], none, 10))};
3232
}
3333

34-
pub func as_string(&self) -> string {
34+
pub func as_string(mut self) -> string {
3535
self.buf[self.len] = 0;
3636
return unsafe { string.from_raw_with_len(&self.buf[0], self.len).clone() };
3737
}

lib/core/src/backtrace.c.ri

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ func bt_print_callback(
6262

6363
func bt_error_handler(data: rawptr, msg_ptr: ?[&]mut uint8, errnum: int32) {
6464
unsafe {
65-
bdata := @as(&mut BacktraceData, data);
65+
mut bdata := @as(&mut BacktraceData, data);
6666
if !bdata.has_error {
6767
bdata.has_error = true;
6868
console_ewrite(" libbacktrace error: ");

lib/core/src/errors.ri

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ struct CallTrace {
3333
const RETURN_TRACE_MAX_SIZE := 50;
3434

3535
struct ReturnTrace {
36-
traces: [RETURN_TRACE_MAX_SIZE]mut CallTrace;
36+
mut traces: [RETURN_TRACE_MAX_SIZE]mut CallTrace;
3737
mut cur_idx: uint;
3838

3939
#[inline]

lib/core/src/rune.ri

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ extend rune < Stringable {
5050

5151
pub func as_bytes(self) -> []uint8 {
5252
res := []uint8(cap: 5);
53-
res_v := @as(DynArray, res);
53+
mut res_v := @as(DynArray, res);
5454
res_v.len = utf32_decode_to_buffer(self, unsafe { @as([&]mut uint8, res_v.ptr) });
5555
return res;
5656
}

lib/rivet/src/ast/CHeader.ri

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ extend Table {
119119
"{} -x c -E -dM /dev/null".fmt(self.prefs.target_backend_compiler)
120120
) {
121121
defines_ := result.output.split_into_lines();
122-
defines := CDefines();
122+
mut defines := CDefines();
123123
for define in defines_ {
124124
mut tokens := define.tokenize(b' ');
125125
_ = tokens.next(); // skip '#define'

lib/rivet/src/ast/Scope.ri

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ pub struct Scope {
2727
}
2828

2929
pub func add_or_get(mut self, sym: Sym) -> !Sym {
30-
if old_sym := self.find(sym.name) {
30+
if mut old_sym := self.find(sym.name) {
3131
if sym is TypeSym(type_sym) && old_sym is TypeSym(mut old_type_sym) {
3232
if old_type_sym.update(type_sym)! {
3333
return old_sym;
@@ -116,24 +116,24 @@ pub struct Scope {
116116
}
117117

118118
pub func update_type(self, name: string, type: Type) {
119-
if sym := self.lookup(name) {
120-
if sym is Var(var_info) {
119+
if mut sym := self.lookup(name) {
120+
if sym is Var(mut var_info) {
121121
var_info.type = type;
122122
}
123123
}
124124
}
125125

126126
pub func update_is_hidden_ref(self, name: string, is_hidden_ref: bool) {
127-
if sym := self.lookup(name) {
128-
if sym is Var(var_info) {
127+
if mut sym := self.lookup(name) {
128+
if sym is Var(mut var_info) {
129129
var_info.is_hidden_ref = is_hidden_ref;
130130
}
131131
}
132132
}
133133

134134
pub func update_is_used(self, name: string, is_used: bool) {
135-
if sym := self.lookup(name) {
136-
if sym is Var(var_info) {
135+
if mut sym := self.lookup(name) {
136+
if sym is Var(mut var_info) {
137137
var_info.is_used = is_used;
138138
}
139139
}

lib/rivet/src/ast/Sym.ri

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ pub struct Module < Sym {
179179
if type_sym := self.scope.find(unique_name) {
180180
return @as(TypeSym, type_sym);
181181
}
182-
type_sym := TypeSym(
182+
mut type_sym := TypeSym(
183183
is_public: true,
184184
name: unique_name,
185185
info: .DynArray(elem_type, is_mut),

lib/rivet/src/ast/Type.ri

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -113,22 +113,22 @@ pub enum Type < traits.Stringable {
113113
// unaliasing instead.
114114
return match self {
115115
.Rawptr -> self,
116-
.Result(result) -> .Result(result.inner.unalias() ?? result.inner),
117-
.Option(option) -> .Option(option.inner.unalias() ?? option.inner),
116+
.Result(mut result) -> .Result(result.inner.unalias() ?? result.inner),
117+
.Option(mut option) -> .Option(option.inner.unalias() ?? option.inner),
118118
.Tuple(tuple_data) -> {
119-
unaliased_types := []mut Type(cap: tuple_data.inners.len);
120-
for i, tuple_type in tuple_data.inners {
119+
mut unaliased_types := []mut Type(cap: tuple_data.inners.len);
120+
for i, mut tuple_type in tuple_data.inners {
121121
unaliased_types[i] = tuple_type.unalias() ?? tuple_type;
122122
}
123123
.Tuple(unaliased_types, tuple_data.sym)
124124
},
125-
.DynArray(dyn_array_data) -> .DynArray(
125+
.DynArray(mut dyn_array_data) -> .DynArray(
126126
dyn_array_data.inner.unalias() ?? dyn_array_data.inner, dyn_array_data.is_mut
127127
),
128-
.Array(array_data) -> .Array(
128+
.Array(mut array_data) -> .Array(
129129
array_data.inner.unalias() ?? array_data.inner, ...self
130130
),
131-
.Pointer(pointer_data) -> .Pointer(
131+
.Pointer(mut pointer_data) -> .Pointer(
132132
pointer_data.inner.unalias() ?? pointer_data.inner, ...self
133133
),
134134
.Func(mut func_data) -> {
@@ -140,7 +140,7 @@ pub enum Type < traits.Stringable {
140140
...self
141141
)
142142
},
143-
.Basic(basic) if !basic.is_unresolved -> if basic.sym?.info is .Alias(alias_info) {
143+
.Basic(mut basic) if !basic.is_unresolved -> if basic.sym?.info is .Alias(mut alias_info) {
144144
alias_info.parent.unalias() ?? alias_info.parent
145145
} else {
146146
.Basic(basic.sym)

lib/rivet/src/ast/TypeInfo.ri

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ pub enum TypeInfo < traits.Stringable {
5959
func implement(mut self, type_sym: TypeSym) {
6060
if type_sym !in self.implements {
6161
self.implements.push(type_sym);
62-
for b in self.bases {
62+
for mut b in self.bases {
6363
@as(TypeInfo.Trait, b.info).implement(type_sym);
6464
}
6565
}

lib/rivet/src/checker/call_expr.ri

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ extend Checker {
2020
};
2121

2222
match left {
23-
.SelfTy(self_ty) -> self.check_ctor_call(self_ty.sym, call_expr),
24-
.Ident(ident) if (ident.is_sym || ident.is_obj) -> match ident.sym is {
23+
.SelfTy(mut self_ty) -> self.check_ctor_call(self_ty.sym, call_expr),
24+
.Ident(mut ident) if (ident.is_sym || ident.is_obj) -> match ident.sym is {
2525
ast.TypeSym(mut type_sym) if type_sym.info is .Trait
2626
|| type_sym.info is .Struct || type_sym.info is .String
2727
|| type_sym.info is .Enum -> self.check_ctor_call(type_sym, call_expr),
@@ -255,7 +255,7 @@ extend Checker {
255255
"cannot use spread expression with trait constructor", call_expr.pos
256256
);
257257
} else if call_expr.args.len == 1 {
258-
arg0 := call_expr.args[0];
258+
mut arg0 := call_expr.args[0];
259259
value_t := self.table.comptime_number_to_type(self.check_expr(arg0.expr));
260260
if value_t.symbol()? in trait_info.implements {
261261
trait_info.mark_has_objects();
@@ -292,7 +292,7 @@ extend Checker {
292292
return;
293293
}
294294
}
295-
for i, arg in call_expr.args {
295+
for i, mut arg in call_expr.args {
296296
mut field := ast.Field();
297297
if arg.is_named {
298298
if t_field := type_sym.lookup_field(arg.name) {

lib/rivet/src/checker/types.ri

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ extend Checker {
2020
self, got: ast.Type, expected: ast.Type, pos: token.Pos, arg_name: string,
2121
func_kind: string, func_name: string
2222
) {
23-
if expected_sym := expected.symbol(); expected_sym.info is .Trait(mut trait_info)
23+
if mut expected_sym := expected.symbol(); expected_sym.info is .Trait(mut trait_info)
2424
&& expected != got {
2525
got_t := self.table.comptime_number_to_type(got);
2626
if got_t.symbol()? in trait_info.implements {
@@ -114,7 +114,7 @@ extend Checker {
114114
return false;
115115
}
116116

117-
expected_sym := expected.symbol() ?? return false;
117+
mut expected_sym := expected.symbol() ?? return false;
118118
got_sym := got.symbol() ?? return false;
119119

120120
if expected is .Variadic {

lib/rivet/src/codegen/mir/mod.ri

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ pub struct Var {
208208
pub mut is_moved: bool;
209209
pub mut is_dropped: bool;
210210
pub mut is_initialized: bool;
211-
pub fields: []Var;
211+
pub fields: []mut Var;
212212

213213
pub func set_field(self, name: string, value: Expr) {
214214
for mut field in self.fields {

lib/rivet/src/utils/maps/mod.ri

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ pub struct MapStringUint {
1515
mut pairs: []mut StringUint;
1616

1717
pub func set(mut self, key: string, value: uint) {
18-
for pair in self.pairs {
18+
for mut pair in self.pairs {
1919
if pair.key == key {
2020
pair.value = value;
2121
return; // found

lib/std/src/semver/parse.ri

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ var versions := [VER_MAJOR, VER_MINOR, VER_PATCH];
1010
struct RawVersion {
1111
prerelease: string;
1212
metadata: string;
13-
raw_ints: []mut string;
13+
mut raw_ints: []mut string;
1414

1515
// TODO: Rewrite using regex:
1616
// /(\d+)\.(\d+)\.(\d+)(?:\-([0-9A-Za-z-.]+))?(?:\+([0-9A-Za-z-]+))?/

lib/std/src/semver/range.ri

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ struct Range {
128128
}
129129

130130
func parse_x(input: string) -> ?Version {
131-
raw_ver := RawVersion.parse(input).complete();
131+
mut raw_ver := RawVersion.parse(input).complete();
132132
for typ in versions {
133133
if raw_ver.raw_ints[typ].index_of_any(xRangeSymbols) == none {
134134
continue;

lib/std/src/strings/mod.ri

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ pub alias Builder := core.StringBuilder;
99
/// Uses levenshtein distance algorithm to calculate the distance between
1010
/// two strings (lower is closer).
1111
pub func levenshtein_distance(a: string, b: string) -> int32 {
12-
f := []mut int32(init: 0, len: b.len + 1);
12+
mut f := []mut int32(init: 0, len: b.len + 1);
1313
for ca in a.as_bytes() {
1414
mut j: uint := 1;
1515
mut fj1 := f[0];

0 commit comments

Comments
 (0)