mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-18 19:44:00 +00:00
compiler: Fix interface analysis (oops!)
This commit is contained in:
+9
-5
@@ -2,6 +2,8 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"go/types"
|
||||||
|
|
||||||
"golang.org/x/tools/go/ssa"
|
"golang.org/x/tools/go/ssa"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -35,8 +37,10 @@ func (a *Analysis) AddPackage(pkg *ssa.Package) {
|
|||||||
a.addFunction(member)
|
a.addFunction(member)
|
||||||
case *ssa.Type:
|
case *ssa.Type:
|
||||||
ms := pkg.Prog.MethodSets.MethodSet(member.Type())
|
ms := pkg.Prog.MethodSets.MethodSet(member.Type())
|
||||||
for i := 0; i < ms.Len(); i++ {
|
if !types.IsInterface(member.Type()) {
|
||||||
a.addFunction(pkg.Prog.MethodValue(ms.At(i)))
|
for i := 0; i < ms.Len(); i++ {
|
||||||
|
a.addFunction(pkg.Prog.MethodValue(ms.At(i)))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -118,9 +122,9 @@ func (a *Analysis) AnalyseBlockingRecursive() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check whether we need a scheduler. This is only necessary when there are go
|
// Check whether we need a scheduler. A scheduler is only necessary when there
|
||||||
// calls that start blocking functions (if they're not blocking, the go function
|
// are go calls that start blocking functions (if they're not blocking, the go
|
||||||
// can be turned into a regular function call).
|
// function can be turned into a regular function call).
|
||||||
//
|
//
|
||||||
// Depends on AnalyseBlockingRecursive.
|
// Depends on AnalyseBlockingRecursive.
|
||||||
func (a *Analysis) AnalyseGoCalls() {
|
func (a *Analysis) AnalyseGoCalls() {
|
||||||
|
|||||||
Reference in New Issue
Block a user