Update dependencies/vendor (#1659)

This commit is contained in:
Wim
2021-12-12 00:05:15 +01:00
committed by GitHub
parent 658bdd9faa
commit 3893a035be
214 changed files with 8892 additions and 5650 deletions

View File

@@ -12,7 +12,7 @@ import (
// Script can simplify compilation and execution of embedded scripts.
type Script struct {
variables map[string]*Variable
modules *ModuleMap
modules ModuleGetter
input []byte
maxAllocs int64
maxConstObjects int
@@ -54,7 +54,7 @@ func (s *Script) Remove(name string) bool {
}
// SetImports sets import modules.
func (s *Script) SetImports(modules *ModuleMap) {
func (s *Script) SetImports(modules ModuleGetter) {
s.modules = modules
}
@@ -219,6 +219,18 @@ func (c *Compiled) RunContext(ctx context.Context) (err error) {
v := NewVM(c.bytecode, c.globals, c.maxAllocs)
ch := make(chan error, 1)
go func() {
defer func() {
if r := recover(); r != nil {
switch e := r.(type) {
case string:
ch <- fmt.Errorf(e)
case error:
ch <- e
default:
ch <- fmt.Errorf("unknown panic: %v", e)
}
}
}()
ch <- v.Run()
}()