aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBradley Lewis <22850972+BradLewis@users.noreply.github.com>2025-11-17 21:59:32 +1100
committerGitHub <noreply@github.com>2025-11-17 21:59:32 +1100
commit74396f71ea35e313e6b2585db913e69cca14146e (patch)
tree17028b3fdec6cbe15b00cebc97047d116fe4516e /src
parent161ce3ea1419517da6f7752acba9e4d02f2c4d4b (diff)
parent2c192f7b69b89d4d7dc3367fe5a736c858643129 (diff)
Merge pull request #1189 from BradLewis/fix/unary-expr-function-call
Fix/unary expr function call
Diffstat (limited to 'src')
-rw-r--r--src/server/analysis.odin15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/server/analysis.odin b/src/server/analysis.odin
index c9a6275..723ec85 100644
--- a/src/server/analysis.odin
+++ b/src/server/analysis.odin
@@ -1226,7 +1226,7 @@ internal_resolve_type_expression :: proc(ast_context: ^AstContext, node: ^ast.Ex
ok := internal_resolve_type_expression(ast_context, v.expr, out)
if v.op.kind == .And {
out.pointers += 1
- } else if v.op.kind == .Sub || v.op.kind == .Add {
+ } else if v.op.kind == .Sub || v.op.kind == .Add || v.op.kind == .Not || v.op.kind == .Xor {
if value, ok := out.value.(SymbolProcedureValue); ok {
if len(value.return_types) > 0 {
type := value.return_types[0].type
@@ -1244,7 +1244,18 @@ internal_resolve_type_expression :: proc(ast_context: ^AstContext, node: ^ast.Ex
out.pointers -= 1
return ok
case ^Paren_Expr:
- return internal_resolve_type_expression(ast_context, v.expr, out)
+ ok = internal_resolve_type_expression(ast_context, v.expr, out)
+ if value, ok := out.value.(SymbolProcedureValue); ok {
+ if len(value.return_types) > 0 {
+ type := value.return_types[0].type
+ if type == nil {
+ type = value.return_types[0].default_value
+ }
+ ok = internal_resolve_type_expression(ast_context, type, out)
+ return ok
+ }
+ }
+ return ok
case ^Slice_Expr:
out^, ok = resolve_slice_expression(ast_context, v, v.expr)
return ok