Module

compiler.callable_plans

Immutable semantic plans for callable lowering.

Classes

CallableParameterPlan 2
One callable parameter before Python AST assembly.

One callable parameter before Python AST assembly.

Attributes

Name Type Description
name str
annotation str | None
CallableSignaturePlan 8
Semantic callable signature shared by def and region lowering.

Semantic callable signature shared by def and region lowering.

Attributes

Name Type Description
public_name str
function_name str
parameters tuple[CallableParameterPlan, ...]
parameter_names tuple[str, ...]
bound_names tuple[str, ...]
default_parameter_names tuple[str, ...]
vararg str | None
kwarg str | None
CallSlotPlan 4
One call-block slot before callback AST assembly.

One call-block slot before callback AST assembly.

Attributes

Name Type Description
name str
function_name str
body tuple[Node, ...]
delegates_when_nested bool
CallBlockPlan 3
Ordered slot callbacks for one call block.

Ordered slot callbacks for one call block.

Attributes

Name Type Description
call Expr
slots tuple[CallSlotPlan, ...]
slot_function_items tuple[tuple[str, str], ...]
SlotBindingPlan 2
One scoped binding passed from a slot placeholder.

One scoped binding passed from a slot placeholder.

Attributes

Name Type Description
name str
expression Expr
SlotRenderPlan 4
Slot placeholder semantics before expression and body lowering.

Slot placeholder semantics before expression and body lowering.

Attributes

Name Type Description
name str
bindings tuple[SlotBindingPlan, ...]
binding_names tuple[str, ...]
body tuple[Node, ...]

Functions

plan_def_signature 1 CallableSignaturePlan
Build the immutable signature plan for a template def.
def plan_def_signature(node: Def) -> CallableSignaturePlan
Parameters
Name Type Description
node Def
Returns
CallableSignaturePlan
plan_region_signature 2 CallableSignaturePlan
Build the immutable signature plan for a template region.
def plan_region_signature(node: Region, *, emitted_name: str | None = None) -> CallableSignaturePlan
Parameters
Name Type Description
node Region
emitted_name str | None Default:None
Returns
CallableSignaturePlan
_slot_body_is_empty 1 bool
Treat whitespace-only data as an empty slot body.
def _slot_body_is_empty(body: tuple[Node, ...]) -> bool
Parameters
Name Type Description
body tuple[Node, ...]
Returns
bool
plan_call_block 1 CallBlockPlan
Build ordered immutable callback plans for a call block.
def plan_call_block(node: CallBlock) -> CallBlockPlan
Parameters
Name Type Description
node CallBlock
Returns
CallBlockPlan
_plan_call_slot 2 CallSlotPlan
Build one slot plan after freezing its body sequence.
def _plan_call_slot(name: str, body: tuple[Node, ...]) -> CallSlotPlan
Parameters
Name Type Description
name str
body tuple[Node, ...]
Returns
CallSlotPlan
plan_slot_render 1 SlotRenderPlan
Build the immutable binding and body plan for a slot placeholder.
def plan_slot_render(node: Slot) -> SlotRenderPlan
Parameters
Name Type Description
node Slot
Returns
SlotRenderPlan