This commit is contained in:
nub31
2025-09-12 17:31:40 +02:00
parent 314f7efc7b
commit 1eeeb67d88
4 changed files with 69 additions and 59 deletions

View File

@@ -366,7 +366,9 @@ public sealed class TypeChecker
if (function != null)
{
return new FuncIdentifierNode(ResolveType(function.FuncType), _syntaxTree.Metadata.ModuleName, expression.Name, function.ExternSymbol);
var parameters = function.Parameters.Select(x => ResolveType(x.Type)).ToList();
var type = new FuncTypeNode(parameters, ResolveType(function.ReturnType));
return new FuncIdentifierNode(type, _syntaxTree.Metadata.ModuleName, expression.Name, function.ExternSymbol);
}
throw new TypeCheckerException(Diagnostic.Error($"Symbol {expression.Name} not found").At(expression).Build());
@@ -385,7 +387,9 @@ public sealed class TypeChecker
var function = module.Functions(includePrivate).FirstOrDefault(x => x.Name == expression.Name);
if (function != null)
{
return new FuncIdentifierNode(ResolveType(function.FuncType), expression.Module, expression.Name, function.ExternSymbol);
var parameters = function.Parameters.Select(x => ResolveType(x.Type)).ToList();
var type = new FuncTypeNode(parameters, ResolveType(function.ReturnType));
return new FuncIdentifierNode(type, expression.Module, expression.Name, function.ExternSymbol);
}
throw new TypeCheckerException(Diagnostic.Error($"No exported symbol {expression.Name} not found in module {expression.Module}").At(expression).Build());
@@ -558,7 +562,7 @@ public sealed class TypeChecker
result.Fields.AddRange(fields);
// todo(nub31): Functions and interface implementations
_referencedStructTypes.Add(result);
return result;
}