@@ -109,36 +109,43 @@ class QAST::Node {
109
109
if nqp :: chars ($ extra ) {
110
110
nqp :: push (@ chunks , " ($ extra )" );
111
111
}
112
+ nqp :: push (@ chunks , ' ' );
113
+ nqp :: push (@ chunks , self . dump_annotations);
114
+ if (self . node) {
115
+ nqp :: push (@ chunks , ' ' );
116
+ my $ escaped_node := nqp ::escape(self . node);
117
+ nqp :: push (@ chunks , nqp :: substr ($ escaped_node , 0 , 50 ));
118
+ if (nqp :: chars ($ escaped_node ) > 50 ) {
119
+ nqp :: push (@ chunks , " ..." );
120
+ }
121
+ }
122
+ nqp :: push (@ chunks , " \n " );
123
+ self . dump_children($ indent + 2 , @ chunks );
124
+ return join (' ' , @ chunks );
125
+ }
126
+
127
+ method dump_annotations () {
128
+ my @ anns ;
112
129
if nqp ::ishash(% ! annotations ) {
113
130
for % ! annotations {
114
131
my $ k := $ _ . key ;
115
- nqp :: push (@ chunks , ' :' ~ $ k );
116
132
my $ v := $ _ . value ;
117
133
try {
118
134
if nqp ::isconcrete($ v ) {
119
- if $ k eq ' context' {
120
- nqp :: push (@ chunks , ' <' ~ $ v ~ ' >' );
135
+ if $ k eq ' context' || $ k eq ' IN_DECL ' || $ k eq ' BY ' {
136
+ nqp :: push (@ anns , ' : ' ~ $ k ~ ' <' ~ $ v ~ ' >' );
121
137
}
122
138
elsif $ k eq ' sink_ok' || $ k eq ' WANTED' || $ k eq ' final' {
139
+ nqp :: push (@ anns , ' :' ~ $ k );
123
140
}
124
141
else { # dunno how to introspect
125
- nqp :: push (@ chunks , ' <?>' );
142
+ nqp :: push (@ anns , ' : ' ~ $ k ~ ' <?>' );
126
143
}
127
144
}
128
145
}
129
146
}
130
147
}
131
- if (self . node) {
132
- nqp :: push (@ chunks , ' ' );
133
- my $ escaped_node := nqp ::escape(self . node);
134
- nqp :: push (@ chunks , nqp :: substr ($ escaped_node , 0 , 50 ));
135
- if (nqp :: chars ($ escaped_node ) > 50 ) {
136
- nqp :: push (@ chunks , " ..." );
137
- }
138
- }
139
- nqp :: push (@ chunks , " \n " );
140
- self . dump_children($ indent + 2 , @ chunks );
141
- return join (' ' , @ chunks );
148
+ nqp :: join (' ' ,@ anns );
142
149
}
143
150
144
151
method dump_children (int $ indent , @ onto ) { }
0 commit comments