github.com/llir/llvm@v0.3.6/asm/enum/clausetype_string2enum.go (about) 1 // Code generated by "string2enum -linecomment -type ClauseType ../../ir/enum"; DO NOT EDIT. 2 3 package enum 4 5 import ( 6 "fmt" 7 8 "github.com/llir/llvm/ir/enum" 9 ) 10 11 func _() { 12 // An "invalid array index" compiler error signifies that the constant values have changed. 13 // Re-run the string2enum command to generate them again. 14 var x [1]struct{} 15 _ = x[enum.ClauseTypeCatch-1] 16 _ = x[enum.ClauseTypeFilter-2] 17 } 18 19 const _ClauseType_name = "catchfilter" 20 21 var _ClauseType_index = [...]uint8{0, 5, 11} 22 23 // ClauseTypeFromString returns the ClauseType enum corresponding to s. 24 func ClauseTypeFromString(s string) enum.ClauseType { 25 if len(s) == 0 { 26 return 0 27 } 28 for i := range _ClauseType_index[:len(_ClauseType_index)-1] { 29 if s == _ClauseType_name[_ClauseType_index[i]:_ClauseType_index[i+1]] { 30 return enum.ClauseType(i + 1) 31 } 32 } 33 panic(fmt.Errorf("unable to locate ClauseType enum corresponding to %q", s)) 34 } 35 36 func _(s string) { 37 // Check for duplicate string values in type "ClauseType". 38 switch s { 39 // 1 40 case "catch": 41 // 2 42 case "filter": 43 } 44 }