aboutsummaryrefslogtreecommitdiff
path: root/src/lj_cdata.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lj_cdata.c')
-rw-r--r--src/lj_cdata.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/lj_cdata.c b/src/lj_cdata.c
index 29380cbc..a763908d 100644
--- a/src/lj_cdata.c
+++ b/src/lj_cdata.c
@@ -78,6 +78,7 @@ CType *lj_cdata_index(CTState *cts, GCcdata *cd, cTValue *key, uint8_t **pp,
78 ct = ctype_child(cts, ct); 78 ct = ctype_child(cts, ct);
79 } 79 }
80 80
81collect_attrib:
81 /* Skip attributes and collect qualifiers. */ 82 /* Skip attributes and collect qualifiers. */
82 while (ctype_isattrib(ct->info)) { 83 while (ctype_isattrib(ct->info)) {
83 if (ctype_attrib(ct->info) == CTA_QUAL) *qual |= ct->size; 84 if (ctype_attrib(ct->info) == CTA_QUAL) *qual |= ct->size;
@@ -102,17 +103,14 @@ CType *lj_cdata_index(CTState *cts, GCcdata *cd, cTValue *key, uint8_t **pp,
102 } else if (tvisstr(key)) { /* String key. */ 103 } else if (tvisstr(key)) { /* String key. */
103 GCstr *name = strV(key); 104 GCstr *name = strV(key);
104 if (ctype_isptr(ct->info)) { /* Automatically perform '->'. */ 105 if (ctype_isptr(ct->info)) { /* Automatically perform '->'. */
105 CType *cct = ctype_child(cts, ct); 106 if (ctype_isstruct(ctype_rawchild(cts, ct)->info)) {
106 if (ctype_isstruct(cct->info)) {
107 p = (uint8_t *)cdata_getptr(p, ct->size); 107 p = (uint8_t *)cdata_getptr(p, ct->size);
108 ct = cct; 108 ct = ctype_child(cts, ct);
109 goto index_struct; 109 goto collect_attrib;
110 } 110 }
111 } if (ctype_isstruct(ct->info)) { 111 } if (ctype_isstruct(ct->info)) {
112 CTSize ofs; 112 CTSize ofs;
113 CType *fct; 113 CType *fct = lj_ctype_getfield(cts, ct, name, &ofs);
114 index_struct:
115 fct = lj_ctype_getfield(cts, ct, name, &ofs);
116 if (fct) { 114 if (fct) {
117 *pp = p + ofs; 115 *pp = p + ofs;
118 return fct; 116 return fct;