diff options
| author | gingerBill <bill@gingerbill.org> | 2020-05-22 14:54:30 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2020-05-22 14:54:30 +0100 |
| commit | 7bd1039a49e5fd771569cd1b5bca5b076d464a5f (patch) | |
| tree | 06382e3a2cf5bb813981faac87086d4c736b1664 /src/check_stmt.cpp | |
| parent | 76a230372f59e873b09ce333fd466b433697b936 (diff) | |
Selector Call Expressions: `x->y(123) == x.y(x, 123)`
Diffstat (limited to 'src/check_stmt.cpp')
| -rw-r--r-- | src/check_stmt.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/check_stmt.cpp b/src/check_stmt.cpp index 92155cc5e..6672ea204 100644 --- a/src/check_stmt.cpp +++ b/src/check_stmt.cpp @@ -1272,6 +1272,18 @@ void check_stmt_internal(CheckerContext *ctx, Ast *node, u32 flags) { } } return; + } else if (operand.expr->kind == Ast_SelectorCallExpr) { + AstSelectorCallExpr *se = &operand.expr->SelectorCallExpr; + ast_node(ce, CallExpr, se->call); + Type *t = type_of_expr(ce->proc); + if (is_type_proc(t)) { + if (t->Proc.require_results) { + gbString expr_str = expr_to_string(ce->proc); + error(node, "'%s' requires that its results must be handled", expr_str); + gb_string_free(expr_str); + } + } + return; } gbString expr_str = expr_to_string(operand.expr); error(node, "Expression is not used: '%s'", expr_str); |