From ebb9d8c3309e3195b44314abcf7e4d9f06b01d1d Mon Sep 17 00:00:00 2001 From: Hadeweka Date: Fri, 25 Sep 2020 18:41:23 +0200 Subject: [PATCH] Fixed reference table counter (again) --- src/MrbRefTable.cr | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/MrbRefTable.cr b/src/MrbRefTable.cr index 362f5ab..c4c9fb0 100644 --- a/src/MrbRefTable.cr +++ b/src/MrbRefTable.cr @@ -9,7 +9,7 @@ module MrbRefTable @@content = {} of UInt64 => Tuple(Void*, Int64) @@logging = false @@warnings = true - @@options = {} of Symbol => Bool + @@options = {:replace_conflicting_pointers => false} def self.get(identification) return @@content[identification][0] @@ -20,7 +20,11 @@ module MrbRefTable if @@content[identification]? if value != @@content[identification][0] puts "WARNING: Value #{identification} replaced pointers." if @@warnings - @@content[identification] = {value, @@content[identification][1] + 1} if self.option_active?(:replace_conflicting_pointers) + if self.option_active?(:replace_conflicting_pointers) + @@content[identification] = {value, @@content[identification][1] + 1} + else + @@content[identification] = {@@content[identification][0] , @@content[identification][1] + 1} + end else @@content[identification] = {value, @@content[identification][1] + 1} end