MCPcopy
hub / github.com/davyxu/tabtoy / findFieldType

Function findFieldType

v2/typemodel.go:219–248  ·  view source on GitHub ↗
(localFD *model.FileDescriptor,
	globalFD *model.FileDescriptor,
	rawFieldType string)

Source from the content-addressed store, hash-verified

217}
218
219func findFieldType(localFD *model.FileDescriptor,
220 globalFD *model.FileDescriptor,
221 rawFieldType string) (model.FieldType, bool, *model.Descriptor, bool) {
222
223 // 开始在本地symbol中找
224 testFD := localFD
225
226 for {
227
228 fieldType, isrepeatd, complexType, ok := findlocalFieldType(testFD, rawFieldType)
229
230 if !ok {
231 return model.FieldType_None, isrepeatd, nil, false
232 }
233
234 if fieldType != model.FieldType_None {
235 return fieldType, isrepeatd, complexType, true
236 }
237
238 // 已经是全局范围, 说明找不到
239 if testFD == globalFD {
240
241 return model.FieldType_None, isrepeatd, nil, true
242 }
243
244 // 找不到就换全局范围找
245 testFD = globalFD
246 }
247
248}
249
250// bool表示是否有错
251func findlocalFieldType(localFD *model.FileDescriptor, rawFieldType string) (model.FieldType, bool, *model.Descriptor, bool) {

Callers 2

ParseDataMethod · 0.85
SolveUnknownModelMethod · 0.85

Calls 1

findlocalFieldTypeFunction · 0.85

Tested by

no test coverage detected