File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -147,6 +147,37 @@ class QAST::Compiler is HLL::Compiler {
147
147
QAST ::Operations. compile_op(self , ' ' , $ node )
148
148
}
149
149
150
+ multi method as_post (QAST ::Var $ node ) {
151
+ my $ scope := $ node . scope;
152
+ my $ decl := $ node . decl;
153
+
154
+ # Handle any declarations; after this, we call through to the
155
+ # lookup code.
156
+ if $ decl {
157
+ # If it's a parameter, add it to the things we should bind
158
+ # at block entry.
159
+ if $ node . decl eq ' param' {
160
+ $ * BLOCK . add_param($ node );
161
+ }
162
+ elsif $ decl ne ' var' {
163
+ pir::die(" Don't understand declaration type '$ decl '" );
164
+ }
165
+
166
+ # Register storage.
167
+ if $ scope eq ' local' {
168
+ $ * BLOCK . add_local($ node );
169
+ }
170
+ elsif $ scope eq ' lexical' {
171
+ $ * BLOCK . add_lexical($ node );
172
+ }
173
+ else {
174
+ pir::die(" Cannot declare $ decl of scope '$ scope '; use 'local' or 'lexical'" );
175
+ }
176
+ }
177
+
178
+ pir::die(" QAST::Var NYI" );
179
+ }
180
+
150
181
multi method as_post (QAST ::IVal $ node ) {
151
182
self . post_new(' Ops' , : result(~ $ node . value ))
152
183
}
You can’t perform that action at this time.
0 commit comments