interp: fix creation of binary composite types (#1391)
* interp: fix creation of binary composite types Use direct assignment instead of reflect.Value Set method to initialize a binary composite type, as for non binary types. It ensures that a new reflect.Value is stored in the frame instead of modifying a possibly existing one, which can defeat the purpose of initializing variables in a body loop. While there, remove the need to have and use a mutex on types. Fixes #1381. * review: rework a bit the test Co-authored-by: mpl <mathieu.lonjaret@gmail.com>
This commit is contained in:
@@ -7,7 +7,6 @@ import (
|
||||
"reflect"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"github.com/traefik/yaegi/internal/unsafe2"
|
||||
)
|
||||
@@ -110,7 +109,6 @@ type structField struct {
|
||||
|
||||
// itype defines the internal representation of types in the interpreter.
|
||||
type itype struct {
|
||||
mu *sync.Mutex
|
||||
cat tcat // Type category
|
||||
field []structField // Array of struct fields if structT or interfaceT
|
||||
key *itype // Type of key element if MapT or nil
|
||||
|
||||
Reference in New Issue
Block a user