(int obj_index_to_collect)
| 763 | } |
| 764 | |
| 765 | internal void collectObject(int obj_index_to_collect) |
| 766 | { |
| 767 | object o; |
| 768 | |
| 769 | if (objects.TryGetValue(obj_index_to_collect, out o)) |
| 770 | { |
| 771 | objects.Remove(obj_index_to_collect); |
| 772 | |
| 773 | if (o != null) |
| 774 | { |
| 775 | int obj_index; |
| 776 | //lua gc是先把weak table移除后再调用__gc,这期间同一个对象可能再次push到lua,关联到新的index |
| 777 | bool is_enum = o.GetType().IsEnum(); |
| 778 | if ((is_enum ? enumMap.TryGetValue(o, out obj_index) : reverseMap.TryGetValue(o, out obj_index)) |
| 779 | && obj_index == obj_index_to_collect) |
| 780 | { |
| 781 | if (is_enum) |
| 782 | { |
| 783 | enumMap.Remove(o); |
| 784 | } |
| 785 | else |
| 786 | { |
| 787 | reverseMap.Remove(o); |
| 788 | } |
| 789 | } |
| 790 | } |
| 791 | } |
| 792 | } |
| 793 | |
| 794 | int addObject(object obj, bool is_valuetype, bool is_enum) |
| 795 | { |
no test coverage detected