MCPcopy Create free account
hub / github.com/bufbuild/protocompile / generateSourceCodeInfoForMethod

Function generateSourceCodeInfoForMethod

sourceinfo/source_code_info.go:605–629  ·  view source on GitHub ↗
(opts OptionIndex, sci *sourceCodeInfo, n *ast.RPCNode, path []int32)

Source from the content-addressed store, hash-verified

603}
604
605func generateSourceCodeInfoForMethod(opts OptionIndex, sci *sourceCodeInfo, n *ast.RPCNode, path []int32) {
606 if n.OpenBrace != nil {
607 sci.newBlockLocWithComments(n, n.OpenBrace, path)
608 } else {
609 sci.newLocWithComments(n, path)
610 }
611 sci.newLoc(n.Name, append(path, internal.MethodNameTag))
612 if n.Input.Stream != nil {
613 sci.newLoc(n.Input.Stream, append(path, internal.MethodInputStreamTag))
614 }
615 sci.newLoc(n.Input.MessageType, append(path, internal.MethodInputTag))
616 if n.Output.Stream != nil {
617 sci.newLoc(n.Output.Stream, append(path, internal.MethodOutputStreamTag))
618 }
619 sci.newLoc(n.Output.MessageType, append(path, internal.MethodOutputTag))
620
621 optsPath := path
622 optsPath = append(optsPath, internal.MethodOptionsTag)
623 var optIndex int32
624 for _, decl := range n.Decls {
625 if opt, ok := decl.(*ast.OptionNode); ok {
626 generateSourceCodeInfoForOption(opts, sci, opt, false, &optIndex, optsPath)
627 }
628 }
629}
630
631type sourceCodeInfo struct {
632 file *ast.FileNode

Callers 1

Calls 4

newLocWithCommentsMethod · 0.80
newLocMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…