Commits

Anonymous committed 32b52a2

fix scope bug for struct/class members

Comments (0)

Files changed (1)

pkg/cxxtypes/types.go

 func (t *StructType) SetMembers(mbrs []Member) error {
 	t.Members = make([]Member, len(mbrs))
 	copy(t.Members, mbrs)
-	err := set_scope(t.Members, t, t.Scope)
+	err := set_scope(t.Members, t, t.Name)
 	if err != nil {
 		return err
 	}
 func (t *ClassType) SetMembers(mbrs []Member) error {
 	t.Members = make([]Member, len(mbrs))
 	copy(t.Members, mbrs)
-	err := set_scope(t.Members, t, t.Scope)
+	err := set_scope(t.Members, t, t.Name)
 	if err != nil {
 		return err
 	}
 	return b.Virtual
 }
 
+// IsPublic returns whether the derivation is public
+func (b *Base) IsPublic() bool {
+	return (b.Access & AS_Public) != 0
+}
+
+func (b *Base) IsProtected() bool {
+	return (b.Access & AS_Protected) != 0
+}
+
+func (b *Base) IsPrivate() bool {
+	return (b.Access & AS_Private) != 0
+}
+
 func (b *Base) String() string {
 	hdr := ""
 	if b.IsVirtual() {