src/basilisp/lang/compiler/generator.py
def __deftype_method_recur_to_py_ast(
    ctx: GeneratorContext, node: Recur
) -> GeneratedPyAST:
    """Return a Python AST node for `recur` occurring inside a `deftype*` method."""
    assert node.op == NodeOp.RECUR
    recur_nodes: List[ast.AST] = []
    recur_deps: List[ast.AST] = []
    for expr in node.exprs:
        expr_ast = gen_py_ast(ctx, expr)
        recur_nodes.append(expr_ast.node)
        recur_deps.extend(expr_ast.dependencies)

    this_entry = ctx.symbol_table.find_symbol(ctx.current_this)
    assert this_entry is not None, "Field type local must have this"

    return GeneratedPyAST(
        node=ast.Call(
            func=_TRAMPOLINE_ARGS_FN_NAME,
            args=list(
                chain(
                    [
                        ast.NameConstant(ctx.recur_point.is_variadic),
                        ast.Name(id=this_entry.munged, ctx=ast.Load()),
                    ],
                    recur_nodes,
                )
            ),
            keywords=[],
        ),
        dependencies=recur_deps,
    )
def __deftype_method_recur_to_py_ast(
    ctx: GeneratorContext, node: Recur
) -> GeneratedPyAST:
    """Return a Python AST node for `recur` occurring inside a `deftype*` method."""
    assert node.op == NodeOp.RECUR
    recur_nodes: List[ast.AST] = []
    recur_deps: List[ast.AST] = []
    for expr in node.exprs:
        expr_ast = gen_py_ast(ctx, expr)
        recur_nodes.append(expr_ast.node)
        recur_deps.extend(expr_ast.dependencies)

    this_entry = ctx.symbol_table.find_symbol(ctx.current_this)
    assert this_entry is not None, "Field type local must have this"

    return GeneratedPyAST(
        node=ast.Call(
            func=_TRAMPOLINE_ARGS_FN_NAME,
            args=list(
                chain(
                    [
                        ast.NameConstant(ctx.recur_point.is_variadic),
                        ast.Name(id=this_entry.munged, ctx=ast.Load()),
                    ],
                    recur_nodes,
                )
            ),
            keywords=[],
        ),
        dependencies=recur_deps,
    )
def __deftype_method_recur_to_py_ast ( ctx : GeneratorContext , node : Recur ) -> GeneratedPyAST : assert node . op == NodeOp . RECUR recur_nodes : List [ ast . AST ] = [ ] recur_deps : List [ ast . AST ] = [ ] for expr in node . exprs : expr_ast = gen_py_ast ( ctx , expr ) recur_nodes . append ( expr_ast . node ) recur_deps . extend ( expr_ast . dependencies ) this_entry = ctx . symbol_table . find_symbol ( ctx . current_this ) assert this_entry is not None , "Field type local must have this" return GeneratedPyAST ( node = ast . Call ( func = _TRAMPOLINE_ARGS_FN_NAME , args = list ( chain ( [ ast . NameConstant ( ctx . recur_point . is_variadic ) , ast . Name ( id = this_entry . munged , ctx = ast . Load ( ) ) , ] , recur_nodes , ) ) , keywords = [ ] , ) , dependencies = recur_deps , )
Return a Python AST node for `recur` occurring inside a `deftype*` method.
Return a Python AST node for recur occurring inside a deftype * method .