Skip to content

Commit

Permalink
better argument names for StringContains (#2806)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ayush-Devs authored Sep 3, 2024
1 parent 88e2f5a commit 728fb21
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/libasr/ASR.asdl
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ expr
| StringItem(expr arg, expr idx, ttype type, expr? value)
| StringSection(expr arg, expr? start, expr? end, expr? step, ttype type, expr? value)
| StringCompare(expr left, cmpop op, expr right, ttype type, expr? value)
| StringContains(expr left, expr right, ttype type, expr? value)
| StringContains(expr substr, expr str, ttype type, expr? value)
| StringOrd(expr arg, ttype type, expr? value)
| StringChr(expr arg, ttype type, expr? value)
| StringFormat(expr fmt, expr* args, string_format_kind kind, ttype type, expr? value)
Expand Down
4 changes: 2 additions & 2 deletions src/libasr/codegen/asr_to_c_cpp.h
Original file line number Diff line number Diff line change
Expand Up @@ -1246,9 +1246,9 @@ PyMODINIT_FUNC PyInit_lpython_module_)" + fn_name + R"((void) {

void visit_StringContains(const ASR::StringContains_t &x) {
CHECK_FAST_C_CPP(compiler_options, x)
self().visit_expr(*x.m_left);
self().visit_expr(*x.m_substr);
std::string substr = src;
self().visit_expr(*x.m_right);
self().visit_expr(*x.m_str);
std::string str = src;
src = "_lfortran_str_contains(" + str + ", " + substr + ")";
}
Expand Down
4 changes: 2 additions & 2 deletions src/libasr/codegen/asr_to_llvm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6455,10 +6455,10 @@ class ASRToLLVMVisitor : public ASR::BaseVisitor<ASRToLLVMVisitor>
return;
}

this->visit_expr_wrapper(x.m_left, true);
this->visit_expr_wrapper(x.m_substr, true);
llvm::Value *substr = tmp;

this->visit_expr_wrapper(x.m_right, true);
this->visit_expr_wrapper(x.m_str, true);
llvm::Value *right = tmp;

tmp = lfortran_str_contains(right, substr);
Expand Down

0 comments on commit 728fb21

Please sign in to comment.