We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c7bd162 commit 80b5fe9Copy full SHA for 80b5fe9
src/lpython/semantics/python_ast_to_asr.cpp
@@ -1763,8 +1763,16 @@ class BodyVisitor : public CommonVisitor<BodyVisitor> {
1763
args.p, args.size());
1764
return;
1765
1766
- } else if (call_name == "exit" || call_name == "quit") {
1767
- ASR::expr_t *code = nullptr;
+ } else if (call_name == "quit") {
+ ASR::expr_t *code;
1768
+ if (args.size() == 0) {
1769
+ code = nullptr;
1770
+ } else if (args.size() == 1) {
1771
+ code = args[0];
1772
+ } else {
1773
+ throw SemanticError("The function quit() requires 0 or 1 arguments",
1774
+ x.base.base.loc);
1775
+ }
1776
tmp = ASR::make_Stop_t(al, x.base.base.loc, code);
1777
1778
}
0 commit comments