Implemented type checks

This commit is contained in:
Eduard Urbach 2024-08-07 16:20:03 +02:00
parent baa2463b4b
commit cacee7260a
Signed by: eduard
GPG key ID: 49226B848C78F6C8
19 changed files with 199 additions and 79 deletions

View file

@ -229,7 +229,12 @@ func (s *Scanner) scanFile(path string, pkg string) error {
function := core.NewFunction(pkg, name, file, body)
if typeStart != -1 {
function.ReturnTypes = append(function.ReturnTypes, types.New(tokens[typeStart:typeEnd]))
if tokens[typeStart].Kind == token.GroupStart && tokens[typeEnd-1].Kind == token.GroupEnd {
typeStart++
typeEnd--
}
function.ReturnTypes = types.NewList(tokens[typeStart:typeEnd], contents)
}
parameters := tokens[paramsStart:paramsEnd]
@ -241,8 +246,8 @@ func (s *Scanner) scanFile(path string, pkg string) error {
}
name := tokens[0].Text(contents)
dataType := types.New(tokens[1:])
register := x64.CallRegisters[count]
dataType := types.New(tokens[1:].Text(contents))
register := x64.InputRegisters[count]
uses := token.Count(function.Body, contents, token.Identifier, name)
if uses == 0 {