clean up block names and export of qualified names makes assembler nicer to read
This commit is contained in:
parent
5756e0b325
commit
4038bd331a
@ -27,7 +27,7 @@ module Ast
|
||||
args << arg_value
|
||||
end
|
||||
class_name = context.current_class.name
|
||||
function = Vm::Function.new("#{class_name}::#{name}" , args )
|
||||
function = Vm::Function.new(name , args )
|
||||
context.current_class.add_function function
|
||||
|
||||
parent_locals = context.locals
|
||||
|
@ -23,7 +23,11 @@ module Elf
|
||||
|
||||
blocks = []
|
||||
program.classes.values.each do |clazz|
|
||||
clazz.functions.each {|f| blocks += f.blocks }
|
||||
clazz.functions.each do |f|
|
||||
f.blocks.each do |b|
|
||||
add_symbol "#{clazz.name}::#{f.name}@#{b.name}" , b.position
|
||||
end
|
||||
end
|
||||
end
|
||||
blocks += [program.entry , program.exit , program.main]
|
||||
blocks.flatten.each do |b|
|
||||
|
@ -9,7 +9,7 @@ module Parser
|
||||
space? >> right_parenthesis
|
||||
}
|
||||
|
||||
rule(:call_site) { name.as(:call_site) >> argument_list >> comment.maybe}
|
||||
rule(:call_site) { (name.as(:receiver) >> str(".")).repeat(0,1) >> name.as(:call_site) >> argument_list >> comment.maybe}
|
||||
|
||||
|
||||
end
|
||||
|
@ -26,7 +26,7 @@ module Vm
|
||||
fun = get_function name
|
||||
unless fun
|
||||
fun = Core::Kernel.send(name , @context)
|
||||
raise "no such function '#{name}'" if fun == nil
|
||||
raise "no such function #{name}, #{name.class}" if fun == nil
|
||||
@functions << fun
|
||||
end
|
||||
fun
|
||||
|
@ -40,10 +40,10 @@ module Vm
|
||||
end
|
||||
end
|
||||
set_return return_type
|
||||
@exit = Core::Kernel::function_exit( Vm::Block.new("#{name}_exit" , self) , name )
|
||||
@return = Block.new("#{name}_return", self , @exit)
|
||||
@body = Block.new("#{name}_body", self , @return)
|
||||
@entry = Core::Kernel::function_entry( Vm::Block.new("#{name}_entry" , self , @body) ,name )
|
||||
@exit = Core::Kernel::function_exit( Vm::Block.new("exit" , self) , name )
|
||||
@return = Block.new("return", self , @exit)
|
||||
@body = Block.new("body", self , @return)
|
||||
@entry = Core::Kernel::function_entry( Vm::Block.new("entry" , self , @body) ,name )
|
||||
@locals = []
|
||||
@blocks = []
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user