@@ -1339,14 +1339,14 @@ func buildObject(hide ast.ObjectFieldHide, fields map[string]value) *valueObject
1339
1339
return makeValueSimpleObject (bindingFrame {}, fieldMap , nil , nil )
1340
1340
}
1341
1341
1342
- func buildInterpreter (ext vmExtMap , nativeFuncs map [ string ] * NativeFunction , maxStack int , ic * importCache , traceOut io. Writer , evalHook EvalHook , profilerOpts StackProfilerOpts ) (* interpreter , error ) {
1342
+ func buildInterpreter (vm * VM ) (* interpreter , error ) {
1343
1343
i := interpreter {
1344
- stack : makeCallStack (maxStack ),
1345
- importCache : ic ,
1346
- traceOut : traceOut ,
1347
- nativeFuncs : nativeFuncs ,
1348
- evalHook : evalHook ,
1349
- profilerOpts : profilerOpts ,
1344
+ stack : makeCallStack (vm . MaxStack ),
1345
+ importCache : vm . importCache ,
1346
+ traceOut : vm . traceOut ,
1347
+ nativeFuncs : vm . nativeFuncs ,
1348
+ evalHook : vm . EvalHook ,
1349
+ profilerOpts : vm . profilerOpts ,
1350
1350
}
1351
1351
1352
1352
stdObj , err := buildStdObject (& i )
@@ -1356,7 +1356,7 @@ func buildInterpreter(ext vmExtMap, nativeFuncs map[string]*NativeFunction, maxS
1356
1356
1357
1357
i .baseStd = stdObj
1358
1358
1359
- i .extVars = prepareExtVars (& i , ext , "extvar" )
1359
+ i .extVars = prepareExtVars (& i , vm . ext , "extvar" )
1360
1360
1361
1361
return & i , nil
1362
1362
}
@@ -1419,7 +1419,7 @@ func evaluateAux(i *interpreter, node ast.Node, tla vmExtMap) (value, error) {
1419
1419
1420
1420
// Evaluate ast node with the given VM
1421
1421
func evaluate (node ast.Node , vm * VM ) (string , error ) {
1422
- i , err := buildInterpreter (vm . ext , vm . nativeFuncs , vm . MaxStack , vm . importCache , vm . traceOut , vm . EvalHook , vm . profilerOpts )
1422
+ i , err := buildInterpreter (vm )
1423
1423
if err != nil {
1424
1424
return "" , err
1425
1425
}
@@ -1445,7 +1445,7 @@ func evaluate(node ast.Node, vm *VM) (string, error) {
1445
1445
}
1446
1446
1447
1447
func evaluateMulti (node ast.Node , vm * VM ) (map [string ]string , error ) {
1448
- i , err := buildInterpreter (vm . ext , vm . nativeFuncs , vm . MaxStack , vm . importCache , vm . traceOut , vm . EvalHook , vm . profilerOpts )
1448
+ i , err := buildInterpreter (vm )
1449
1449
if err != nil {
1450
1450
return nil , err
1451
1451
}
@@ -1462,7 +1462,7 @@ func evaluateMulti(node ast.Node, vm *VM) (map[string]string, error) {
1462
1462
}
1463
1463
1464
1464
func evaluateStream (node ast.Node , vm * VM ) ([]string , error ) {
1465
- i , err := buildInterpreter (vm . ext , vm . nativeFuncs , vm . MaxStack , vm . importCache , vm . traceOut , vm . EvalHook , vm . profilerOpts )
1465
+ i , err := buildInterpreter (vm )
1466
1466
if err != nil {
1467
1467
return nil , err
1468
1468
}
0 commit comments