mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-08 21:13:39 +00:00
compiler: simplify interface lowering
This commit simplifies the IR a little bit: instead of calling pseudo-functions runtime.interfaceImplements and runtime.interfaceMethod, real declared functions are being called that are then defined in the interface lowering pass. This should simplify the interaction between various transformation passes. It also reduces the number of lines of code, which is generally a good thing.
This commit is contained in:
committed by
Ron Evans
parent
90076f9401
commit
a4afc3b4b0
Vendored
+9
@@ -49,6 +49,15 @@ func isStringer(itf interface{}) bool {
|
||||
return ok
|
||||
}
|
||||
|
||||
type fooInterface interface {
|
||||
String() string
|
||||
foo(int) byte
|
||||
}
|
||||
|
||||
func callFooMethod(itf fooInterface) uint8 {
|
||||
return itf.foo(3)
|
||||
}
|
||||
|
||||
func callErrorMethod(itf error) string {
|
||||
return itf.Error()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user