Skip to content

Commit

Permalink
fix unary expr with index expr
Browse files Browse the repository at this point in the history
  • Loading branch information
StunxFS committed Jan 26, 2024
1 parent 08e954c commit 64df03b
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 9 deletions.
1 change: 1 addition & 0 deletions lib/core/src/StringFormatter.ri
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ pub struct StringFormatter {
runtime_error("string.fmt: incomplete format string (index: {})", start);
}
}
console_writeln("{}", buf.as_string());
fwidth := buf.as_int();
if fwidth == 0 {
runtime_error(
Expand Down
10 changes: 4 additions & 6 deletions lib/core/src/backtrace.c.ri
Original file line number Diff line number Diff line change
Expand Up @@ -40,22 +40,20 @@ $if !_RELEASE_ { // skip backtrace in release mode
fn_ptr: ?[&]mut uint8
) -> int32 {
unsafe {
if safe_fn_ptr := fn_ptr {
fn_name := if safe_fn_ptr := fn_ptr {
if mem.cmp(safe_fn_ptr, c"_R4core4mainF", 13) == 0 {
return -1; // stop backtracing
}
}
fn_name := if fn_ptr == none {
"???"
demangle_symbol(string.from_raw(safe_fn_ptr))
} else {
demangle_symbol(string.from_raw(fn_ptr))
"???"
};
file_name := if filename_ptr == none {
"???"
} else {
string.from_raw(filename_ptr)
};
console_ewriteln(" from {} in \"{}\":{}", fn_name, file_name, lineno);
console_ewriteln(" from {} in {}:{}", fn_name, file_name, lineno);
}
return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/core/src/errors.ri
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ struct ReturnTrace {
while i < self.cur_idx : i += 1 {
trace := self.traces[i];
console_ewriteln(
" from {} in \"{}\":{}", demangle_symbol(trace.name),
" from {} in {}:{}", demangle_symbol(trace.name),
trace.file, trace.line
);
}
Expand Down
2 changes: 1 addition & 1 deletion rivetc/src/checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -645,7 +645,7 @@ def check_expr(self, expr):
expected_pointer = False
indexable_pointer = False
right = expr.right
if isinstance(right, ast.ParExpr):
while isinstance(right, ast.ParExpr):
right = right.expr
if isinstance(right, ast.IndexExpr):
if isinstance(
Expand Down
2 changes: 1 addition & 1 deletion rivetc/src/codegen/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1715,7 +1715,7 @@ def gen_expr(self, expr, custom_tmp = None):
res = self.boxed_instance(self.ir_type(expr.right_typ), size)
self.cur_func.store_ptr(res, right)
return res
right = self.gen_expr_with_cast(expr.right_typ, expr.right)
right = self.gen_expr(expr.right)
expr_typ = self.ir_type(expr.typ)
if expr.op == Kind.Amp:
if isinstance(right.typ, ir.Ptr
Expand Down

0 comments on commit 64df03b

Please sign in to comment.