aboutsummaryrefslogtreecommitdiff
path: root/src/check_type.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2021-05-13 00:44:33 +0100
committergingerBill <bill@gingerbill.org>2021-05-13 00:44:33 +0100
commit2e5f57d8a18352c02da72f2f2385116a099d7942 (patch)
treec57d5a0ed0ece70c41f1e0af231bc53c96da6eef /src/check_type.cpp
parentd5c3f996550b75f0da383bfcf7b30dba482cf081 (diff)
Fix #741
Diffstat (limited to 'src/check_type.cpp')
-rw-r--r--src/check_type.cpp25
1 files changed, 11 insertions, 14 deletions
diff --git a/src/check_type.cpp b/src/check_type.cpp
index e433faf7f..ef0e20948 100644
--- a/src/check_type.cpp
+++ b/src/check_type.cpp
@@ -1207,6 +1207,11 @@ ParameterValue handle_parameter_value(CheckerContext *ctx, Type *in_type, Type *
init_core_source_code_location(ctx->checker);
param_value.kind = ParameterValue_Location;
o.type = t_source_code_location;
+
+ if (in_type) {
+ check_assignment(ctx, &o, in_type, str_lit("parameter value"));
+ }
+
} else {
if (in_type) {
check_expr_with_type_hint(ctx, &o, expr, in_type);
@@ -1214,6 +1219,11 @@ ParameterValue handle_parameter_value(CheckerContext *ctx, Type *in_type, Type *
check_expr(ctx, &o, expr);
}
+ if (in_type) {
+ check_assignment(ctx, &o, in_type, str_lit("parameter value"));
+ }
+
+
if (is_operand_nil(o)) {
param_value.kind = ParameterValue_Nil;
} else if (o.mode != Addressing_Constant) {
@@ -1221,16 +1231,7 @@ ParameterValue handle_parameter_value(CheckerContext *ctx, Type *in_type, Type *
param_value.kind = ParameterValue_Constant;
param_value.value = exact_value_procedure(expr);
} else {
- Entity *e = nullptr;
- // if (o.mode == Addressing_Value && is_type_proc(o.type)) {
- if (o.mode == Addressing_Value || o.mode == Addressing_Variable) {
- Operand x = {};
- if (expr->kind == Ast_Ident) {
- e = check_ident(ctx, &x, expr, nullptr, nullptr, false);
- } else if (expr->kind == Ast_SelectorExpr) {
- e = check_selector(ctx, &x, expr, nullptr);
- }
- }
+ Entity *e = entity_from_expr(o.expr);
if (e != nullptr) {
if (e->kind == Entity_Procedure) {
@@ -1267,10 +1268,6 @@ ParameterValue handle_parameter_value(CheckerContext *ctx, Type *in_type, Type *
}
}
- if (in_type) {
- check_assignment(ctx, &o, in_type, str_lit("parameter value"));
- }
-
if (out_type_) {
if (in_type != nullptr) {
*out_type_ = in_type;