Skip to content

Commit 2749618

Browse files
committed
more changes
1 parent cae036c commit 2749618

File tree

3 files changed

+26
-27
lines changed

3 files changed

+26
-27
lines changed

lib/rivet/src/ast/Env.ri

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,20 @@ import ../{ prefs, report, utils };
88

99
#[boxed]
1010
pub struct Env {
11-
pub mut prefs: prefs.Prefs;
12-
pub mut source_files: []mut +SourceFile;
11+
pub prefs: +mut prefs.Prefs;
12+
pub mut source_files: []+mut SourceFile;
1313

1414
pub pointer_size: uint;
1515

1616
/// `.universe` is the mega-module where all the modules being
1717
/// compiled reside.
18-
pub mut universe: +Module;
18+
pub universe: +mut Module;
1919

2020
pub mut c_defines: CDefines;
2121
pub mut c_include_paths: []string;
2222
pub mut c_user_include_paths: []string;
2323

24-
pub mut core_mod: +Module;
24+
pub core_mod: +mut Module;
2525
pub mut throwable_sym_is_set: bool;
2626

2727
pub mut builtins: []Builtin;
@@ -68,10 +68,10 @@ pub struct Env {
6868
pub mut throwable_t: +Type;
6969

7070
#[inline]
71-
pub func new(prefs_: prefs.Prefs) -> +Env {
71+
pub func new(prefs_: +mut prefs.Prefs) -> +mut Self {
7272
report.report_table.prefs = prefs_;
7373
universe_ := universe();
74-
mut env := Env(
74+
env := +mut Env(
7575
prefs: prefs_,
7676
universe: universe_,
7777
pointer_size: if prefs_.target_is_64bit {
@@ -85,7 +85,7 @@ pub struct Env {
8585
return env;
8686
}
8787

88-
pub func setup_primitives(mut self) {
88+
pub func setup_primitives(+mut self) {
8989
self.bool_sym = self.universe.scope.find_type_symbol_by_index_or_panic(0);
9090
self.rune_sym = self.universe.scope.find_type_symbol_by_index_or_panic(1);
9191
self.int8_sym = self.universe.scope.find_type_symbol_by_index_or_panic(2);
@@ -123,7 +123,7 @@ pub struct Env {
123123
self.string_t = .Basic(self.string_sym);
124124
}
125125

126-
pub func filter_files(self, inputs: []string) -> []string {
126+
pub func filter_files(+self, inputs: []string) -> []string {
127127
mut new_inputs := []string(cap: inputs.len);
128128
for input in inputs {
129129
base_name_input := Path.base_name(input);

lib/rivet/src/ast/Expr.ri

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -297,15 +297,15 @@ pub enum Expr < traits.Stringable {
297297
};
298298

299299
#[inline]
300-
pub func clean_paren(self) -> Self {
300+
pub func clean_paren(+self) -> +Self {
301301
return if self is .Paren(paren) {
302302
paren.clean_paren()
303303
} else {
304304
self
305305
};
306306
}
307307

308-
pub func position(self) -> token.Pos {
308+
pub func position(+self) -> token.Pos {
309309
return match self {
310310
.Empty(empty_pos) -> empty_pos,
311311
.Comment(comment) -> comment.pos,
@@ -345,8 +345,7 @@ pub enum Expr < traits.Stringable {
345345
};
346346
}
347347

348-
#[inline]
349-
pub func to_string(self) -> string {
348+
pub func to_string(+self) -> string {
350349
return match self {
351350
.Empty -> "<empty-expression>",
352351
.Comment -> "<comment>",

lib/rivet/src/ast/TypeSym.ri

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ pub struct TypeSym < Sym {
2121
pub mut align: uint;
2222
pub mut default_value: ?+Expr;
2323

24-
pub func lookup_field(self, name: string) -> ?Field {
24+
pub func lookup_field(+self, name: string) -> ?Field {
2525
for f in self.fields {
2626
if f.name == name {
2727
return f;
@@ -49,20 +49,20 @@ pub struct TypeSym < Sym {
4949
}
5050

5151
#[inline]
52-
pub func has_field(self, name: string) -> bool {
52+
pub func has_field(+self, name: string) -> bool {
5353
return self.lookup_field(name) != none;
5454
}
5555

5656
#[inline]
57-
pub func lookup(self, name: string) -> ?Sym {
57+
pub func lookup(+self, name: string) -> ?Sym {
5858
return if s := self.scope.lookup(name) {
5959
s
6060
} else {
6161
none
6262
};
6363
}
6464

65-
pub func find_in_base(self, name: string) -> ?Sym {
65+
pub func find_in_base(+self, name: string) -> ?Sym {
6666
if self.info is .Trait(trait_info) {
6767
for b in trait_info.bases {
6868
if s := b.scope.find(name) {
@@ -91,7 +91,7 @@ pub struct TypeSym < Sym {
9191
}
9292

9393
#[inline]
94-
pub func find_func(self, name: string) -> ?+Func {
94+
pub func find_func(+self, name: string) -> ?+Func {
9595
return if sym := self.scope.find(name); sym is Func(func_) {
9696
if self.info !is .Trait && !func_.has_body {
9797
return none;
@@ -108,7 +108,7 @@ pub struct TypeSym < Sym {
108108
}
109109

110110
#[inline]
111-
pub func find_method(self, name: string) -> ?+Func {
111+
pub func find_method(+self, name: string) -> ?+Func {
112112
return if func_ := self.find_func(name); func_.is_method {
113113
func_
114114
} else {
@@ -117,16 +117,16 @@ pub struct TypeSym < Sym {
117117
}
118118

119119
#[inline]
120-
pub func has_func(self, name: string) -> bool {
120+
pub func has_func(+self, name: string) -> bool {
121121
return self.find_func(name) != none;
122122
}
123123

124124
#[inline]
125-
pub func has_method(self, name: string) -> bool {
125+
pub func has_method(+self, name: string) -> bool {
126126
return self.find_method(name) != none;
127127
}
128128

129-
pub func full_fields(mut self) -> []Field {
129+
pub func full_fields(+mut self) -> []Field {
130130
if !self.full_fields_.is_empty() {
131131
return self.full_fields_;
132132
}
@@ -157,15 +157,15 @@ pub struct TypeSym < Sym {
157157
}
158158

159159
#[inline]
160-
pub func implement_trait(self, trait_sym: +TypeSym) -> bool {
160+
pub func implement_trait(+self, trait_sym: +TypeSym) -> bool {
161161
return if trait_sym.info is .Trait(trait_info) {
162162
self in trait_info.implements
163163
} else {
164164
false
165165
};
166166
}
167167

168-
pub func update(mut self, other: +TypeSym) -> !bool {
168+
pub func update(+mut self, other: +TypeSym) -> !bool {
169169
if self.info is .Placeholder {
170170
// update placeholder
171171
if other.info !is .Placeholder {
@@ -182,7 +182,7 @@ pub struct TypeSym < Sym {
182182
}
183183

184184
#[inline]
185-
pub func is_boxed(self) -> bool {
185+
pub func is_boxed(+self) -> bool {
186186
return match self.info {
187187
.Trait -> true,
188188
.Struct(struct_info) -> struct_info.is_boxed,
@@ -192,17 +192,17 @@ pub struct TypeSym < Sym {
192192
}
193193

194194
#[inline]
195-
pub func is_primitive(self) -> bool {
195+
pub func is_primitive(+self) -> bool {
196196
return self.info.is_primitive();
197197
}
198198

199199
#[inline]
200-
pub func ==(self, rhs: Self) -> bool {
200+
pub func ==(+self, rhs: +Self) -> bool {
201201
return self.id == rhs.id;
202202
}
203203

204204
#[inline]
205-
pub func !=(self, rhs: Self) -> bool {
205+
pub func !=(+self, rhs: +Self) -> bool {
206206
return self.id != rhs.id;
207207
}
208208
}

0 commit comments

Comments
 (0)