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

core: allow to overload contract methods #1689

Merged
merged 2 commits into from
Jan 27, 2021
Merged

core: allow to overload contract methods #1689

merged 2 commits into from
Jan 27, 2021

Conversation

fyrchik
Copy link
Contributor

@fyrchik fyrchik commented Jan 26, 2021

Multiple methods with different parameter count can co-exist.
As I understand, only native contracts are affected currently.

Close #1683 .

@codecov
Copy link

codecov bot commented Jan 26, 2021

Codecov Report

Merging #1689 (dd1e2ce) into master (32e8678) will increase coverage by 0.00%.
The diff coverage is 90.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1689   +/-   ##
=======================================
  Coverage   82.66%   82.66%           
=======================================
  Files         239      239           
  Lines       19546    19543    -3     
=======================================
- Hits        16157    16155    -2     
+ Misses       2392     2389    -3     
- Partials      997      999    +2     
Impacted Files Coverage Δ
cli/wallet/wallet.go 69.86% <33.33%> (ø)
pkg/core/blockchain.go 76.55% <100.00%> (ø)
pkg/core/interop/contract/call.go 78.66% <100.00%> (-5.34%) ⬇️
pkg/core/native/management.go 88.60% <100.00%> (ø)
pkg/smartcontract/manifest/manifest.go 68.57% <100.00%> (ø)
pkg/smartcontract/manifest/standard/comply.go 100.00% <100.00%> (ø)
pkg/vm/cli/cli.go 96.36% <100.00%> (ø)
pkg/network/server.go 71.70% <0.00%> (+0.16%) ⬆️
pkg/consensus/consensus.go 71.22% <0.00%> (+0.58%) ⬆️
... and 1 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 32e8678...dd1e2ce. Read the comment docs.

Comment on lines 43 to 45
md := m.ABI.GetMethod(name, len(stm.Parameters))
if md == nil {
return fmt.Errorf("%w: '%s'", ErrMethodMissing, name)
Copy link
Member

Choose a reason for hiding this comment

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

We can also add parameters count to the error message.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

@roman-khimov roman-khimov merged commit f1792b3 into master Jan 27, 2021
@roman-khimov roman-khimov deleted the overload branch January 27, 2021 12:11
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.

Add method overloading
3 participants