-
Notifications
You must be signed in to change notification settings - Fork 58
Support for Polymorphism #1474
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
Draft
ghaith
wants to merge
10
commits into
master
Choose a base branch
from
polymorphism
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Support for Polymorphism #1474
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
A new type is added for every function block, class or interface this represents a vtable with the methods declared in the class. If a class extends another class, the parent's class is also included. If a class extends an interface, the interface is also included.
recursive validation is ignored for internals stdlib tests ignored
function blocks now contain an extra entry for the vtable standard lib functions now account for the exta entry
The `__vtable` field in classes and function blocks is assigned at init time to the correct global variable TODO: missing tests
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1474 +/- ##
==========================================
- Coverage 93.67% 91.29% -2.38%
==========================================
Files 166 174 +8
Lines 50097 57498 +7401
==========================================
+ Hits 46928 52493 +5565
- Misses 3169 5005 +1836 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Moves the `__body` field right after the "parent" vtable field if it exists. Also add introduce some further vtable specific codegen tests.
Move `__body` before local methods
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is the initial work to support polymorphism in function blocks/classes
The commit introduces a virtual table field on the top level function block in an inheritance chain which points to a globally declared vtable.
Each class will then have its own assigned vtable with method pointers to concrete implementations.
On initialization, the vtable for the concrete type is assigned to the variable.
This does break the function block calling convension but there was no way around it.
Steps to do:
Interfaces will be a different PR