ParseFunctionSignature returns a function parsed from a C-style signature. Example: "void* Foo(uint8_t i, bool b)"
(sig string)
| 186 | // Example: |
| 187 | // "void* Foo(uint8_t i, bool b)" |
| 188 | func (m *Module) ParseFunctionSignature(sig string) *Function { |
| 189 | parts := parseFuncRE.FindStringSubmatch(sig) |
| 190 | if len(parts) != 4 { |
| 191 | fail("'%v' is not a valid function signature", sig) |
| 192 | } |
| 193 | ret := m.parseType(parts[1]) |
| 194 | name := parts[2] |
| 195 | args := m.parseTypes(strings.Split(parts[3], ",")) |
| 196 | return m.Function(ret, name, args...) |
| 197 | } |
| 198 | |
| 199 | func (m *Module) parseTypes(l []string) []Type { |
| 200 | out := make([]Type, len(l)) |
no test coverage detected