|
@@ -618,11 +618,16 @@ func (vm *VM) AddTrace(err error) error {
|
|
}
|
|
}
|
|
|
|
|
|
func (vm *VM) CallCallable(callable Callable, arguments ...Value) []Value {
|
|
func (vm *VM) CallCallable(callable Callable, arguments ...Value) []Value {
|
|
- // defer vm.PopFrame()
|
|
|
|
|
|
+ defer vm.PopFrame()
|
|
defer vm.PopScope()
|
|
defer vm.PopScope()
|
|
- // vm.PushNewFrame(callable.Position())
|
|
|
|
|
|
+ vm.PushNewFrame(callable.Position())
|
|
vm.PushNewScope()
|
|
vm.PushNewScope()
|
|
- return callable.Call(vm, arguments...)
|
|
|
|
|
|
+ result := callable.Call(vm, arguments...)
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ return result
|
|
}
|
|
}
|
|
|
|
|
|
func (vm *VM) CallNamed(name string, arguments ...Value) []Value {
|
|
func (vm *VM) CallNamed(name string, arguments ...Value) []Value {
|
|
@@ -723,9 +728,6 @@ func (vm *VM) RunChildren(ast Ast, args ...Value) []Value {
|
|
*/
|
|
*/
|
|
result := []Value{}
|
|
result := []Value{}
|
|
for _, child := range ast.Children() {
|
|
for _, child := range ast.Children() {
|
|
- position := ast.Token().Position
|
|
|
|
- vm.PushNewFrame(&position)
|
|
|
|
- defer vm.PopFrame()
|
|
|
|
val := child.Run(vm, args...)
|
|
val := child.Run(vm, args...)
|
|
|
|
|
|
if vm.Frame.returned || vm.Frame.failed {
|
|
if vm.Frame.returned || vm.Frame.failed {
|
|
@@ -756,9 +758,6 @@ func (vm *VM) RunChildren(ast Ast, args ...Value) []Value {
|
|
func (vm *VM) RunChildrenLastResult(ast Ast, args ...Value) Value {
|
|
func (vm *VM) RunChildrenLastResult(ast Ast, args ...Value) Value {
|
|
var result Value = EmptyValue{}
|
|
var result Value = EmptyValue{}
|
|
for _, child := range ast.Children() {
|
|
for _, child := range ast.Children() {
|
|
- position := ast.Token().Position
|
|
|
|
- vm.PushNewFrame(&position)
|
|
|
|
- defer vm.PopFrame()
|
|
|
|
|
|
|
|
val := child.Run(vm, args...)
|
|
val := child.Run(vm, args...)
|
|
|
|
|
|
@@ -792,9 +791,6 @@ func (vm *VM) RunChildrenLastResult(ast Ast, args ...Value) Value {
|
|
func (vm *VM) RunChildrenFirstResult(ast Ast, args ...Value) Value {
|
|
func (vm *VM) RunChildrenFirstResult(ast Ast, args ...Value) Value {
|
|
var result Value = EmptyValue{}
|
|
var result Value = EmptyValue{}
|
|
for _, child := range ast.Children() {
|
|
for _, child := range ast.Children() {
|
|
- position := ast.Token().Position
|
|
|
|
- vm.PushNewFrame(&position)
|
|
|
|
- defer vm.PopFrame()
|
|
|
|
|
|
|
|
val := child.Run(vm, args...)
|
|
val := child.Run(vm, args...)
|
|
|
|
|