# partial_eval_inlining

URL: /kida/api/compiler/partial_eval_inlining/
Section: compiler
Description: Small component call inlining for partial evaluation.

---

> For a complete page index, fetch /kida/llms.txt.

Open LLM text
(/kida/api/compiler/partial_eval_inlining/index.txt)

Share with AI

Ask Claude
(https://claude.ai/new?q=Please%20help%20me%20understand%20this%20documentation%3A%20%2Fkida%2Fapi%2Fcompiler%2Fpartial_eval_inlining%2Findex.txt)

Ask ChatGPT
(https://chatgpt.com/?q=Please%20help%20me%20understand%20this%20documentation%3A%20%2Fkida%2Fapi%2Fcompiler%2Fpartial_eval_inlining%2Findex.txt)

Ask Gemini
(https://gemini.google.com/app?q=Please%20help%20me%20understand%20this%20documentation%3A%20%2Fkida%2Fapi%2Fcompiler%2Fpartial_eval_inlining%2Findex.txt)

Ask Copilot
(https://copilot.microsoft.com/?q=Please%20help%20me%20understand%20this%20documentation%3A%20%2Fkida%2Fapi%2Fcompiler%2Fpartial_eval_inlining%2Findex.txt)

Module

#
`compiler.partial_eval_inlining`

Small component call inlining for partial evaluation.

1Class

## Classes

`ComponentInliningMixin`

9

▼

Partial-evaluator phase for small statically bound component calls.

Partial-evaluator phase for small statically bound component calls.

#### Attributes

Name
Type
Description

`_ctx`

`dict[str, Any]`

—

`_defs`

`dict[str, Def]`

—

#### Methods

Internal Methods
7

▼

`_try_eval`

2

`Any`

▼

Evaluate an expression against the current static context.

abstract

`def _try_eval(self, expr: Expr, depth: int = 0) -> Any`

##### Parameters

Name
Type
Description

`expr`
`—`

`depth`
`—`

Default:`0`

##### Returns

`Any`

`_transform_body`

1

`Sequence[Node]`

▼

Transform a sequence of template nodes.

abstract

`def _transform_body(self, body: Sequence[Node]) -> Sequence[Node]`

##### Parameters

Name
Type
Description

`body`
`—`

##### Returns

`Sequence[Node]`

`_make_sub_evaluator`

1

`Self`

▼

Create an evaluator that shares this evaluator's configuration.

abstract

`def _make_sub_evaluator(self, ctx: dict[str, Any]) -> Self`

##### Parameters

Name
Type
Description

`ctx`
`—`

##### Returns

`Self`

`_try_inline_call`

1

`Node | None`

▼

Expand a small, slot-free component call when all args resolve.

`def _try_inline_call(self, node: CallBlock) -> Node | None`

##### Parameters

Name
Type
Description

`node`
`—`

##### Returns

`Node | None`

`_slot_body_is_empty`

1

`bool`

▼

Return whether a provided slot contains only whitespace data.

staticmethod

`def _slot_body_is_empty(body: Sequence[Node]) -> bool`

##### Parameters

Name
Type
Description

`body`
`—`

##### Returns

`bool`

`_count_nodes`

1

`int`

▼

Count nodes for the component inlining size guard.

staticmethod

`def _count_nodes(body: Sequence[Node]) -> int`

##### Parameters

Name
Type
Description

`body`
`—`

##### Returns

`int`

`_has_slot`

1

`bool`

▼

Return whether a component body recursively declares a slot.

staticmethod

`def _has_slot(body: Sequence[Node]) -> bool`

##### Parameters

Name
Type
Description

`body`
`—`

##### Returns

`bool`
