mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 15:48:51 +00:00
Fix procedure calls from non-regular addressing modes
This commit is contained in:
@@ -110,6 +110,9 @@ close :: proc(fd: Handle) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
write :: proc(fd: Handle, data: []byte) -> (int, Errno) {
|
write :: proc(fd: Handle, data: []byte) -> (int, Errno) {
|
||||||
|
if len(data) == 0 {
|
||||||
|
return 0, ERROR_NONE;
|
||||||
|
}
|
||||||
bytes_written: i32;
|
bytes_written: i32;
|
||||||
e := win32.WriteFile(cast(win32.Handle)fd, ^data[0], cast(i32)len(data), ^bytes_written, nil);
|
e := win32.WriteFile(cast(win32.Handle)fd, ^data[0], cast(i32)len(data), ^bytes_written, nil);
|
||||||
if e == win32.FALSE {
|
if e == win32.FALSE {
|
||||||
@@ -120,6 +123,9 @@ write :: proc(fd: Handle, data: []byte) -> (int, Errno) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
read :: proc(fd: Handle, data: []byte) -> (int, Errno) {
|
read :: proc(fd: Handle, data: []byte) -> (int, Errno) {
|
||||||
|
if len(data) == 0 {
|
||||||
|
return 0, ERROR_NONE;
|
||||||
|
}
|
||||||
bytes_read: i32;
|
bytes_read: i32;
|
||||||
e := win32.ReadFile(cast(win32.Handle)fd, ^data[0], cast(u32)len(data), ^bytes_read, nil);
|
e := win32.ReadFile(cast(win32.Handle)fd, ^data[0], cast(u32)len(data), ^bytes_read, nil);
|
||||||
if e == win32.FALSE {
|
if e == win32.FALSE {
|
||||||
|
|||||||
+4
-2
@@ -4764,11 +4764,13 @@ ExprKind check_call_expr(Checker *c, Operand *operand, AstNode *call) {
|
|||||||
Type *proc_type = base_type(operand->type);
|
Type *proc_type = base_type(operand->type);
|
||||||
if (operand->mode != Addressing_Overload) {
|
if (operand->mode != Addressing_Overload) {
|
||||||
bool valid_type = (proc_type != NULL) && is_type_proc(proc_type);
|
bool valid_type = (proc_type != NULL) && is_type_proc(proc_type);
|
||||||
bool valid_mode = (operand->mode == Addressing_Value) || (operand->mode == Addressing_Variable);
|
bool valid_mode = is_operand_value(*operand);
|
||||||
if (!valid_type || !valid_mode) {
|
if (!valid_type || !valid_mode) {
|
||||||
AstNode *e = operand->expr;
|
AstNode *e = operand->expr;
|
||||||
gbString str = expr_to_string(e);
|
gbString str = expr_to_string(e);
|
||||||
error_node(e, "Cannot call a non-procedure: `%s` %d", str, operand->mode);
|
gbString type_str = type_to_string(operand->type);
|
||||||
|
error_node(e, "Cannot call a non-procedure: `%s` of type `%s`", str, type_str);
|
||||||
|
gb_string_free(type_str);
|
||||||
gb_string_free(str);
|
gb_string_free(str);
|
||||||
|
|
||||||
operand->mode = Addressing_Invalid;
|
operand->mode = Addressing_Invalid;
|
||||||
|
|||||||
Reference in New Issue
Block a user