diff options
Diffstat (limited to 'src/lj_cdata.c')
-rw-r--r-- | src/lj_cdata.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/lj_cdata.c b/src/lj_cdata.c index 5bd55237..1d0aea85 100644 --- a/src/lj_cdata.c +++ b/src/lj_cdata.c | |||
@@ -127,6 +127,17 @@ collect_attrib: | |||
127 | return ct; | 127 | return ct; |
128 | } | 128 | } |
129 | } | 129 | } |
130 | } else if (cd->typeid == CTID_CTYPEID) { | ||
131 | /* Allow indexing a (pointer to) struct constructor to get constants. */ | ||
132 | CType *sct = ct = ctype_raw(cts, *(CTypeID *)p); | ||
133 | if (ctype_isptr(sct->info)) | ||
134 | sct = ctype_rawchild(cts, sct); | ||
135 | if (ctype_isstruct(sct->info)) { | ||
136 | CTSize ofs; | ||
137 | CType *fct = lj_ctype_getfield(cts, sct, name, &ofs); | ||
138 | if (fct && ctype_isconstval(fct->info)) | ||
139 | return fct; | ||
140 | } | ||
130 | } | 141 | } |
131 | { | 142 | { |
132 | GCstr *s = lj_ctype_repr(cts->L, ctype_typeid(cts, ct), NULL); | 143 | GCstr *s = lj_ctype_repr(cts->L, ctype_typeid(cts, ct), NULL); |