2018-03-11 12:32:42 +01:00
|
|
|
module Risc
|
2016-12-09 12:56:13 +01:00
|
|
|
|
2019-08-06 17:33:27 +02:00
|
|
|
# MethodCompiler is used to generate risc instructions for methods
|
|
|
|
# and to instantiate the methods correctly.
|
2015-10-28 20:36:41 +01:00
|
|
|
|
2018-07-10 21:02:11 +02:00
|
|
|
class MethodCompiler < CallableCompiler
|
2015-05-08 14:10:30 +02:00
|
|
|
|
2019-10-03 20:07:55 +02:00
|
|
|
# Methods starts with a Label, both in risc and slot.
|
|
|
|
# Pass in the callable(method) and the slot label that the method starts with
|
2019-10-03 19:55:41 +02:00
|
|
|
def initialize( method , slot_label)
|
|
|
|
super(method , slot_label)
|
2015-09-19 17:56:18 +02:00
|
|
|
end
|
2018-06-29 12:03:19 +02:00
|
|
|
|
2018-07-10 21:02:11 +02:00
|
|
|
def source_name
|
2018-07-30 09:26:11 +02:00
|
|
|
"#{@callable.self_type.name}.#{@callable.name}"
|
2018-07-10 21:02:11 +02:00
|
|
|
end
|
2018-07-30 09:26:11 +02:00
|
|
|
|
2018-07-09 18:32:17 +02:00
|
|
|
# sometimes the method is used as source (tb reviewed)
|
|
|
|
def source
|
2018-07-30 09:26:11 +02:00
|
|
|
@callable
|
2018-07-09 18:32:17 +02:00
|
|
|
end
|
2018-07-30 09:26:11 +02:00
|
|
|
|
2015-05-08 14:10:30 +02:00
|
|
|
end
|
|
|
|
end
|