MCPcopy
hub / github.com/google/mangle / VisitTransform

Method VisitTransform

parse/parse.go:368–383  ·  view source on GitHub ↗

VisitTransform visits a parse tree produced by MangleParser#transform.

(ctx *gen.TransformContext)

Source from the content-addressed store, hash-verified

366
367// VisitTransform visits a parse tree produced by MangleParser#transform.
368func (p Parser) VisitTransform(ctx *gen.TransformContext) any {
369 var stmts []ast.TransformStmt
370 if ctx.DO() != nil {
371 term := p.Visit(ctx.Term()).(ast.Term)
372 apply, ok := term.(ast.ApplyFn)
373 if !ok {
374 p.errors.Add(fmt.Sprintf("expected fn application got %v", term), ctx.Term().GetStart().GetLine(), ctx.Term().GetStart().GetColumn())
375 return ast.Transform{}
376 }
377 stmts = append(stmts, ast.TransformStmt{nil, apply})
378 }
379 for _, l := range ctx.AllLetStmt() {
380 stmts = append(stmts, p.Visit(l).(ast.TransformStmt))
381 }
382 return ast.Transform{stmts, nil}
383}
384
385// VisitLetStmt visits a parse tree produced by MangleParser#letStmt.
386func (p Parser) VisitLetStmt(ctx *gen.LetStmtContext) any {

Callers 1

VisitMethod · 0.95

Calls 5

VisitMethod · 0.95
DOMethod · 0.65
TermMethod · 0.65
AddMethod · 0.65
AllLetStmtMethod · 0.65

Tested by

no test coverage detected