-
Notifications
You must be signed in to change notification settings - Fork 164
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
Support to print lists in REPL #2752
Conversation
@Shaikh-Ubaid, Could you please have a look at this and let me know if it requires any changes? >>> [1, 2, 3] The list in the above example would be allocated in the
|
src/lpython/python_evaluator.cpp
Outdated
@@ -319,4 +360,105 @@ Result<std::unique_ptr<LLVMModule>> PythonCompiler::get_llvm3( | |||
#endif | |||
} | |||
|
|||
void print_type(ASR::ttype_t *t, void *data, std::string &result); | |||
|
|||
std::string PythonCompiler::string_aggregate_type(const struct EvalResult &r) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this function converting a given aggregate type to string? If yes, it should be called aggregate_type_to_string()
or cnvrt_aggregate_type_to_string()
or something similar. string_aggregate_type
doesn't give any good idea of what the function does and seems rather misleading.
src/libasr/pass/global_stmts.cpp
Outdated
// idx++; | ||
// return_var_ref = nullptr; | ||
// return_var = nullptr; | ||
// } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Commented code should be removed.
src/lpython/python_evaluator.cpp
Outdated
|
||
llvm::Type *type = nullptr; | ||
ASR::symbol_t *f = symbol_table->get_symbol("_" + run_fn); | ||
if ((return_type == "struct") && (f)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Slightly confused here. What are we processing inside this if
and why do we need this processing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shared few comments. Rest seems good.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. Great work @Vipul-Cariappa! Left a minor comment. It can be fixed in a separate PR.
@@ -319,4 +344,134 @@ Result<std::unique_ptr<LLVMModule>> PythonCompiler::get_llvm3( | |||
#endif | |||
} | |||
|
|||
void print_type(ASR::ttype_t *t, void *data, std::string &result); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need this declaration? If we need it then a better place for it could be python_evaluator.h
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The declaration is needed. print_type
is defined at the end after all the definitions of PythonCompiler
class. print_type
is not supposed to be called by any other part. It is a helper function for aggregate_type_to_string
.
@Vipul-Cariappa please resolve the conflicts and we can merge this. |
I used llvm 16 and updated the reference tests
No description provided.