MCPcopy
hub / github.com/google/go-jsonnet / SnippetToAST

Function SnippetToAST

internal/program/program.go:10–24  ·  view source on GitHub ↗

SnippetToAST converts a Jsonnet code snippet to a desugared and analyzed AST.

(diagnosticFilename ast.DiagnosticFileName, importedFilename, snippet string)

Source from the content-addressed store, hash-verified

8
9// SnippetToAST converts a Jsonnet code snippet to a desugared and analyzed AST.
10func SnippetToAST(diagnosticFilename ast.DiagnosticFileName, importedFilename, snippet string) (ast.Node, error) {
11 node, _, err := parser.SnippetToRawAST(diagnosticFilename, importedFilename, snippet)
12 if err != nil {
13 return nil, err
14 }
15 err = desugarAST(&node)
16 if err != nil {
17 return nil, err
18 }
19 err = analyze(node)
20 if err != nil {
21 return nil, err
22 }
23 return node, nil
24}

Callers 5

evaluateSnippetMethod · 0.92
SnippetToASTFunction · 0.92
importASTMethod · 0.92
codeToPVFunction · 0.92
mainFunction · 0.92

Calls 3

SnippetToRawASTFunction · 0.92
desugarASTFunction · 0.85
analyzeFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…