diff options
| author | gingerBill <bill@gingerbill.org> | 2019-07-15 21:18:37 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2019-07-15 21:18:37 +0100 |
| commit | f25818e9230b77bbe3a3422c75d1544c9b417fcf (patch) | |
| tree | 41af5cb07e0a83d8385d456f8cbeca4fb08e01fd /src/check_stmt.cpp | |
| parent | 3d531be71176cd0b9191119bf373e3a52c3dde91 (diff) | |
Make procedure parameters just named values rather than copied variables
Diffstat (limited to 'src/check_stmt.cpp')
| -rw-r--r-- | src/check_stmt.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/check_stmt.cpp b/src/check_stmt.cpp index 24f540930..e2090688f 100644 --- a/src/check_stmt.cpp +++ b/src/check_stmt.cpp @@ -303,9 +303,13 @@ Type *check_assignment_variable(CheckerContext *ctx, Operand *lhs, Operand *rhs) } } + Entity *e = entity_of_ident(lhs->expr); + gbString str = expr_to_string(lhs->expr); if (lhs->mode == Addressing_Immutable) { error(lhs->expr, "Cannot assign to an immutable: '%s'", str); + } else if (e != nullptr && e->flags & EntityFlag_Param) { + error(lhs->expr, "Cannot assign to '%s' which is a procedure parameter", str); } else { error(lhs->expr, "Cannot assign to '%s'", str); } |