mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-21 04:49:04 +00:00
reflect: delete incorrect optimization
This commit is contained in:
committed by
Ayke van Laethem
parent
368abeeb9a
commit
6c9e55bd06
+2
-9
@@ -126,15 +126,8 @@ type typeCodeAssignmentState struct {
|
|||||||
// that is ever stored in an interface. It tries to use the smallest possible
|
// that is ever stored in an interface. It tries to use the smallest possible
|
||||||
// numbers to make the code that works with interfaces as small as possible.
|
// numbers to make the code that works with interfaces as small as possible.
|
||||||
func (c *Compiler) assignTypeCodes(typeSlice typeInfoSlice) {
|
func (c *Compiler) assignTypeCodes(typeSlice typeInfoSlice) {
|
||||||
fn := c.mod.NamedFunction("reflect.ValueOf")
|
// if reflect were not used, we could skip generating the sidetable
|
||||||
if fn.IsNil() {
|
// this does not help in practice, and is difficult to do correctly
|
||||||
// reflect.ValueOf is never used, so we can use the most efficient
|
|
||||||
// encoding possible.
|
|
||||||
for i, t := range typeSlice {
|
|
||||||
t.num = uint64(i + 1)
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Assign typecodes the way the reflect package expects.
|
// Assign typecodes the way the reflect package expects.
|
||||||
state := typeCodeAssignmentState{
|
state := typeCodeAssignmentState{
|
||||||
|
|||||||
Reference in New Issue
Block a user