( sourcePath protoreflect.SourcePath, excludeChildAssociatedPaths bool, )
| 54 | } |
| 55 | |
| 56 | func getAssociatedSourcePaths( |
| 57 | sourcePath protoreflect.SourcePath, |
| 58 | excludeChildAssociatedPaths bool, |
| 59 | ) ([]protoreflect.SourcePath, error) { |
| 60 | var result []protoreflect.SourcePath |
| 61 | currentState := start |
| 62 | var associatedSourcePaths []protoreflect.SourcePath |
| 63 | var err error |
| 64 | for i, token := range sourcePath { |
| 65 | if currentState == nil { |
| 66 | // We have not parsed the entire source path, but received a terminal state, this is |
| 67 | // considered an invalid source path, return an error. |
| 68 | return nil, newInvalidSourcePathError(sourcePath, "unexpected termination, invalid source path") |
| 69 | } |
| 70 | // Check the currentState and then set the next state. |
| 71 | currentState, associatedSourcePaths, err = currentState(token, sourcePath, i, excludeChildAssociatedPaths) |
| 72 | if err != nil { |
| 73 | return nil, err |
| 74 | } |
| 75 | // Add all associated paths found to the result. |
| 76 | if associatedSourcePaths != nil { |
| 77 | result = append(result, associatedSourcePaths...) |
| 78 | } |
| 79 | } |
| 80 | |
| 81 | return result, nil |
| 82 | } |
| 83 | |
| 84 | // *** PRIVATE *** |
| 85 |
searching dependent graphs…