Skip to content

Commit 006974d

Browse files
committed
Tag the REPR function table with the ID the REPR gets, so it's conveniently available.
1 parent 102de40 commit 006974d

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

src/6model/repr_registry.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ static void register_repr(PARROT_INTERP, STRING *name, REPROps *repr) {
3535
repr_registry = mem_sys_allocate(num_reprs * sizeof(REPROps *));
3636
repr_registry[ID] = repr;
3737
VTABLE_set_integer_keyed_str(interp, repr_name_to_id_map, name, ID);
38+
repr->ID = ID;
3839
}
3940

4041
/* Dynamically registers a representation (that is, one defined outside of

src/6model/sixmodelobject.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,9 @@ struct SixModel_REPROps {
258258
* out, the representation probably knows more about timing issues and
259259
* thread safety requirements. */
260260
void (*change_type) (PARROT_INTERP, PMC *Object, PMC *NewType);
261+
262+
/* The representation's ID. */
263+
INTVAL ID;
261264
};
262265

263266
/* Hint value to indicate the absence of an attribute lookup or method

0 commit comments

Comments
 (0)