MCPcopy Index your code
hub / github.com/valyala/quicktemplate / parseFuncCall

Function parseFuncCall

parser/functype.go:115–139  ·  view source on GitHub ↗
(b []byte)

Source from the content-addressed store, hash-verified

113}
114
115func parseFuncCall(b []byte) (*funcType, error) {
116 exprStr := string(b)
117 expr, err := goparser.ParseExpr(exprStr)
118 if err != nil {
119 return nil, err
120 }
121 ce, ok := expr.(*ast.CallExpr)
122 if !ok {
123 return nil, fmt.Errorf("missing function call")
124 }
125 callPrefix, name, err := getCallName(ce)
126 if err != nil {
127 return nil, err
128 }
129 argNames := exprStr[ce.Lparen : ce.Rparen-1]
130
131 if len(argNames) > 0 {
132 argNames = ", " + argNames
133 }
134 return &funcType{
135 name: name,
136 callPrefix: callPrefix,
137 argNames: argNames,
138 }, nil
139}
140
141func (f *funcType) DefStream(dst string) string {
142 return fmt.Sprintf("%s%s%s(%s *qt%s.Writer%s)", f.defPrefix, f.prefixStream(), f.name, dst, mangleSuffix, f.args)

Callers 3

parseOutputFuncMethod · 0.85
testParseFuncCallFailureFunction · 0.85
testParseFuncCallSuccessFunction · 0.85

Calls 1

getCallNameFunction · 0.85

Tested by 2

testParseFuncCallFailureFunction · 0.68
testParseFuncCallSuccessFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…