mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 15:48:51 +00:00
Merge remote-tracking branch 'offical/master'
This commit is contained in:
+2
-2
@@ -572,7 +572,7 @@ gb_internal Type *check_assignment_variable(CheckerContext *ctx, Operand *lhs, O
|
|||||||
error(lhs->expr, "Cannot assign to '%s'", str);
|
error(lhs->expr, "Cannot assign to '%s'", str);
|
||||||
|
|
||||||
if (e && e->flags & EntityFlag_ForValue) {
|
if (e && e->flags & EntityFlag_ForValue) {
|
||||||
isize offset = show_error_on_line(e->token.pos, token_pos_end(e->token), "Suggestion:");
|
isize offset = show_error_on_line(e->token.pos, token_pos_end(e->token));
|
||||||
if (offset < 0) {
|
if (offset < 0) {
|
||||||
if (is_type_map(e->type)) {
|
if (is_type_map(e->type)) {
|
||||||
error_line("\tSuggestion: Did you mean? 'for key, &%.*s in ...'\n", LIT(e->token.string));
|
error_line("\tSuggestion: Did you mean? 'for key, &%.*s in ...'\n", LIT(e->token.string));
|
||||||
@@ -588,7 +588,7 @@ gb_internal Type *check_assignment_variable(CheckerContext *ctx, Operand *lhs, O
|
|||||||
}
|
}
|
||||||
|
|
||||||
} else if (e && e->flags & EntityFlag_SwitchValue) {
|
} else if (e && e->flags & EntityFlag_SwitchValue) {
|
||||||
isize offset = show_error_on_line(e->token.pos, token_pos_end(e->token), "Suggestion:");
|
isize offset = show_error_on_line(e->token.pos, token_pos_end(e->token));
|
||||||
if (offset < 0) {
|
if (offset < 0) {
|
||||||
error_line("\tSuggestion: Did you mean? 'switch &%.*s in ...'\n", LIT(e->token.string));
|
error_line("\tSuggestion: Did you mean? 'switch &%.*s in ...'\n", LIT(e->token.string));
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
+2
-6
@@ -266,7 +266,7 @@ gb_internal void terminal_reset_colours(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
gb_internal isize show_error_on_line(TokenPos const &pos, TokenPos end, char const *prefix=nullptr) {
|
gb_internal isize show_error_on_line(TokenPos const &pos, TokenPos end) {
|
||||||
get_error_value()->end = end;
|
get_error_value()->end = end;
|
||||||
if (!show_error_line()) {
|
if (!show_error_line()) {
|
||||||
return -1;
|
return -1;
|
||||||
@@ -289,17 +289,13 @@ gb_internal isize show_error_on_line(TokenPos const &pos, TokenPos end, char con
|
|||||||
MAX_LINE_LENGTH_PADDED = MAX_LINE_LENGTH-MAX_TAB_WIDTH-ELLIPSIS_PADDING,
|
MAX_LINE_LENGTH_PADDED = MAX_LINE_LENGTH-MAX_TAB_WIDTH-ELLIPSIS_PADDING,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (prefix) {
|
i32 error_length = gb_max(end.offset - pos.offset, 1);
|
||||||
error_out("\t%s\n\n", prefix);
|
|
||||||
}
|
|
||||||
|
|
||||||
error_out("\t");
|
error_out("\t");
|
||||||
|
|
||||||
terminal_set_colours(TerminalStyle_Bold, TerminalColour_White);
|
terminal_set_colours(TerminalStyle_Bold, TerminalColour_White);
|
||||||
|
|
||||||
|
|
||||||
i32 error_length = gb_max(end.offset - pos.offset, 1);
|
|
||||||
|
|
||||||
isize squiggle_extra = 0;
|
isize squiggle_extra = 0;
|
||||||
|
|
||||||
if (line_len > MAX_LINE_LENGTH_PADDED) {
|
if (line_len > MAX_LINE_LENGTH_PADDED) {
|
||||||
|
|||||||
Reference in New Issue
Block a user