Add symboltable scope for comprehensions. Add _ast module nodes for comprehensions.

This commit is contained in:
Windel Bouwman 2019-09-01 22:31:16 +02:00
parent efecef9d48
commit 024cf5db04
2 changed files with 34 additions and 1 deletions

View file

@ -1782,6 +1782,7 @@ impl<O: OutputStream> Compiler<O> {
line_number,
name.clone(),
));
self.enter_scope();
// Create empty object of proper type:
match kind {
@ -1891,6 +1892,9 @@ impl<O: OutputStream> Compiler<O> {
// Fetch code for listcomp function:
let code = self.pop_code_object();
// Pop scope
self.leave_scope();
// List comprehension code:
self.emit(Instruction::LoadConst {
value: bytecode::Constant::Code {