Implemented structs

This commit is contained in:
2025-02-04 18:16:31 +01:00
parent 4609a814df
commit 03a3bd8f02
32 changed files with 267 additions and 63 deletions

View File

@ -26,11 +26,20 @@ func (f *Function) CompileCall(root *expression.Expression) (*Function, error) {
if nameNode.IsLeaf() {
name = nameNode.Token.Text(f.File.Bytes)
if name == "syscall" {
switch name {
case "syscall":
return nil, f.CompileSyscall(root)
}
if name == "store" {
case "new":
return &Function{
ReturnTypes: []types.Type{
&types.Pointer{
To: f.Types[root.Children[1].Token.Text(f.File.Bytes)],
},
},
}, f.CompileNew(root)
case "delete":
return nil, f.CompileDelete(root)
case "store":
return nil, f.CompileMemoryStore(root)
}
} else {
@ -85,8 +94,8 @@ func (f *Function) CompileCall(root *expression.Expression) (*Function, error) {
if !types.Check(typ, fn.Parameters[i].Type) {
return nil, errors.New(&errors.TypeMismatch{
Encountered: typ.Name,
Expected: fn.Parameters[i].Type.Name,
Encountered: typ.UniqueName(),
Expected: fn.Parameters[i].Type.UniqueName(),
ParameterName: fn.Parameters[i].Name,
}, f.File, parameters[i].Token.Position)
}