add seperate builders

remove if with polymorphism for different builders
(easier to understand by naming)
This commit is contained in:
Torsten Ruger
2018-06-29 13:27:57 +03:00
parent 3dffebed3f
commit 86b1edb40c
8 changed files with 73 additions and 37 deletions

View File

@ -106,11 +106,16 @@ module Risc
builder.build(&block)
end
# return a new builder that uses this compiler
# must specify whether to add code automatically to compiler
# second arg is the source for which to build, either method or mom::instruction
def builder( auto_add , source)
Builder.new(self , auto_add , source)
# return a new code builder that uses this compiler
# CodeBuilder returns code after building
def code_builder( source)
CodeBuilder.new(self , source)
end
# return a CompilerBuilder
# CompilerBuilder adds the generated code to the compiler
def compiler_builder( source)
CompilerBuilder.new(self , source)
end
end
end