MCPcopy Index your code
hub / github.com/expr-lang/expr / NewProgram

Function NewProgram

vm/program.go:34–58  ·  view source on GitHub ↗

NewProgram returns a new Program. It's used by the compiler.

(
	source file.Source,
	node ast.Node,
	locations []file.Location,
	variables int,
	constants []any,
	bytecode []Opcode,
	arguments []int,
	functions []Function,
	debugInfo map[string]string,
	span *Span,
)

Source from the content-addressed store, hash-verified

32
33// NewProgram returns a new Program. It's used by the compiler.
34func NewProgram(
35 source file.Source,
36 node ast.Node,
37 locations []file.Location,
38 variables int,
39 constants []any,
40 bytecode []Opcode,
41 arguments []int,
42 functions []Function,
43 debugInfo map[string]string,
44 span *Span,
45) *Program {
46 return &Program{
47 source: source,
48 node: node,
49 locations: locations,
50 variables: variables,
51 Constants: constants,
52 Bytecode: bytecode,
53 Arguments: arguments,
54 functions: functions,
55 debugInfo: debugInfo,
56 span: span,
57 }
58}
59
60// Source returns origin file.Source.
61func (program *Program) Source() file.Source {

Callers 2

CompileFunction · 0.85

Calls

no outgoing calls

Tested by 1

Used in the wild real call sites across dependent graphs

searching dependent graphs…