Skip to content

Commit 3b760dc

Browse files
committed
Add docs
1 parent 971005b commit 3b760dc

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

src/libasr/pass/pass_compare.cpp

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,19 @@ class CompareExprReplacer : public ASR::BaseExprReplacer<CompareExprReplacer>
215215
compare_func_map[tuple_type_name] = fn_sym;
216216
}
217217

218+
/*
219+
This function replaces `TupleCompare` with a `FunctionCall` which returns
220+
the True if both the Tuples are equal or else returns False.
221+
Converts:
222+
a: tuple[i32, i32]
223+
b: tuple[i32, i32]
224+
assert a == b
225+
226+
to:
227+
a: tuple[i32, i32]
228+
b: tuple[i32, i32]
229+
assert _lcompilers_tuple_compare(a, b)
230+
*/
218231
void replace_TupleCompare(const ASR::TupleCompare_t* x) {
219232
Location loc = x->base.base.loc;
220233
ASR::ttype_t* bool_type = ASRUtils::TYPE(ASR::make_Logical_t(
@@ -393,6 +406,19 @@ class CompareExprReplacer : public ASR::BaseExprReplacer<CompareExprReplacer>
393406
compare_func_map[list_type_name] = fn_sym;
394407
}
395408

409+
/*
410+
This function replaces `ListCompare` with a `FunctionCall` which returns
411+
the True if both the lists are equal or else returns False.
412+
Converts:
413+
a: list[i32]
414+
b: list[i32]
415+
assert a == b
416+
417+
to:
418+
a: list[i32]
419+
b: list[i32]
420+
assert _lcompilers_list_compare(a, b)
421+
*/
396422
void replace_ListCompare(const ASR::ListCompare_t* x) {
397423
Location loc = x->base.base.loc;
398424
ASR::ttype_t* bool_type = ASRUtils::TYPE(ASR::make_Logical_t(

0 commit comments

Comments
 (0)