diff --git a/.ruby-version b/.ruby-version index bc4abe86..6a6a3d8e 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.3.8 +2.6.1 diff --git a/.travis.yml b/.travis.yml index 35d44cf2..2e52a421 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,4 +4,7 @@ script: - ruby test/test_all.rb - bundle exec codeclimate-test-reporter rvm: - - 2.3.7 + - 2.4.5 + - 2.5.3 + - 2.6.1 + diff --git a/Gemfile.lock b/Gemfile.lock index 63f7b427..0740491f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,6 +1,6 @@ GIT remote: https://github.com/ruby-x/rx-file - revision: c1de10352d8af105fe532008ceafcdd30b5fbdab + revision: 7c4a5546136d1bad065803da91778b209c18cb4d specs: rx-file (0.3.0) diff --git a/lib/arm/attributed.rb b/lib/arm/attributed.rb index 5cea07d2..df877aa3 100644 --- a/lib/arm/attributed.rb +++ b/lib/arm/attributed.rb @@ -19,7 +19,7 @@ module Arm # for the shift handling that makes the arm so unique def shift val , by - raise "Not integer #{val}:#{val.class} #{inspect}" unless val.is_a? Fixnum + raise "Not integer #{val}:#{val.class} #{inspect}" unless val.is_a? ::Integer val << by end diff --git a/lib/arm/constants.rb b/lib/arm/constants.rb index 6d843ae3..673766b7 100644 --- a/lib/arm/constants.rb +++ b/lib/arm/constants.rb @@ -63,7 +63,7 @@ module Arm if r_name.is_a? ::Risc::RegisterValue r_name = r_name.symbol end - if r_name.is_a? Fixnum + if r_name.is_a? ::Integer r_name = "r#{r_name}" end r = REGISTERS[r_name.to_s] diff --git a/lib/arm/instructions/compare_instruction.rb b/lib/arm/instructions/compare_instruction.rb index 0eeae0f7..dcfa385f 100644 --- a/lib/arm/instructions/compare_instruction.rb +++ b/lib/arm/instructions/compare_instruction.rb @@ -5,7 +5,7 @@ module Arm super(nil) @attributes = attributes @left = left - @right = right.is_a?(Fixnum) ? IntegerConstant.new(right) : right + @right = right.is_a?(::Integer) ? IntegerConstant.new(right) : right @attributes[:condition_code] = :al if @attributes[:condition_code] == nil @operand = 0 @attributes[:update_status] = 1 diff --git a/lib/parfait/space.rb b/lib/parfait/space.rb index 1013c338..59198850 100644 --- a/lib/parfait/space.rb +++ b/lib/parfait/space.rb @@ -85,7 +85,7 @@ module Parfait # add a type, meaning the instance given must be a valid type def add_type( type ) hash = type.hash - raise "upps #{hash} #{hash.class}" unless hash.is_a?(Fixnum) + raise "upps #{hash} #{hash.class}" unless hash.is_a?(::Integer) was = types[hash] return was if was types[hash] = type diff --git a/lib/parfait/word.rb b/lib/parfait/word.rb index 29bfa234..8cf81baa 100644 --- a/lib/parfait/word.rb +++ b/lib/parfait/word.rb @@ -27,7 +27,7 @@ module Parfait def initialize( len ) super() self.char_length = 0 - raise "Must init with int, not #{len.class}" unless len.kind_of? Fixnum + raise "Must init with int, not #{len.class}" unless len.kind_of? ::Integer raise "Must init with positive, not #{len}" if len < 0 set_length( len , 32 ) unless len == 0 #32 being ascii space #puts "type #{self.get_type} #{self.object_id.to_s(16)}" @@ -87,7 +87,7 @@ module Parfait # the index starts at one, but may be negative to count from the end # indexes out of range will raise an error def set_char( at , char ) - raise "char not fixnum #{char.class}" unless char.kind_of? Fixnum + raise "char not fixnum #{char.class}" unless char.kind_of? ::Integer index = range_correct_index(at) set_internal_byte( index , char) end @@ -137,7 +137,7 @@ module Parfait def range_correct_index( at ) index = at # index = self.length + at if at < 0 - raise "index not integer #{at.class}" unless at.is_a?(Fixnum) + raise "index not integer #{at.class}" unless at.is_a?(::Integer) raise "index must be positive , not #{at}" if (index < 0) raise "index too large #{at} > #{self.length}" if (index >= self.length ) return index + 11 diff --git a/lib/risc.rb b/lib/risc.rb index 505f9e84..7dcb872c 100644 --- a/lib/risc.rb +++ b/lib/risc.rb @@ -36,7 +36,7 @@ require_relative "risc/method_compiler" require_relative "risc/block_compiler" require_relative "risc/assembler" -class Fixnum +class Integer def fits_u8? self >= 0 and self <= 255 end diff --git a/lib/risc/collector.rb b/lib/risc/collector.rb index 64e5db3d..9dcc1310 100644 --- a/lib/risc/collector.rb +++ b/lib/risc/collector.rb @@ -34,7 +34,7 @@ module Risc # Objects are data and get assembled after functions def self.add_object( objekt , depth) return false if Position.set?(objekt) - return true if objekt.is_a? Fixnum + return true if objekt.is_a? ::Integer return true if objekt.is_a?( Risc::Label) #puts message(objekt , depth) #puts "ADD #{objekt.inspect}, #{objekt.name}" if objekt.is_a? Parfait::CallableMethod diff --git a/lib/risc/interpreter.rb b/lib/risc/interpreter.rb index 4891136b..58e5635c 100644 --- a/lib/risc/interpreter.rb +++ b/lib/risc/interpreter.rb @@ -73,7 +73,7 @@ module Risc def set_register( reg , val ) old = get_register( reg ) # also ensures format - if val.is_a? Fixnum + if val.is_a? ::Integer @flags[:zero] = (val == 0) @flags[:plus] = (val >= 0) @flags[:minus] = (val < 0) @@ -190,7 +190,7 @@ module Risc end raise "Unsupported action, must convert symbol to word:#{object}" if object.is_a?(Symbol) value = object.get_char( index ) - #value = value.object_id unless value.is_a? Fixnum + #value = value.object_id unless value.is_a? ::Integer set_register( @instruction.register , value ) true end diff --git a/lib/risc/register_value.rb b/lib/risc/register_value.rb index 67b35a65..ba60fce9 100644 --- a/lib/risc/register_value.rb +++ b/lib/risc/register_value.rb @@ -142,7 +142,7 @@ module Risc when Label ins = Risc.load_constant("#{right.class} to #{self.type}" , right , self) builder.compiler.add_constant(right.address) if builder - when Fixnum + when ::Integer ins = Risc.load_data("#{right.class} to #{self.type}" , right , self) when RegisterValue ins = Risc.transfer("#{right.type} to #{self.type}" , right , self) diff --git a/lib/risc/text_writer.rb b/lib/risc/text_writer.rb index 2ccf0d88..c3e7686d 100644 --- a/lib/risc/text_writer.rb +++ b/lib/risc/text_writer.rb @@ -206,7 +206,7 @@ module Risc case object when nil @stream.write_signed_int_32(0) - when Fixnum + when ::Integer @stream.write_signed_int_32(object) else @stream.write_signed_int_32(Position.get(object) + @linker.platform.loaded_at) diff --git a/risc/interpreter/test_events.rb b/risc/interpreter/test_events.rb new file mode 100644 index 00000000..e69de29b diff --git a/test/arm/test_arm_platform.rb b/test/arm/test_arm_platform.rb index 10bf0600..9e141545 100644 --- a/test/arm/test_arm_platform.rb +++ b/test/arm/test_arm_platform.rb @@ -12,7 +12,7 @@ module Arm assert_equal Arm::Translator , @arm.translator.class end def test_platform_loaded_class - assert_equal Fixnum , @arm.loaded_at.class + assert_equal ::Integer , @arm.loaded_at.class end end end diff --git a/test/mains/test_new.rb b/test/mains/test_new.rb index faf514af..c1dfb5c5 100644 --- a/test/mains/test_new.rb +++ b/test/mains/test_new.rb @@ -10,7 +10,7 @@ module Mains end def test_chain # max 1011 iterations on 1014 integers (1024 - 10 reserve) run_all - assert_equal Fixnum , get_return.class , " " + assert_equal ::Integer , get_return.class , " " assert_equal 0 , get_return , " " end diff --git a/test/parfait/test_space.rb b/test/parfait/test_space.rb index 460edd4c..ef5d01ea 100644 --- a/test/parfait/test_space.rb +++ b/test/parfait/test_space.rb @@ -53,7 +53,7 @@ module Parfait def test_types_hashes types = @space.instance_variable_ged("@types") types.each do |has , type| - assert has.is_a?(Fixnum) , has.inspect + assert has.is_a?(::Integer) , has.inspect end end def test_classes_types_in_space_types diff --git a/test/risc/interpreter/assign/test_assign_local.rb b/test/risc/interpreter/assign/test_assign_local.rb index 323d8d69..19ae1059 100644 --- a/test/risc/interpreter/assign/test_assign_local.rb +++ b/test/risc/interpreter/assign/test_assign_local.rb @@ -34,7 +34,7 @@ module Risc ret = main_ticks(19) assert_equal FunctionReturn , ret.class link = @interpreter.get_register( ret.register ) - assert_equal Fixnum , link.class + assert_equal ::Integer , link.class end def test_transfer transfer = main_ticks(20) diff --git a/test/risc/interpreter/calling/test_alloc.rb b/test/risc/interpreter/calling/test_alloc.rb index 48243fd0..f59bb47a 100644 --- a/test/risc/interpreter/calling/test_alloc.rb +++ b/test/risc/interpreter/calling/test_alloc.rb @@ -51,7 +51,7 @@ module Risc assert_equal :- , op.operator assert_equal :r3 , op.left.symbol assert_equal :r1 , op.right.symbol - assert_equal Fixnum , @interpreter.get_register(:r3).class + assert_equal ::Integer , @interpreter.get_register(:r3).class assert 0 != @interpreter.get_register(:r3) end def test_branch diff --git a/test/risc/interpreter/calling/test_div10.rb b/test/risc/interpreter/calling/test_div10.rb index 6bc75465..f79ecead 100644 --- a/test/risc/interpreter/calling/test_div10.rb +++ b/test/risc/interpreter/calling/test_div10.rb @@ -47,7 +47,7 @@ module Risc ret = main_ticks(93) assert_equal FunctionReturn , ret.class link = @interpreter.get_register( ret.register ) - assert_equal Fixnum , link.class + assert_equal ::Integer , link.class end end end diff --git a/test/risc/interpreter/test_dynamic_call.rb b/test/risc/interpreter/test_dynamic_call.rb index 38b4e603..1cdb44bc 100644 --- a/test/risc/interpreter/test_dynamic_call.rb +++ b/test/risc/interpreter/test_dynamic_call.rb @@ -40,7 +40,7 @@ module Risc RegToSlot, LoadConstant, SlotToReg, RegToSlot, RegToSlot, SlotToReg, SlotToReg, SlotToReg, FunctionReturn, Transfer, # 140 SlotToReg, SlotToReg, Syscall, NilClass, ] - assert_equal Fixnum , get_return.class + assert_equal ::Integer , get_return.class assert_equal 1 , get_return end @@ -63,7 +63,7 @@ module Risc ret = main_ticks(139) assert_equal FunctionReturn , ret.class link = @interpreter.get_register( ret.register ) - assert_equal Fixnum , link.class + assert_equal ::Integer , link.class end def test_sys sys = main_ticks(143) diff --git a/test/risc/interpreter/test_events.rb b/test/risc/interpreter/test_events.rb index 13307618..3bf6ac50 100644 --- a/test/risc/interpreter/test_events.rb +++ b/test/risc/interpreter/test_events.rb @@ -47,7 +47,7 @@ module Risc RegToSlot, LoadConstant, SlotToReg, RegToSlot, RegToSlot, # 30 SlotToReg, SlotToReg, SlotToReg, Branch, FunctionReturn, Transfer, SlotToReg, SlotToReg, Syscall, NilClass, ] - assert_equal Fixnum , get_return.class + assert_equal ::Integer , get_return.class assert_equal 5 , get_return end def test_length diff --git a/test/risc/interpreter/test_return.rb b/test/risc/interpreter/test_return.rb index 4a8bc622..c4679ab0 100644 --- a/test/risc/interpreter/test_return.rb +++ b/test/risc/interpreter/test_return.rb @@ -32,7 +32,7 @@ module Risc ret = main_ticks(15) assert_equal FunctionReturn , ret.class link = @interpreter.get_register( ret.register ) - assert_equal Fixnum , link.class + assert_equal ::Integer , link.class end def test_transfer transfer = main_ticks(16) diff --git a/test/risc/test_interpreter_platform.rb b/test/risc/test_interpreter_platform.rb index 77a52603..bcb81875 100644 --- a/test/risc/test_interpreter_platform.rb +++ b/test/risc/test_interpreter_platform.rb @@ -12,7 +12,7 @@ module Risc assert_equal Risc::IdentityTranslator , @inter.translator.class end def test_platform_loaded_class - assert_equal Fixnum , @inter.loaded_at.class + assert_equal ::Integer , @inter.loaded_at.class end def test_translator assert IdentityTranslator.new diff --git a/test_interpreter_platform.rb b/test_interpreter_platform.rb new file mode 100644 index 00000000..e69de29b