split compilers resolve_type into the three possibilities

cleaner code, though temporary it shifts some dirt
into the index method. up next
This commit is contained in:
Torsten Ruger
2018-07-16 12:03:40 +03:00
parent 3343017dba
commit 29363e7f72
7 changed files with 47 additions and 35 deletions

View File

@ -74,19 +74,18 @@ module Risc
ret
end
# resolve a symbol to a type. Allowed symbols are :frame , :receiver and arguments
# which return the respective types, otherwise nil
def resolve_type( name )
case name
when :frame
return @method.frame_type
when :arguments
return @method.arguments_type
when :receiver
return @method.self_type
else
return nil
end
# return the frame type, ie the method frame type
def frame_type
@method.frame_type
end
# return the frame type, ie the method arguments type
def arg_type
@method.arguments_type
end
# return the frame type, ie the method self_type
def receiver_type
@method.self_type
end
# convert the given mom instruction to_risc and then add it (see add_code)