compiler: extend manifest generation with custom types

This commit is contained in:
Evgenii Stratonikov 2020-08-28 11:08:04 +03:00
parent cee1836183
commit 25f8545cdf
2 changed files with 41 additions and 0 deletions

View file

@ -201,6 +201,21 @@ func (c *codegen) scTypeFromExpr(typ ast.Expr) string {
if c.typeOf(typ) == nil {
return "Any"
}
if named, ok := t.(*types.Named); ok {
if isInteropPath(named.String()) {
name := named.Obj().Name()
pkg := named.Obj().Pkg().Name()
switch pkg {
case "blockchain", "contract":
return "Array" // Block, Transaction, Contract
case "interop":
if name != "Interface" {
return name
}
}
return "InteropInterface"
}
}
switch t := t.Underlying().(type) {
case *types.Basic:
info := t.Info()