mirror of
https://github.com/mappu/miqt.git
synced 2025-02-01 19:10:21 +00:00
genbindings/enums: handle enum values with comments
This commit is contained in:
parent
11d0eaf5f4
commit
8585fc05f4
@ -539,9 +539,15 @@ func processEnum(node map[string]interface{}, addNamePrefix string) (CppEnum, er
|
|||||||
// This means one more than the last value
|
// This means one more than the last value
|
||||||
cee.EntryValue = fmt.Sprintf("%d", lastImplicitValue+1)
|
cee.EntryValue = fmt.Sprintf("%d", lastImplicitValue+1)
|
||||||
|
|
||||||
} else if len(ei1) == 1 {
|
} else if len(ei1) >= 1 {
|
||||||
|
|
||||||
ei1_0 := ei1[0].(map[string]interface{})
|
// There may be more than one RHS `inner` expression if one of them
|
||||||
|
// is a comment
|
||||||
|
// Iterate through each of the ei1 entries and see if any of them
|
||||||
|
// work for the purposes of enum constant value parsing
|
||||||
|
for _, ei1_0 := range ei1 {
|
||||||
|
|
||||||
|
ei1_0 := ei1_0.(map[string]interface{})
|
||||||
|
|
||||||
// Best case: .inner -> kind=ConstantExpr value=xx
|
// Best case: .inner -> kind=ConstantExpr value=xx
|
||||||
// e.g. qabstractitemmodel
|
// e.g. qabstractitemmodel
|
||||||
@ -570,6 +576,9 @@ func processEnum(node map[string]interface{}, addNamePrefix string) (CppEnum, er
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
// If we made it here, we did not hit any of the `goto afterParse` cases
|
||||||
|
|
||||||
|
}
|
||||||
afterParse:
|
afterParse:
|
||||||
if cee.EntryValue == "" {
|
if cee.EntryValue == "" {
|
||||||
return ret, fmt.Errorf("Complex enum %q entry %q", ret.EnumName, entryname)
|
return ret, fmt.Errorf("Complex enum %q entry %q", ret.EnumName, entryname)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user