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

Method compile_keywords

crates/codegen/src/compile.rs:8272–8303  ·  view source on GitHub ↗
(&mut self, keywords: &[ast::Keyword])

Source from the content-addressed store, hash-verified

8270 }
8271
8272 fn compile_keywords(&mut self, keywords: &[ast::Keyword]) -> CompileResult<()> {
8273 let mut size = 0;
8274 let groupby = keywords.iter().chunk_by(|e| e.arg.is_none());
8275 for (is_unpacking, sub_keywords) in &groupby {
8276 if is_unpacking {
8277 for keyword in sub_keywords {
8278 self.compile_expression(&keyword.value)?;
8279 size += 1;
8280 }
8281 } else {
8282 let mut sub_size = 0;
8283 for keyword in sub_keywords {
8284 if let Some(name) = &keyword.arg {
8285 self.emit_load_const(ConstantData::Str {
8286 value: name.as_str().into(),
8287 });
8288 self.compile_expression(&keyword.value)?;
8289 sub_size += 1;
8290 }
8291 }
8292 emit!(self, Instruction::BuildMap { count: sub_size });
8293 size += 1;
8294 }
8295 }
8296 if size > 1 {
8297 // Merge all dicts: first dict is accumulator, merge rest into it
8298 for _ in 1..size {
8299 emit!(self, Instruction::DictMerge { i: 1 });
8300 }
8301 }
8302 Ok(())
8303 }
8304
8305 fn detect_builtin_generator_call(
8306 &self,

Callers 1

compile_class_defMethod · 0.80

Calls 5

compile_expressionMethod · 0.80
emit_load_constMethod · 0.80
iterMethod · 0.45
is_noneMethod · 0.45
as_strMethod · 0.45

Tested by

no test coverage detected