Skip to content

Commit

Permalink
more changes
Browse files Browse the repository at this point in the history
  • Loading branch information
StunxFS committed Jan 9, 2024
1 parent 11175ac commit 32dcf24
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion lib/rivet/src/ast/mod.ri
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ pub struct ObjectData {
pub mut type: +mut Type;
pub level: VarLevel;
pub pos: token.Pos;
pub mut sym: +Var;
pub mut sym: +mut Var;
pub is_extern: bool;
pub is_global: bool;
}
Expand Down
14 changes: 7 additions & 7 deletions lib/rivet/src/checker/exprs.ri
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,7 @@ extend Checker {
indexable_pointer = opt_ptr.is_indexable;
}
mut right := unary.right.clean_paren();
if right is .Index(index) {
if right is .Index(&mut index) {
if index.left_type is .Pointer && !expected_pointer {
report.error("cannot take the address of a pointer indexing", unary.pos);
}
Expand Down Expand Up @@ -660,7 +660,7 @@ extend Checker {
if left_sym := left_type.symbol() {
match binary.op {
.Plus, .Minus, .Mul, .Div, .Mod, .Xor, .Amp, .Pipe -> {
mut promoted_type := ast.Type.Void;
mut promoted_type := +mut ast.Type.Void;
if left_sym.info.is_compound() {
if op_method := left_sym.find_method(binary.op.to_string()) {
promoted_type = op_method.ret_type;
Expand Down Expand Up @@ -770,7 +770,7 @@ extend Checker {
"cannot take the address of a boxed value", binary.var_obj.pos
);
}
ast.Type.Pointer(variant.type, binary.var_obj.is_mut)
+mut ast.Type.Pointer(variant.type, binary.var_obj.is_mut)
} else {
variant.type
};
Expand Down Expand Up @@ -872,7 +872,7 @@ extend Checker {

func check_if(+mut self, if_expr: &mut ast.Expr.If) -> +mut ast.Type {
if_expr.expected_type = self.expected_type;
for i, mut branch in if_expr.branches {
for i, &mut branch in if_expr.branches {
if !branch.is_else {
bcond_t := self.check_expr(branch.cond);
if branch.cond !is .Guard && bcond_t != self.env.bool_t {
Expand Down Expand Up @@ -930,7 +930,7 @@ extend Checker {
expr_type := self.check_expr(return_expr.expr);
self.expected_type = old_expected_type;
self.check_types(expr_type, self.cur_func.ret_type) catch |err| {
mut err_b := report.error_builder(
err_b := report.error_builder(
err.to_string(), return_expr.expr.position()
);
err_b.add_note(
Expand Down Expand Up @@ -968,7 +968,7 @@ extend Checker {
if !(expr_sym == self.env.throwable_sym
|| expr_sym.implement_trait(self.env.throwable_sym)
) {
mut err_b := report.error_builder(
err_b := report.error_builder(
"using an invalid value as an error to throw",
throw_expr.expr.position()
);
Expand All @@ -982,7 +982,7 @@ extend Checker {
err_b.emit();
}
} else {
mut err_b := report.error_builder(
err_b := report.error_builder(
"{} `{}` cannot throws errors".fmt(
self.cur_func.kind(), self.cur_func.name
), throw_expr.expr.position()
Expand Down
2 changes: 1 addition & 1 deletion lib/rivet/src/checker/match_expr.ri
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ extend Checker {

mut branch_exprs := maps.MapStringUint();
match_expr.expected_type = self.expected_type;
for ib, mut branch in match_expr.branches {
for ib, &mut branch in match_expr.branches {
if !branch.is_else {
self.expected_type = expr_type;
for i, mut pattern in branch.patterns {
Expand Down

0 comments on commit 32dcf24

Please sign in to comment.