File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ knowhow NQPClassHOW {
16
16
has @ ! multi_methods_to_incorporate ;
17
17
has @ ! parents ;
18
18
has @ ! roles ;
19
+ has $ ! default_parent ;
19
20
20
21
# Vtable and mapping of method names to slots.
21
22
has @ ! vtable ;
@@ -46,6 +47,7 @@ knowhow NQPClassHOW {
46
47
47
48
method BUILD (: $ name ) {
48
49
$ ! name := $ name ;
50
+ $ ! default_parent := NQPMu; # XXX Temporary workaround
49
51
}
50
52
51
53
# Create a new meta-class instance, and then a new type object
@@ -99,6 +101,10 @@ knowhow NQPClassHOW {
99
101
}
100
102
@ ! parents [+ @ ! parents ] := $ parent ;
101
103
}
104
+
105
+ method set_default_parent ($ obj , $ parent ) {
106
+ $ ! default_parent := $ parent ;
107
+ }
102
108
103
109
method add_role ($ obj , $ role ) {
104
110
for @ ! roles {
@@ -133,10 +139,10 @@ knowhow NQPClassHOW {
133
139
RoleToClassApplier. apply($ obj , @ instantiated_roles );
134
140
}
135
141
136
- # If we have no parents and we're not called NQPMu then add NQPMu as
137
- # our parent.
142
+ # If we have no parents and we're not called NQPMu then add the
143
+ # default parent.
138
144
if + @ ! parents == 0 && $ ! name ne ' NQPMu' {
139
- self . add_parent($ obj , NQPMu )
145
+ self . add_parent($ obj , $ ! default_parent )
140
146
}
141
147
142
148
# Some things we only do if we weren't already composed once, like building
You can’t perform that action at this time.
0 commit comments