Skip to content

Commit

Permalink
Expose Sequence.some types in rt
Browse files Browse the repository at this point in the history
  • Loading branch information
GrieferAtWork committed Dec 15, 2024
1 parent fb04a96 commit cb57f26
Show file tree
Hide file tree
Showing 2 changed files with 107 additions and 0 deletions.
101 changes: 101 additions & 0 deletions src/dex/rt/librt.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ print define_Dee_HashStr("casesplit");
print define_Dee_HashStr("classes");
print define_Dee_HashStr("combinations");
print define_Dee_HashStr("each");
print define_Dee_HashStr("some");
print define_Dee_HashStr("filter");
print define_Dee_HashStr("ubfilter");
print define_Dee_HashStr("findall");
Expand Down Expand Up @@ -175,6 +176,7 @@ print define_Dee_HashStr("__IterWithEnumerateIndexMap__");
#define Dee_HashStr__classes _Dee_HashSelectC(0x75e5899b, 0xc75d2d970415e4a0)
#define Dee_HashStr__combinations _Dee_HashSelectC(0x184d9b51, 0x3e5802b7656c4900)
#define Dee_HashStr__each _Dee_HashSelectC(0x9de8b13d, 0x374e052f37a5e158)
#define Dee_HashStr__some _Dee_HashSelectC(0x26cbddcc, 0x52f55bde7d810221)
#define Dee_HashStr__filter _Dee_HashSelectC(0x3110088a, 0x32e04884df75b1c1)
#define Dee_HashStr__ubfilter _Dee_HashSelectC(0x9f55cd0c, 0xa457507f0faa4d80)
#define Dee_HashStr__findall _Dee_HashSelectC(0xa7064666, 0x73bffde4f31b16e5)
Expand Down Expand Up @@ -1273,6 +1275,93 @@ librt_get_SeqEachCallAttrKwIterator_Type_f(size_t UNUSED(argc), DeeObject *const
}


PRIVATE WUNUSED DREF DeeObject *DCALL
librt_get_SeqSome_stub_instance(void) {
return_cached(DeeObject_GetAttrStringHash(&object_with_size_and_getitem_index, STR_AND_HASH(some)));
}

PRIVATE WUNUSED DREF DeeObject *DCALL
librt_get_SeqSomeOperator_stub_instance(void) {
DREF DeeObject *result;
result = librt_get_SeqSome_stub_instance();
if likely(result) {
DREF DeeObject *temp;
temp = DeeObject_Pos(result);
Dee_Decref(result);
result = temp;
}
return result;
}

PRIVATE WUNUSED DREF DeeObject *DCALL
librt_get_SeqSomeGetAttr_stub_instance(void) {
DREF DeeObject *result;
result = librt_get_SeqSome_stub_instance();
if likely(result) {
DREF DeeObject *temp;
temp = DeeObject_GetAttr(result, (DeeObject *)&str_Iterator);
Dee_Decref(result);
result = temp;
}
return result;
}

PRIVATE WUNUSED DREF DeeObject *DCALL
librt_get_SeqSomeCallAttr_stub_instance(void) {
DREF DeeObject *result;
result = librt_get_SeqSome_stub_instance();
if likely(result) {
DREF DeeObject *temp;
temp = DeeObject_CallAttr(result, (DeeObject *)&str_Iterator, 0, NULL);
Dee_Decref(result);
result = temp;
}
return result;
}

PRIVATE WUNUSED DREF DeeObject *DCALL
librt_get_SeqSomeCallAttrKw_stub_instance(void) {
DREF DeeObject *result;
result = librt_get_SeqSome_stub_instance();
if likely(result) {
DREF DeeObject *temp;
temp = DeeObject_CallAttrKw(result, (DeeObject *)&str_Iterator,
0,
NULL,
Dee_EmptyMapping);
Dee_Decref(result);
result = temp;
}
return result;
}


PRIVATE WUNUSED DREF DeeObject *DCALL
librt_get_SeqSome_Type_f(size_t UNUSED(argc), DeeObject *const *UNUSED(argv)) {
return_cached(get_type_of(librt_get_SeqSome_stub_instance()));
}

PRIVATE WUNUSED DREF DeeObject *DCALL
librt_get_SeqSomeOperator_Type_f(size_t UNUSED(argc), DeeObject *const *UNUSED(argv)) {
return_cached(get_type_of(librt_get_SeqSomeOperator_stub_instance()));
}

PRIVATE WUNUSED DREF DeeObject *DCALL
librt_get_SeqSomeGetAttr_Type_f(size_t UNUSED(argc), DeeObject *const *UNUSED(argv)) {
return_cached(get_type_of(librt_get_SeqSomeGetAttr_stub_instance()));
}

PRIVATE WUNUSED DREF DeeObject *DCALL
librt_get_SeqSomeCallAttr_Type_f(size_t UNUSED(argc), DeeObject *const *UNUSED(argv)) {
return_cached(get_type_of(librt_get_SeqSomeCallAttr_stub_instance()));
}

PRIVATE WUNUSED DREF DeeObject *DCALL
librt_get_SeqSomeCallAttrKw_Type_f(size_t UNUSED(argc), DeeObject *const *UNUSED(argv)) {
return_cached(get_type_of(librt_get_SeqSomeCallAttrKw_stub_instance()));
}


PRIVATE WUNUSED DREF DeeObject *DCALL
librt_get_SeqWithSizeAndGetItemIndex_Type_f(size_t UNUSED(argc), DeeObject *const *UNUSED(argv)) {
return_cached(get_type_of(DeeObject_GetRange(&object_with_size_and_getitem_index, DeeInt_Zero, DeeInt_One)));
Expand Down Expand Up @@ -3257,6 +3346,11 @@ PRIVATE DEFINE_CMETHOD(librt_get_SeqEachCallAttr, &librt_get_SeqEachCallAttr_Typ
PRIVATE DEFINE_CMETHOD(librt_get_SeqEachCallAttrIterator, &librt_get_SeqEachCallAttrIterator_Type_f, METHOD_FCONSTCALL);
PRIVATE DEFINE_CMETHOD(librt_get_SeqEachCallAttrKw, &librt_get_SeqEachCallAttrKw_Type_f, METHOD_FCONSTCALL);
PRIVATE DEFINE_CMETHOD(librt_get_SeqEachCallAttrKwIterator, &librt_get_SeqEachCallAttrKwIterator_Type_f, METHOD_FCONSTCALL);
PRIVATE DEFINE_CMETHOD(librt_get_SeqSome, &librt_get_SeqSome_Type_f, METHOD_FCONSTCALL);
PRIVATE DEFINE_CMETHOD(librt_get_SeqSomeOperator, &librt_get_SeqSomeOperator_Type_f, METHOD_FCONSTCALL);
PRIVATE DEFINE_CMETHOD(librt_get_SeqSomeGetAttr, &librt_get_SeqSomeGetAttr_Type_f, METHOD_FCONSTCALL);
PRIVATE DEFINE_CMETHOD(librt_get_SeqSomeCallAttr, &librt_get_SeqSomeCallAttr_Type_f, METHOD_FCONSTCALL);
PRIVATE DEFINE_CMETHOD(librt_get_SeqSomeCallAttrKw, &librt_get_SeqSomeCallAttrKw_Type_f, METHOD_FCONSTCALL);
PRIVATE DEFINE_CMETHOD(librt_get_SeqEnumWithSizeAndGetItemIndexFast, &librt_get_SeqEnumWithSizeAndGetItemIndexFast_Type_f, METHOD_FCONSTCALL);
PRIVATE DEFINE_CMETHOD(librt_get_SeqEnumWithSizeAndTryGetItemIndex, &librt_get_SeqEnumWithSizeAndTryGetItemIndex_Type_f, METHOD_FCONSTCALL);
PRIVATE DEFINE_CMETHOD(librt_get_SeqEnumWithSizeAndGetItemIndex, &librt_get_SeqEnumWithSizeAndGetItemIndex_Type_f, METHOD_FCONSTCALL);
Expand Down Expand Up @@ -3629,6 +3723,13 @@ PRIVATE struct dex_symbol symbols[] = {
{ "SeqEachCallAttrKw", (DeeObject *)&librt_get_SeqEachCallAttrKw, MODSYM_FREADONLY | MODSYM_FPROPERTY | MODSYM_FCONSTEXPR }, /* SeqEachCallAttrKw_Type */
{ "SeqEachCallAttrKwIterator", (DeeObject *)&librt_get_SeqEachCallAttrKwIterator, MODSYM_FREADONLY | MODSYM_FPROPERTY | MODSYM_FCONSTEXPR }, /* SeqEachCallAttrKwIterator_Type */

/* Seq-some wrapper types. */
{ "SeqSome", (DeeObject *)&librt_get_SeqSome, MODSYM_FREADONLY | MODSYM_FPROPERTY | MODSYM_FCONSTEXPR }, /* SeqSome_Type */
{ "SeqSomeOperator", (DeeObject *)&librt_get_SeqSomeOperator, MODSYM_FREADONLY | MODSYM_FPROPERTY | MODSYM_FCONSTEXPR }, /* SeqSomeOperator_Type */
{ "SeqSomeGetAttr", (DeeObject *)&librt_get_SeqSomeGetAttr, MODSYM_FREADONLY | MODSYM_FPROPERTY | MODSYM_FCONSTEXPR }, /* SeqSomeGetAttr_Type */
{ "SeqSomeCallAttr", (DeeObject *)&librt_get_SeqSomeCallAttr, MODSYM_FREADONLY | MODSYM_FPROPERTY | MODSYM_FCONSTEXPR }, /* SeqSomeCallAttr_Type */
{ "SeqSomeCallAttrKw", (DeeObject *)&librt_get_SeqSomeCallAttrKw, MODSYM_FREADONLY | MODSYM_FPROPERTY | MODSYM_FCONSTEXPR }, /* SeqSomeCallAttrKw_Type */

/* Default enumeration types */
{ "SeqEnumWithSizeAndGetItemIndexFast", (DeeObject *)&librt_get_SeqEnumWithSizeAndGetItemIndexFast, MODSYM_FREADONLY | MODSYM_FPROPERTY | MODSYM_FCONSTEXPR }, /* DefaultEnumeration_WithSizeAndGetItemIndexFast_Type */
{ "SeqEnumWithSizeAndTryGetItemIndex", (DeeObject *)&librt_get_SeqEnumWithSizeAndTryGetItemIndex, MODSYM_FREADONLY | MODSYM_FPROPERTY | MODSYM_FCONSTEXPR }, /* DefaultEnumeration_WithSizeAndTryGetItemIndex_Type */
Expand Down
6 changes: 6 additions & 0 deletions util/test/rt-linkage.dee
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,12 @@ assertRtTypeName("SeqEachCallAttrIterator");
assertRtTypeName("SeqEachCallAttrKw");
assertRtTypeName("SeqEachCallAttrKwIterator");

assertRtTypeName("SeqSome");
assertRtTypeName("SeqSomeOperator");
assertRtTypeName("SeqSomeGetAttr");
assertRtTypeName("SeqSomeCallAttr");
assertRtTypeName("SeqSomeCallAttrKw");

assertRtTypeName("SeqEnumWithSizeAndGetItemIndexFast");
assertRtTypeName("SeqEnumWithSizeAndTryGetItemIndex");
assertRtTypeName("SeqEnumWithSizeAndGetItemIndex");
Expand Down

0 comments on commit cb57f26

Please sign in to comment.