MCPcopy Index your code
hub / github.com/RustPython/RustPython / exit_scope

Method exit_scope

crates/codegen/src/compile.rs:1345–1358  ·  view source on GitHub ↗

compiler_exit_scope

(&mut self)

Source from the content-addressed store, hash-verified

1343
1344 // compiler_exit_scope
1345 fn exit_scope(&mut self) -> CodeObject {
1346 let _table = self.pop_symbol_table();
1347
1348 // Various scopes can have sub_tables:
1349 // - ast::TypeParams scope can have sub_tables (the function body's symbol table)
1350 // - Module scope can have sub_tables (for TypeAlias scopes, nested functions, classes)
1351 // - Function scope can have sub_tables (for nested functions, classes)
1352 // - Class scope can have sub_tables (for nested classes, methods)
1353
1354 let pop = self.code_stack.pop();
1355 let stack_top = compiler_unwrap_option(self, pop);
1356 // No parent scope stack to maintain
1357 unwrap_internal(self, stack_top.finalize_code(&self.opts))
1358 }
1359
1360 /// Exit annotation scope - similar to exit_scope but restores annotation_block to parent
1361 fn exit_annotation_scope(&mut self, saved_ctx: CompileContext) -> CodeObject {

Callers 13

compile_programFunction · 0.80
compile_program_singleFunction · 0.80
compile_block_expressionFunction · 0.80
compile_expressionFunction · 0.80
compile_statementMethod · 0.80
compile_function_bodyMethod · 0.80
compile_function_defMethod · 0.80
compile_class_bodyMethod · 0.80
compile_class_defMethod · 0.80
compile_expressionMethod · 0.80
compile_comprehensionMethod · 0.80

Calls 5

compiler_unwrap_optionFunction · 0.85
unwrap_internalFunction · 0.85
pop_symbol_tableMethod · 0.80
finalize_codeMethod · 0.80
popMethod · 0.45

Tested by

no test coverage detected