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

Always call finalisers for embedded fields #1586

Merged
merged 1 commit into from
Feb 15, 2017

Conversation

Praetonus
Copy link
Member

Previously, finalisers of embedded fields would never be called due to embedded fields being transparent to the runtime. This change adds calls to the adequate finalisers in parent objects' finalisers when said parents contain embedded fields.

Closes #1551.

@Praetonus Praetonus added the changelog - fixed Automatically add "Fixed" CHANGELOG entry on merge label Feb 14, 2017
@@ -295,6 +321,9 @@ static bool genfun_fun(compile_t* c, reach_type_t* t, reach_method_t* m)
codegen_startfun(c, m->func, m->di_file, m->di_method);
name_params(c, t, m, params, m->func);

if(m->func == t->final_fn)
call_embed_finalisers(c, t, LLVMGetParam(codegen_fun(c), 0));
Copy link
Member

Choose a reason for hiding this comment

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

What do you think about using gen_this instead of LLVMGetParam(..., 0)? Since we already have that abstraction available, it seems prudent to try to use it wherever possible, and avoid depending on the order of params here.

Copy link
Member Author

Choose a reason for hiding this comment

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

Seems reasonable. I'll update the PR.

Previously, finalisers of embedded fields would never be called due to
embedded fields being transparent to the runtime. This change adds
calls to the adequate finalisers in parent objects' finalisers when
said parents contain embedded fields.

Closes ponylang#1551.
Copy link
Member

@jemc jemc left a comment

Choose a reason for hiding this comment

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

Feel free to merge when CI passes.

@sylvanc sylvanc merged commit 087ebc7 into ponylang:master Feb 15, 2017
ponylang-main added a commit that referenced this pull request Feb 15, 2017
@Praetonus Praetonus deleted the embed-final branch February 15, 2017 11:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog - fixed Automatically add "Fixed" CHANGELOG entry on merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants