lang: types, core: Skip over invalid functions

It's not clear how best to support complex functions with struct fields
in templates at the moment. Skip these for now.
This commit is contained in:
James Shubin
2024-03-15 21:19:29 -04:00
parent 719c56e754
commit a8b945e36e
3 changed files with 44 additions and 5 deletions

View File

@@ -899,6 +899,11 @@ func (obj *Type) Reflect() reflect.Type {
if t == nil {
panic("malformed struct field")
}
if strings.Title(k) != k { // is exported?
//k = strings.Title(k) // TODO: is this helpful?
// reflect.StructOf would panic on anything unexported
panic(fmt.Sprintf("struct has unexported field: %s", k))
}
fields = append(fields, reflect.StructField{
Name: k, // struct field name