-
Notifications
You must be signed in to change notification settings - Fork 2
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
WIP: frontend for dynamic array functions #7
WIP: frontend for dynamic array functions #7
Conversation
Is this approach feasible? |
I think so actually. I would rename the DynArrayFunction class to MemberFunction or TypeMethod class (to distinguish from external contract calls) which is parametrized on type (i.e. takes DynArray as a constructor argument). This is cleaner because it's more generic over types and also opens up the door to adding methods to other types too. |
|
||
if self.name == "append": | ||
validation.utils.validate_expected_type(node.args[0], value_type) | ||
return DynamicArrayDefinition(value_type, dynarray_length + 1) |
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.
two things -- I think append()
should return void, and also it won't change the length bound on the dynarray, it will only change the runtime length.
Codecov Report
@@ Coverage Diff @@
## dyn_array_functions #7 +/- ##
=======================================================
- Coverage 66.71% 63.63% -3.08%
=======================================================
Files 92 92
Lines 9481 9510 +29
Branches 2371 2378 +7
=======================================================
- Hits 6325 6052 -273
- Misses 2460 2794 +334
+ Partials 696 664 -32
Continue to review full report at Codecov.
|
Cool, that is a good point. I opted for MemberFunction as I think its meaning would be more apparent for someone looking at the AST. With this change, I think it would be more appropriate to move the MemberFunction class to Also, please let me know if there are any outstanding steps for the front-end, or if I can help on linking the front-end to the codegen. |
yeah that move makes sense. |
c3ef62d
to
f282dff
Compare
What I did
Add 'append' and 'pop' to frontend
How I did it
DynamicArrayFunctionDefinition
classDynamicArrayDefinition
to additionally inheritMemerTypeDefinition
How to verify it
Description for the changelog
Cute Animal Picture