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

Method is_inlined_comprehension_context

crates/codegen/src/compile.rs:1047–1058  ·  view source on GitHub ↗

Check if this is an inlined comprehension context (PEP 709). PEP 709: Inline comprehensions in function-like scopes. TODO: Module/class scope inlining needs more work (Cell name resolution edge cases). Generator expressions are never inlined.

(&self, comprehension_type: ComprehensionType)

Source from the content-addressed store, hash-verified

1045 /// TODO: Module/class scope inlining needs more work (Cell name resolution edge cases).
1046 /// Generator expressions are never inlined.
1047 fn is_inlined_comprehension_context(&self, comprehension_type: ComprehensionType) -> bool {
1048 if comprehension_type == ComprehensionType::Generator {
1049 return false;
1050 }
1051 if !self.ctx.in_func() {
1052 return false;
1053 }
1054 self.symbol_table_stack
1055 .last()
1056 .and_then(|t| t.sub_tables.get(t.next_sub_table))
1057 .is_some_and(|st| st.comp_inlined)
1058 }
1059
1060 /// Enter a new scope
1061 // = compiler_enter_scope

Callers 1

compile_comprehensionMethod · 0.80

Calls 3

in_funcMethod · 0.80
lastMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected