refactor a bit for upcoming delegations

must get method to be private
more tell, not ask
This commit is contained in:
Torsten Ruger
2018-07-09 18:16:51 +03:00
parent 06e78a7326
commit 63b55f2aa4
3 changed files with 27 additions and 2 deletions

View File

@ -69,6 +69,21 @@ 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
end
# convert the given mom instruction to_risc and then add it (see add_code)
# continue down the instruction chain unti depleted
# (adding moves the insertion point so the whole mom chain is added as a risc chain)