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

Method finish_fstring

crates/codegen/src/compile.rs:10007–10029  ·  view source on GitHub ↗
(
        &mut self,
        mut pending_literal: Option<Wtf8Buf>,
        mut element_count: u32,
    )

Source from the content-addressed store, hash-verified

10005 }
10006
10007 fn finish_fstring(
10008 &mut self,
10009 mut pending_literal: Option<Wtf8Buf>,
10010 mut element_count: u32,
10011 ) -> CompileResult<()> {
10012 let keep_empty = element_count == 0;
10013 self.emit_pending_fstring_literal(&mut pending_literal, &mut element_count, keep_empty);
10014
10015 if element_count == 0 {
10016 self.emit_load_const(ConstantData::Str {
10017 value: Wtf8Buf::new(),
10018 });
10019 } else if element_count > 1 {
10020 emit!(
10021 self,
10022 Instruction::BuildString {
10023 count: element_count
10024 }
10025 );
10026 }
10027
10028 Ok(())
10029 }
10030
10031 fn emit_pending_fstring_literal(
10032 &mut self,

Callers 2

compile_expr_fstringMethod · 0.80

Calls 3

newFunction · 0.85
emit_load_constMethod · 0.80

Tested by

no test coverage detected