diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2023-08-06 23:18:51 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2023-08-06 23:18:51 (GMT) |
commit | fa2ac321528fbba5fa9eb15ee6ae87803fb54bb3 (patch) | |
tree | bad1ba1bfce03ba0d5f478ea298cb6ae08350681 /src/analysis/scan/exprs | |
parent | 453825b9435ec5740fcada42cebe246325a07c37 (diff) |
Reject calls on non callable expressions softly (and fix a little coding mistake).
Diffstat (limited to 'src/analysis/scan/exprs')
-rw-r--r-- | src/analysis/scan/exprs/call.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/analysis/scan/exprs/call.c b/src/analysis/scan/exprs/call.c index 2fd1ff1..83aff85 100644 --- a/src/analysis/scan/exprs/call.c +++ b/src/analysis/scan/exprs/call.c @@ -378,18 +378,24 @@ static ScanReductionState g_scan_pending_call_reduce(GScanPendingCall *expr, GSc */ if (!G_IS_REGISTERED_ITEM(final)) { - assert(access->next == NULL); + if (access->next != NULL) + result = SRS_UNRESOLVABLE; - *out = G_SCAN_EXPRESSION(final); + else + { + *out = G_SCAN_EXPRESSION(final); + g_object_ref(G_OBJECT(final)); + + result = SRS_REDUCED; - result = SRS_REDUCED; + } } else { assert(access->next != NULL); - new_next = g_scan_named_access_duplicate(access->next, resolved); + new_next = g_scan_named_access_duplicate(access->next, G_REGISTERED_ITEM(final)); result = g_scan_expression_reduce(new_next, ctx, scope, out); @@ -402,6 +408,8 @@ static ScanReductionState g_scan_pending_call_reduce(GScanPendingCall *expr, GSc else result = SRS_UNRESOLVABLE; + g_clear_object(&final); + } /* Libération locale des arguments reconstruits */ |