Skip to content

Commit 5cbcd43

Browse files
committed
Rename _imag to _lpython_imag
1 parent 43c6741 commit 5cbcd43

File tree

3 files changed

+8
-9
lines changed

3 files changed

+8
-9
lines changed

src/lpython/semantics/python_ast_to_asr.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1855,14 +1855,14 @@ class BodyVisitor : public CommonVisitor<BodyVisitor> {
18551855
std::string attr = x.m_attr;
18561856
if (attr == "imag") {
18571857
ASR::expr_t *val = ASR::down_cast<ASR::expr_t>(ASR::make_Var_t(al, x.base.base.loc, t));
1858-
ASR::symbol_t *fn_imag = resolve_intrinsic_function(x.base.base.loc, "_imag");
1858+
ASR::symbol_t *fn_imag = resolve_intrinsic_function(x.base.base.loc, "_lpython_imag");
18591859
Vec<ASR::call_arg_t> args;
18601860
args.reserve(al, 1);
18611861
ASR::call_arg_t arg;
18621862
arg.loc = val->base.loc;
18631863
arg.m_value = val;
18641864
args.push_back(al, arg);
1865-
make_call_helper(al, fn_imag, current_scope, args, "_imag", x.base.base.loc);
1865+
make_call_helper(al, fn_imag, current_scope, args, "_lpython_imag", x.base.base.loc);
18661866
return;
18671867
} else if (attr == "real") {
18681868
ASR::expr_t *val = ASR::down_cast<ASR::expr_t>(ASR::make_Var_t(al, x.base.base.loc, t));

src/lpython/semantics/python_comptime_eval.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ struct PythonIntrinsicProcedures {
4444
{"hex", {m_builtin, &eval_hex}},
4545
{"oct", {m_builtin, &eval_oct}},
4646
{"complex", {m_builtin, &eval_complex}},
47-
{"_imag", {m_builtin, &eval__imag}},
47+
{"_lpython_imag", {m_builtin, &eval__lpython_imag}},
4848
{"divmod", {m_builtin, &eval_divmod}},
4949
};
5050
}
@@ -504,12 +504,12 @@ struct PythonIntrinsicProcedures {
504504
return ASR::down_cast<ASR::expr_t>(make_ConstantComplex_t(al, loc, c1, c2, type));
505505
}
506506

507-
static ASR::expr_t *eval__imag(Allocator &al, const Location &loc,
507+
static ASR::expr_t *eval__lpython_imag(Allocator &al, const Location &loc,
508508
Vec<ASR::expr_t*> &args
509509
) {
510510
LFORTRAN_ASSERT(ASRUtils::all_args_evaluated(args));
511511
if (args.size() != 1) {
512-
throw SemanticError("Intrinsic _imag function accepts exactly 1 argument", loc);
512+
throw SemanticError("Intrinsic _lpython_imag function accepts exactly 1 argument", loc);
513513
}
514514
ASR::expr_t* imag_arg = args[0];
515515
ASR::ttype_t *type = ASRUtils::TYPE(ASR::make_Real_t(al, loc, 8, nullptr, 0));
@@ -518,7 +518,7 @@ struct PythonIntrinsicProcedures {
518518
double result = im;
519519
return ASR::down_cast<ASR::expr_t>(ASR::make_ConstantReal_t(al, loc, result, type));
520520
} else {
521-
throw SemanticError("Argument of the _imag() function must be Complex", loc);
521+
throw SemanticError("Argument of the _lpython_imag() function must be Complex", loc);
522522
}
523523
}
524524

src/runtime/lpython_builtin.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -297,11 +297,10 @@ def _lfortran_caimag(x: c32) -> f32:
297297
def _lfortran_zaimag(x: c64) -> f64:
298298
pass
299299

300-
# TODO: rename to _lpython_imag()
301300
@overload
302-
def _imag(x: c64) -> f64:
301+
def _lpython_imag(x: c64) -> f64:
303302
return _lfortran_zaimag(x)
304303

305304
@overload
306-
def _imag(x: c32) -> f32:
305+
def _lpython_imag(x: c32) -> f32:
307306
return _lfortran_caimag(x)

0 commit comments

Comments
 (0)