1
1
#include "pmc_nqplexinfo.h"
2
+ #ifdef PARROT_HAS_THREADS
3
+ #include "pmc_proxy.h"
4
+ /* requires pmc2c since parrot 4.11 */
5
+ #include "../../nqp_group.h"
6
+ #endif
2
7
3
8
/* Locates the register number for getting the specified name
4
9
* and type of lexical. */
@@ -107,22 +112,25 @@ Return the LexInfo PMC, if any or a Null PMC.
107
112
/* Check if we need to put any static values in place. */
108
113
PMC *info;
109
114
Hash *hash;
115
+ int proxied = 0;
116
+
110
117
GET_ATTR_lexinfo(INTERP, SELF, info);
111
- if (info->vtable->base_type != enum_class_LexInfo
112
- #ifdef PARROT_HAS_THREADS
113
- && info->vtable->base_type != enum_class_Proxy
114
- #endif
115
- ) {
118
+ if (info->vtable->base_type == enum_class_Proxy) {
119
+ info = PARROT_PROXY(info)->target;
120
+ proxied = 1;
121
+ }
122
+ if (info->vtable->base_type == pmc_class_NQPLexInfo ) {
116
123
PMC *name_map;
117
124
GETATTR_NQPLexInfo_name_to_register_map(INTERP, info, name_map);
118
125
hash = (Hash *)VTABLE_get_pointer(INTERP, name_map);
126
+ SET_ATTR_lexinfo_hash(INTERP, SELF, hash);
119
127
}
120
- else {
128
+ else if (info->vtable->base_type == enum_class_LexInfo) {
121
129
hash = (Hash *)VTABLE_get_pointer(INTERP, info);
130
+ SET_ATTR_lexinfo_hash(INTERP, SELF, hash);
122
131
}
123
- SET_ATTR_lexinfo_hash(INTERP, SELF, hash);
124
132
125
- if (info->vtable->base_type != enum_class_LexInfo ) {
133
+ if (!proxied && info->vtable->base_type == pmc_class_NQPLexInfo ) {
126
134
PMC *static_slots_cache;
127
135
GETATTR_NQPLexInfo_static_slots_cache(INTERP, info, static_slots_cache);
128
136
if (!PMC_IS_NULL(static_slots_cache)) {
@@ -147,14 +155,20 @@ Return the LexInfo PMC, if any or a Null PMC.
147
155
VTABLE INTVAL elements() {
148
156
PMC *info;
149
157
GET_ATTR_lexinfo(INTERP, SELF, info);
158
+ if (info->vtable->base_type == enum_class_Proxy) {
159
+ info = PARROT_PROXY(info)->target;
160
+ }
150
161
return VTABLE_elements(interp, info);
151
162
}
152
163
153
164
VTABLE INTVAL exists_keyed_str(STRING *name) {
154
165
PMC *info, *name_map;
155
166
const Hash *hash;
156
167
GET_ATTR_lexinfo(INTERP, SELF, info);
157
- if (info->vtable->base_type != enum_class_LexInfo) {
168
+ if (info->vtable->base_type == enum_class_Proxy) {
169
+ info = PARROT_PROXY(info)->target;
170
+ }
171
+ if (info->vtable->base_type == pmc_class_NQPLexInfo) {
158
172
GETATTR_NQPLexInfo_name_to_register_map(INTERP, info, name_map);
159
173
hash = (const Hash *)VTABLE_get_pointer(INTERP, name_map);
160
174
}
@@ -311,9 +325,11 @@ Return the LexInfo PMC, if any or a Null PMC.
311
325
}
312
326
313
327
METHOD get_lexinfo() {
314
- PMC *lexinfo;
315
- GET_ATTR_lexinfo(INTERP, SELF, lexinfo);
316
- RETURN(PMC *lexinfo);
328
+ PMC *info;
329
+ GET_ATTR_lexinfo(INTERP, SELF, info);
330
+ if (info->vtable->base_type == enum_class_Proxy)
331
+ info = PARROT_PROXY(info)->target;
332
+ RETURN(PMC *info);
317
333
}
318
334
319
335
/*
@@ -326,9 +342,11 @@ Get iterator for declared lexicals.
326
342
327
343
*/
328
344
VTABLE PMC *get_iter() {
329
- PMC *lexinfo;
330
- GET_ATTR_lexinfo(INTERP, SELF, lexinfo);
331
- return VTABLE_get_iter(INTERP, lexinfo);
345
+ PMC *info;
346
+ GET_ATTR_lexinfo(INTERP, SELF, info);
347
+ if (info->vtable->base_type == enum_class_Proxy)
348
+ info = PARROT_PROXY(info)->target;
349
+ return VTABLE_get_iter(INTERP, info);
332
350
}
333
351
334
352
}
0 commit comments