Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

better argument names for StringContains #2806

Merged
merged 2 commits into from
Sep 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading