stmt/class: support extends (single inheritance) by struct embedding

This commit is contained in:
mappu 2020-04-05 18:24:14 +12:00
parent 67932cd296
commit 5344bbe078

View File

@ -107,6 +107,15 @@ func convert(n_ node.Node) (string, error) {
memberVars := []string{}
memberFuncs := []string{}
if n.Extends != nil {
parentName, err := resolveName(n.Extends.ClassName)
if err != nil {
return "", parseErr{n, err}
}
memberVars = append(memberVars, parentName+" // parent")
}
// Walk all child nodes of the class
for _, s_ := range n.Stmts {
switch s := s_.(type) {