...
This commit is contained in:
@@ -321,9 +321,12 @@ public sealed class TypeChecker(string fileName, NodeDefinitionFunc function, Mo
|
||||
if (!moduleGraph.TryResolveModule(expression.Module.Ident, out var module))
|
||||
throw new CompileException(Diagnostic.Error($"Module '{expression.Module.Ident}' not found").At(fileName, expression.Module).Build());
|
||||
|
||||
if (!module.TryResolveStructType(expression.Name.Ident, out var structType))
|
||||
if (!module.TryResolveCustomType(expression.Name.Ident, out var customType))
|
||||
throw new CompileException(Diagnostic.Error($"Struct '{expression.Module.Ident}::{expression.Name.Ident}' not found").At(fileName, expression.Name).Build());
|
||||
|
||||
if (customType is not NubTypeStruct structType)
|
||||
throw new CompileException(Diagnostic.Error($"Cannot create struct literal of non-struct type '{expression.Module.Ident}::{expression.Name.Ident}'").At(fileName, expression.Name).Build());
|
||||
|
||||
var initializers = new List<TypedNodeExpressionStructLiteral.Initializer>();
|
||||
foreach (var initializer in expression.Initializers)
|
||||
{
|
||||
@@ -357,15 +360,15 @@ public sealed class TypeChecker(string fileName, NodeDefinitionFunc function, Mo
|
||||
};
|
||||
}
|
||||
|
||||
private NubTypeStruct ResolveCustomType(NodeTypeCustom type)
|
||||
private NubType ResolveCustomType(NodeTypeCustom type)
|
||||
{
|
||||
if (!moduleGraph.TryResolveModule(type.Module.Ident, out var module))
|
||||
throw new CompileException(Diagnostic.Error($"Module '{type.Module.Ident}' not found").At(fileName, type.Module).Build());
|
||||
|
||||
if (!module.TryResolveStructType(type.Module.Ident, out var structType))
|
||||
if (!module.TryResolveCustomType(type.Module.Ident, out var customType))
|
||||
throw new CompileException(Diagnostic.Error($"Custom type '{type.Module.Ident}::{type.Name.Ident}' not found").At(fileName, type.Name).Build());
|
||||
|
||||
return structType;
|
||||
return customType;
|
||||
}
|
||||
|
||||
private class Scope(Scope? parent)
|
||||
|
||||
Reference in New Issue
Block a user