-#define next_annotation() do { \
- if (ann_count) { \
- --ann_count; \
- ION_CHECK(ion_reader_get_an_annotation(obj->reader, ann_index++, &annotation)); \
- } \
-} while (0)
-#define has_annotation(a) (has_annotations && annotation.length == 1 && annotation.value[0] == a)
+ // process any annotations
+ bool backref = false;
+ uint8_t object_type = 0;
+ zend_string *object_class = NULL;
+ int32_t ann_cnt;
+ ION_CHECK(ion_reader_get_annotation_count(obj->reader, &ann_cnt));
+ for (int32_t i = 0; i < ann_cnt; ++i) {
+ ION_STRING ann_str;
+ ION_CHECK(ion_reader_get_an_annotation(obj->reader, i, &ann_str));
+ switch (*ann_str.value) {
+ case 'R':
+ ZVAL_MAKE_REF(return_value);
+ ZVAL_DEREF(return_value);
+ zend_hash_next_index_insert(&php_ion_globals.unserializer.addref, return_value);
+ break;