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

Method push_output

crates/codegen/src/compile.rs:1310–1342  ·  view source on GitHub ↗
(
        &mut self,
        flags: bytecode::CodeFlags,
        posonlyarg_count: u32,
        arg_count: u32,
        kwonlyarg_count: u32,
        obj_name: String,
    )

Source from the content-addressed store, hash-verified

1308 }
1309
1310 fn push_output(
1311 &mut self,
1312 flags: bytecode::CodeFlags,
1313 posonlyarg_count: u32,
1314 arg_count: u32,
1315 kwonlyarg_count: u32,
1316 obj_name: String,
1317 ) -> CompileResult<()> {
1318 // First push the symbol table
1319 let table = self.push_symbol_table()?;
1320 let scope_type = table.typ;
1321
1322 // The key is the current position in the symbol table stack
1323 let key = self.symbol_table_stack.len() - 1;
1324
1325 // Get the line number
1326 let lineno = self.get_source_line_number().get();
1327
1328 // Call enter_scope which does most of the work
1329 self.enter_scope(&obj_name, scope_type, key, lineno.to_u32())?;
1330
1331 // Override the values that push_output sets explicitly
1332 // enter_scope sets default values based on scope_type, but push_output
1333 // allows callers to specify exact values
1334 if let Some(info) = self.code_stack.last_mut() {
1335 // Preserve NESTED flag set by enter_scope
1336 info.flags = flags | (info.flags & bytecode::CodeFlags::NESTED);
1337 info.metadata.argcount = arg_count;
1338 info.metadata.posonlyargcount = posonlyarg_count;
1339 info.metadata.kwonlyargcount = kwonlyarg_count;
1340 }
1341 Ok(())
1342 }
1343
1344 // compiler_exit_scope
1345 fn exit_scope(&mut self) -> CodeObject {

Callers 4

enter_functionMethod · 0.80
compile_function_defMethod · 0.80
compile_class_defMethod · 0.80
compile_comprehensionMethod · 0.80

Calls 6

push_symbol_tableMethod · 0.80
lenMethod · 0.45
getMethod · 0.45
enter_scopeMethod · 0.45
to_u32Method · 0.45

Tested by

no test coverage detected