compiler: add support for type parameters (aka generics)

...that was surprisingly easy.
This commit is contained in:
Ayke van Laethem
2022-06-11 16:25:34 +02:00
committed by Ron Evans
parent 283fed16a5
commit bb65c5ce2b
11 changed files with 83 additions and 17 deletions
+5
View File
@@ -28,6 +28,8 @@ import (
"github.com/tinygo-org/tinygo/goenv"
)
var addInstances func(*types.Info)
// Program holds all packages and some metadata about the program as a whole.
type Program struct {
config *compileopts.Config
@@ -164,6 +166,9 @@ func Load(config *compileopts.Config, inputPkg string, clangHeaders string, type
Selections: make(map[*ast.SelectorExpr]*types.Selection),
},
}
if addInstances != nil {
addInstances(&pkg.info)
}
err := decoder.Decode(&pkg.PackageJSON)
if err != nil {
if err == io.EOF {