vyper
vyper copied to clipboard
feat: add extend for dynamic arrays
What I did
Add extend()
for dynamic arrays, partial fix for #2611.
The source dynamic array (argument) must be of dynamic array type, up to the size of the destination dynamic array.
How I did it
- Add
extend_dyn_array
helper tocodegen/core.py
. - Add
extend
as member function of dynamic array type.
How to verify it
See tests
Commit message
feat: add extend for dynamic arrays
Description for the changelog
Add extend()
for dynamic arrays.
Cute Animal Picture
Codecov Report
Merging #2976 (96c680e) into master (c71b023) will increase coverage by
0.01%
. The diff coverage is97.08%
.
@@ Coverage Diff @@
## master #2976 +/- ##
==========================================
+ Coverage 88.35% 88.37% +0.01%
==========================================
Files 97 97
Lines 10968 11003 +35
Branches 2593 2599 +6
==========================================
+ Hits 9691 9724 +33
- Misses 827 828 +1
- Partials 450 451 +1
Impacted Files | Coverage Δ | |
---|---|---|
vyper/codegen/core.py | 84.26% <91.42%> (-0.93%) |
:arrow_down: |
vyper/builtin_functions/functions.py | 90.82% <100.00%> (+0.48%) |
:arrow_up: |
vyper/codegen/expr.py | 85.12% <100.00%> (-0.11%) |
:arrow_down: |
vyper/codegen/stmt.py | 87.76% <100.00%> (-0.40%) |
:arrow_down: |
vyper/semantics/types/indexable/sequence.py | 88.02% <100.00%> (+0.08%) |
:arrow_up: |
:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more
_dynarray_make_setter
should store the length, and then use a helper to copy the body.
this PR is shaping up, left a couple nits. thinking about whether we might want to move the dynarray method implementations into the builtins file as well? that would probably require exposing
copy_dynarray_body
as a public method ofcodegen.core
though.
Cool, I think that would be neater since they are used only in vyper/builtin_functions/functions.py
. Should I make the change?