diff --git a/lib/asm/arm_assembler.rb b/lib/asm/arm_assembler.rb index 42c08cf4..69b4ca3d 100644 --- a/lib/asm/arm_assembler.rb +++ b/lib/asm/arm_assembler.rb @@ -122,7 +122,7 @@ module Asm def assemble(io) @values.each do |obj| - obj.assemble io, self + obj.assemble io end end diff --git a/lib/asm/call_instruction.rb b/lib/asm/call_instruction.rb index 12cef595..40dac13d 100644 --- a/lib/asm/call_instruction.rb +++ b/lib/asm/call_instruction.rb @@ -8,7 +8,7 @@ module Asm super(opcode,args) end - def assemble(io, as) + def assemble(io) s = @update_status_flag? 1 : 0 case opcode when :b, :bl diff --git a/lib/asm/instruction.rb b/lib/asm/instruction.rb index 48311540..cd3f067b 100644 --- a/lib/asm/instruction.rb +++ b/lib/asm/instruction.rb @@ -40,7 +40,7 @@ module Asm 4 end - def assemble(io, as) + def assemble(io) raise "Abstract class, should not be called/instantiated #{self.inspect}" end end diff --git a/lib/asm/label.rb b/lib/asm/label.rb index 857ec29c..f9caf2e3 100644 --- a/lib/asm/label.rb +++ b/lib/asm/label.rb @@ -2,7 +2,6 @@ module Asm class Label def initialize(name , asm) - @@oh = 1 @name = name @asm = asm @position = nil @@ -23,7 +22,7 @@ module Asm 0 end - def assemble(io, as) + def assemble(io) self.position = io.tell end def set! diff --git a/lib/asm/logic_instruction.rb b/lib/asm/logic_instruction.rb index 8e289db4..411cac11 100644 --- a/lib/asm/logic_instruction.rb +++ b/lib/asm/logic_instruction.rb @@ -69,7 +69,7 @@ module Asm end end - def assemble(io, as) + def assemble(io) build val = operand.is_a?(Register) ? operand.bits : operand val |= (rd.bits << 12) diff --git a/lib/asm/memory_instruction.rb b/lib/asm/memory_instruction.rb index e4f03acd..93544e56 100644 --- a/lib/asm/memory_instruction.rb +++ b/lib/asm/memory_instruction.rb @@ -56,7 +56,7 @@ module Asm end end - def assemble(io, as) + def assemble(io) build #not sure about these 2 constants. They produce the correct output for str r0 , r1 # but i can't help thinking that that is because they are not used in that instruction and diff --git a/lib/asm/stack_instruction.rb b/lib/asm/stack_instruction.rb index 706b3171..67d97b9b 100644 --- a/lib/asm/stack_instruction.rb +++ b/lib/asm/stack_instruction.rb @@ -26,7 +26,7 @@ module Asm attr_accessor :cond, :inst_class, :pre_post_index, :up_down, :update_status_flag, :write_base, :is_pop, :rn, :operand - def assemble(io, as) + def assemble(io) build cond = @cond.is_a?(Symbol) ? COND_CODES[@cond] : @cond rn = reg "sp" # sp register diff --git a/lib/asm/string_literal.rb b/lib/asm/string_literal.rb index 16e04189..c7bd7cd3 100644 --- a/lib/asm/string_literal.rb +++ b/lib/asm/string_literal.rb @@ -19,7 +19,7 @@ module Asm def length @string.length end - def assemble(io, as) + def assemble(io) io << @string end end diff --git a/test/test_nodes.rb b/test/test_nodes.rb index dc85d894..5d9a1d3c 100644 --- a/test/test_nodes.rb +++ b/test/test_nodes.rb @@ -28,6 +28,13 @@ class NodesCase < MiniTest::Test assert tree[:args].is_a? Vm::NumberExpression assert_equal 42 , tree[:args].value end + def test_arg_list + @parser = @parser.args + tree = parse "(42, foo)" + assert_equal Array , tree.class + assert_equal 42 , tree.first.value + assert_equal "foo" , tree.last.name + end end