diff options
| author | gingerBill <bill@gingerbill.org> | 2020-02-23 10:39:57 +0000 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2020-02-23 10:39:57 +0000 |
| commit | e197af766d5ead2a1a67ead4c780848c6749a5b1 (patch) | |
| tree | a874c73d31366c8fdcccd7546e4294d5df51a6d6 /src/check_stmt.cpp | |
| parent | 2180f4a475287546b9230745343ca3e0847525c6 (diff) | |
| parent | 10fe5e97b3eea5409660220a903bc6ad09478c1b (diff) | |
Merge branch 'master' into llvm-integration
Diffstat (limited to 'src/check_stmt.cpp')
| -rw-r--r-- | src/check_stmt.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/check_stmt.cpp b/src/check_stmt.cpp index c365dca84..bef1919e4 100644 --- a/src/check_stmt.cpp +++ b/src/check_stmt.cpp @@ -314,7 +314,11 @@ Type *check_assignment_variable(CheckerContext *ctx, Operand *lhs, Operand *rhs) gbString str = expr_to_string(lhs->expr); if (e != nullptr && e->flags & EntityFlag_Param) { - error(lhs->expr, "Cannot assign to '%s' which is a procedure parameter", str); + if (e->flags & EntityFlag_Using) { + error(lhs->expr, "Cannot assign to '%s' which is from a 'using' procedure parameter", str); + } else { + error(lhs->expr, "Cannot assign to '%s' which is a procedure parameter", str); + } } else { error(lhs->expr, "Cannot assign to '%s'", str); } @@ -497,6 +501,8 @@ bool check_using_stmt_entity(CheckerContext *ctx, AstUsingStmt *us, Ast *expr, b Entity *f = found->elements.entries[i].value; if (f->kind == Entity_Variable) { Entity *uvar = alloc_entity_using_variable(e, f->token, f->type, expr); + if (e->flags & EntityFlag_Value) uvar->flags |= EntityFlag_Value; + if (e->flags & EntityFlag_Param) uvar->flags |= EntityFlag_Param; Entity *prev = scope_insert(ctx->scope, uvar); if (prev != nullptr) { gbString expr_str = expr_to_string(expr); |