From d08e6702f0562efbdbcdd3f2f772fd82b45da53e Mon Sep 17 00:00:00 2001 From: Torsten Ruger Date: Fri, 25 Apr 2014 11:56:53 +0300 Subject: [PATCH] removes the asm from assemble signature (not used) --- lib/asm/arm_assembler.rb | 2 +- lib/asm/call_instruction.rb | 2 +- lib/asm/instruction.rb | 2 +- lib/asm/label.rb | 3 +-- lib/asm/logic_instruction.rb | 2 +- lib/asm/memory_instruction.rb | 2 +- lib/asm/stack_instruction.rb | 2 +- lib/asm/string_literal.rb | 2 +- test/test_nodes.rb | 7 +++++++ 9 files changed, 15 insertions(+), 9 deletions(-) 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