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)
| 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 |
no test coverage detected