Open jryannel opened 6 months ago
Now you can extend interface using the extends keyword:
interface Common {
}
interface Counter extends Common {
}
or using an external type:
import demo
interface Counter extends demo.Common {
}
name: demo.bbb
version: "1.0"
imports:
- name: demo.aaa
interfaces:
- name: Common
- name: Counter
extends:
name: Common
import: demo.aaa
In the go template we can then access the extends information:
{{- range .Module.Interfaces }}
{{- $class := .Name }}
type {{$class}} interface {
{{- if .HasExtends }}
{{- if .Extends.Import }}
{{camel (splitLast .Extends.Import ".")}}.{{Camel .Extends.Name }}
{{- else }}
{{Camel .Extends.Name }}
{{- end }}
{{- end }}
}
{{- end }}
The idea is to allow interfaces to extend other interfaces.
E.g.
in YAML this would be
For C++ we would extend one interface with another: