@@ -72,41 +72,47 @@ Return the LexInfo PMC, if any or a Null PMC.
72
72
73
73
VTABLE void set_pointer(void *ctx) {
74
74
/* Check if we need to put any static values in place. */
75
- PMC *info, *static_slots_cache ;
75
+ PMC *info;
76
76
GET_ATTR_lexinfo(INTERP, SELF, info);
77
- GETATTR_NQPLexInfo_static_slots_cache(INTERP, info, static_slots_cache);
78
- if (!PMC_IS_NULL(static_slots_cache)) {
79
- /* Yes, we have some. Grab values too, then iterate. */
80
- PMC *static_values_cache;
81
- INTVAL num_statics = VTABLE_elements(interp, static_slots_cache);
82
- INTVAL i;
83
- GETATTR_NQPLexInfo_static_values_cache(INTERP, info, static_values_cache);
84
- for (i = 0; i < num_statics; i++) {
85
- INTVAL slot = VTABLE_get_integer_keyed_int(interp, static_slots_cache, i);
86
- PMC *value = VTABLE_get_pmc_keyed_int(interp, static_values_cache, i);
87
- CTX_REG_PMC((PMC *)ctx, slot) = value;
77
+ if (info->vtable->base_type != enum_class_LexInfo) {
78
+ PMC *static_slots_cache;
79
+ GETATTR_NQPLexInfo_static_slots_cache(INTERP, info, static_slots_cache);
80
+ if (!PMC_IS_NULL(static_slots_cache)) {
81
+ /* Yes, we have some. Grab values too, then iterate. */
82
+ PMC *static_values_cache;
83
+ INTVAL num_statics = VTABLE_elements(interp, static_slots_cache);
84
+ INTVAL i;
85
+ GETATTR_NQPLexInfo_static_values_cache(INTERP, info, static_values_cache);
86
+ for (i = 0; i < num_statics; i++) {
87
+ INTVAL slot = VTABLE_get_integer_keyed_int(interp, static_slots_cache, i);
88
+ PMC *value = VTABLE_get_pmc_keyed_int(interp, static_values_cache, i);
89
+ CTX_REG_PMC((PMC *)ctx, slot) = value;
90
+ }
91
+ PARROT_GC_WRITE_BARRIER(INTERP, (PMC *)ctx);
88
92
}
89
- PARROT_GC_WRITE_BARRIER(INTERP, (PMC *)ctx);
90
93
}
91
94
92
95
/* Stash the context pointer. */
93
96
SET_ATTR_ctx(INTERP, SELF, (PMC *)ctx);
94
97
}
95
98
96
99
VTABLE INTVAL elements() {
97
- PMC *info, *name_map ;
100
+ PMC *info;
98
101
GET_ATTR_lexinfo(INTERP, SELF, info);
99
- GETATTR_NQPLexInfo_name_to_register_map(INTERP, info, name_map);
100
- return Parrot_hash_size(INTERP,
101
- (Hash *)VTABLE_get_pointer(INTERP, name_map));
102
+ return VTABLE_elements(interp, info);
102
103
}
103
104
104
105
VTABLE INTVAL exists_keyed_str(STRING *name) {
105
106
PMC *info, *name_map;
106
107
const Hash *hash;
107
108
GET_ATTR_lexinfo(INTERP, SELF, info);
108
- GETATTR_NQPLexInfo_name_to_register_map(INTERP, info, name_map);
109
- hash = (const Hash *)VTABLE_get_pointer(INTERP, name_map);
109
+ if (info->vtable->base_type != enum_class_LexInfo) {
110
+ GETATTR_NQPLexInfo_name_to_register_map(INTERP, info, name_map);
111
+ hash = (const Hash *)VTABLE_get_pointer(INTERP, name_map);
112
+ }
113
+ else {
114
+ hash = (const Hash *)VTABLE_get_pointer(INTERP, info);
115
+ }
110
116
111
117
return hash->entries
112
118
? (Parrot_hash_get_bucket(INTERP, hash, name) != 0)
@@ -125,8 +131,13 @@ Return the LexInfo PMC, if any or a Null PMC.
125
131
HashBucket *b;
126
132
127
133
GET_ATTR_lexinfo(INTERP, SELF, info);
128
- GETATTR_NQPLexInfo_name_to_register_map(INTERP, info, name_map);
129
- hash = (const Hash *)VTABLE_get_pointer(INTERP, name_map);
134
+ if (info->vtable->base_type != enum_class_LexInfo) {
135
+ GETATTR_NQPLexInfo_name_to_register_map(INTERP, info, name_map);
136
+ hash = (const Hash *)VTABLE_get_pointer(INTERP, name_map);
137
+ }
138
+ else {
139
+ hash = (const Hash *)VTABLE_get_pointer(INTERP, info);
140
+ }
130
141
131
142
if (!hash->entries)
132
143
return PMCNULL;
@@ -152,10 +163,15 @@ Return the LexInfo PMC, if any or a Null PMC.
152
163
HashBucket * b;
153
164
154
165
GET_ATTR_lexinfo(INTERP, SELF, info);
155
- GETATTR_NQPLexInfo_name_to_register_map(INTERP, info, name_map);
156
- hash = (const Hash *)VTABLE_get_pointer(INTERP, name_map);
166
+ if (info->vtable->base_type != enum_class_LexInfo) {
167
+ GETATTR_NQPLexInfo_name_to_register_map(INTERP, info, name_map);
168
+ hash = (const Hash *)VTABLE_get_pointer(INTERP, name_map);
169
+ }
170
+ else {
171
+ hash = (const Hash *)VTABLE_get_pointer(INTERP, info);
172
+ }
173
+
157
174
b = Parrot_hash_get_bucket(INTERP, hash, name);
158
-
159
175
if (!b)
160
176
Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_LEX_NOT_FOUND,
161
177
"Lexical '%Ss' not found", name);
0 commit comments