aboutsummaryrefslogtreecommitdiff
path: root/src/lj_ctype.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lj_ctype.c')
-rw-r--r--src/lj_ctype.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/lj_ctype.c b/src/lj_ctype.c
index 666a5daf..14893cc2 100644
--- a/src/lj_ctype.c
+++ b/src/lj_ctype.c
@@ -234,7 +234,8 @@ CTypeID lj_ctype_getname(CTState *cts, CType **ctp, GCstr *name, uint32_t tmask)
234} 234}
235 235
236/* Get a struct/union/enum/function field by name. */ 236/* Get a struct/union/enum/function field by name. */
237CType *lj_ctype_getfield(CTState *cts, CType *ct, GCstr *name, CTSize *ofs) 237CType *lj_ctype_getfieldq(CTState *cts, CType *ct, GCstr *name, CTSize *ofs,
238 CTInfo *qual)
238{ 239{
239 while (ct->sib) { 240 while (ct->sib) {
240 ct = ctype_get(cts, ct->sib); 241 ct = ctype_get(cts, ct->sib);
@@ -243,8 +244,15 @@ CType *lj_ctype_getfield(CTState *cts, CType *ct, GCstr *name, CTSize *ofs)
243 return ct; 244 return ct;
244 } 245 }
245 if (ctype_isxattrib(ct->info, CTA_SUBTYPE)) { 246 if (ctype_isxattrib(ct->info, CTA_SUBTYPE)) {
246 CType *fct = lj_ctype_getfield(cts, ctype_child(cts, ct), name, ofs); 247 CType *fct, *cct = ctype_child(cts, ct);
248 CTInfo q = 0;
249 while (ctype_isattrib(cct->info)) {
250 if (ctype_attrib(cct->info) == CTA_QUAL) q |= cct->size;
251 cct = ctype_child(cts, cct);
252 }
253 fct = lj_ctype_getfieldq(cts, cct, name, ofs, qual);
247 if (fct) { 254 if (fct) {
255 if (qual) *qual |= q;
248 *ofs += ct->size; 256 *ofs += ct->size;
249 return fct; 257 return fct;
250 } 258 }