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

Turn simplify_function_body into a virtual method #4653

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ochafik
Copy link
Contributor

@ochafik ochafik commented May 25, 2023

No description provided.

Copy link
Member

@kintel kintel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor nits

@@ -567,7 +564,7 @@ Value FunctionCall::evaluate(const std::shared_ptr<const Context>& context) cons
const Expression *expression = this;
while (true) {
try {
auto result = simplify_function_body(expression, *expression_context);
auto result = expression->simplify_function_body(*expression_context); // || Value::undefined.clone()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the purpose of the commented out code?

{
if (!expression) {
const auto *call = this;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Apart from retaining the old structure, does the call variable make this more readable, or does it makes sense to just use this?

@kintel
Copy link
Member

kintel commented Jun 7, 2023

Didn't realize this was still a draft. Looks like a decent refactor to me.

@kwikius
Copy link

kwikius commented Aug 5, 2023

Does this not increase sizeof (Expression) for all expressions

@kwikius
Copy link

kwikius commented Aug 5, 2023

Does this not increase sizeof (Expression) for all expressions

OK Apologies for the noise. . It shouldnt https://stackoverflow.com/questions/63557630/why-the-size-of-class-remains-same-on-adding-more-than-one-virtual-function

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants