From 5344bbe0783ddf732f498c9f9d635f342c9381ab Mon Sep 17 00:00:00 2001 From: mappu Date: Sun, 5 Apr 2020 18:24:14 +1200 Subject: [PATCH] stmt/class: support extends (single inheritance) by struct embedding --- node.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/node.go b/node.go index ee8ca85..1e43391 100644 --- a/node.go +++ b/node.go @@ -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) {