Implemented structs
This commit is contained in:
@ -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)
|
||||
}
|
||||
|
Reference in New Issue
Block a user