Пример #1
0
def get_tuple_indirection_path_id(tuple_path_id: irast.PathId,
                                  element_name: str,
                                  element_type: s_types.Type, *,
                                  ctx: context.ContextLevel) -> irast.PathId:
    return tuple_path_id.extend(
        ptrcls=irast.TupleIndirectionLink(element_name),
        direction=s_pointers.PointerDirection.Outbound,
        target=element_type,
        schema=ctx.env.schema)
Пример #2
0
def get_tuple_indirection_path_id(
        tuple_path_id: irast.PathId, element_name: str,
        element_type: s_types.Type, *,
        ctx: context.ContextLevel) -> irast.PathId:

    ptrcls = irast.TupleIndirectionLink(
        irtyputils.ir_typeref_to_type(ctx.env.schema, tuple_path_id.target),
        element_type,
        element_name=element_name,
    )

    ptrref = irtyputils.ptrref_from_ptrcls(
        schema=ctx.env.schema,
        ptrcls=ptrcls,
        # FIXME: caching disabled here since it breaks tests
        # cache=ctx.env.ptr_ref_cache,
        # typeref_cache=ctx.env.type_ref_cache,
    )

    return tuple_path_id.extend(schema=ctx.env.schema, ptrref=ptrref)