Skip to content

Commit 66a1266

Browse files
committed
Remove str_int compile time implementation from visit_Call
1 parent 0be6111 commit 66a1266

File tree

1 file changed

+0
-56
lines changed

1 file changed

+0
-56
lines changed

src/lpython/semantics/python_ast_to_asr.cpp

Lines changed: 0 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -2112,62 +2112,6 @@ class BodyVisitor : public CommonVisitor<BodyVisitor> {
21122112
}
21132113
return;
21142114

2115-
} else if (call_name == "str_int") {
2116-
std::string rl_path = get_runtime_library_dir();
2117-
SymbolTable *st = current_scope;
2118-
while (st->parent != nullptr) {
2119-
st = st->parent;
2120-
}
2121-
bool ltypes;
2122-
std::string msym = "lpython_builtin";
2123-
ASR::symbol_t *t = (ASR::symbol_t*)(load_module(al, st,
2124-
msym, x.base.base.loc, true, rl_path, ltypes,
2125-
[&](const std::string &msg, const Location &loc) { throw SemanticError(msg, loc); }
2126-
));
2127-
LFORTRAN_ASSERT(!ltypes)
2128-
if (!t) {
2129-
throw SemanticError("The module '" + msym + "' cannot be loaded",
2130-
x.base.base.loc);
2131-
}
2132-
2133-
ASR::Module_t *m = ASR::down_cast<ASR::Module_t>(t);
2134-
2135-
std::string local_sym = "str_int";
2136-
t = m->m_symtab->resolve_symbol(local_sym);
2137-
if (!t) {
2138-
throw SemanticError("ICE: The symbol '" + local_sym + "' not found in the module '" + msym + "'",
2139-
x.base.base.loc);
2140-
}
2141-
if (ASR::is_a<ASR::Function_t>(*t)) {
2142-
if (current_scope->scope.find(local_sym) != current_scope->scope.end()) {
2143-
throw SemanticError("Function already defined",
2144-
x.base.base.loc);
2145-
}
2146-
ASR::Function_t *mfn = ASR::down_cast<ASR::Function_t>(t);
2147-
// `mfn` is the Function in a module. Now we construct
2148-
// an ExternalSymbol that points to it.
2149-
Str name;
2150-
name.from_str(al, local_sym);
2151-
char *cname = name.c_str(al);
2152-
ASR::asr_t *fn = ASR::make_ExternalSymbol_t(
2153-
al, mfn->base.base.loc,
2154-
/* a_symtab */ current_scope,
2155-
/* a_name */ cname,
2156-
(ASR::symbol_t*)mfn,
2157-
m->m_name, nullptr, 0, mfn->m_name,
2158-
ASR::accessType::Public
2159-
);
2160-
current_scope->scope[local_sym] = ASR::down_cast<ASR::symbol_t>(fn);
2161-
2162-
ASR::ttype_t *a_type = ASRUtils::TYPE(ASR::make_Integer_t(al, x.base.base.loc,
2163-
4, nullptr, 0));
2164-
tmp = ASR::make_FunctionCall_t(al, x.base.base.loc, ASR::down_cast<ASR::symbol_t>(fn),
2165-
nullptr, args.p, args.size(), nullptr, 0, a_type, nullptr, nullptr);
2166-
return;
2167-
} else {
2168-
throw SemanticError("ICE: 'str_int' expected to be a function", x.base.base.loc);
2169-
}
2170-
21712115
} else if (call_name == "ord") {
21722116
std::string rl_path = get_runtime_library_dir();
21732117
SymbolTable *st = current_scope;

0 commit comments

Comments
 (0)