Skip to content

feat[lang]: implement function exports#3786

Merged
charles-cooper merged 57 commits intovyperlang:masterfrom
charles-cooper:feat/exports2
Feb 25, 2024
Merged

feat[lang]: implement function exports#3786
charles-cooper merged 57 commits intovyperlang:masterfrom
charles-cooper:feat/exports2

Conversation

@charles-cooper
Copy link
Copy Markdown
Member

@charles-cooper charles-cooper commented Feb 18, 2024

What I did

implement exports: ...

todo:

  • update validate_implements
  • add tests
  • ban external functions from self.

How I did it

How to verify it

Commit message

add `exports:` declaration to the language. this allows users to
directly export functions marked `@external` from libraries instead of
writing `@external` wrapper functions (and consequently, for library
authors to define the external interface for their modules).

important refactors:
- remove expanded getters from module AST, change them to annotation on
  public VariablDecls.
- redo order of node visitation in ModuleAnalyzer
- refactor `InterfaceT.validate_implements()` to handle exported
  functions
- add `exposed_functions` property to `ModuleT` which reflects the
  runtime functions exposed in the selector table
- refactor IR generation to use new reachability analysis

misc:
- remove Module.add_to_body, Module.remove_from_body as they are dead
  now
- move VariableDecl validation to vyper/ast/nodes.py
- improve call-site annotations for error messages
- improve annotations for exceptions which reference a previously-
  declared node.

Description for the changelog

Cute Animal Picture

Put a link to a cute animal picture inside the parenthesis-->

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Feb 18, 2024

Codecov Report

Attention: Patch coverage is 90.74074% with 30 lines in your changes are missing coverage. Please review.

Project coverage is 85.08%. Comparing base (9bab114) to head (4b91ac1).

Files Patch % Lines
vyper/exceptions.py 70.27% 8 Missing and 3 partials ⚠️
vyper/semantics/analysis/module.py 93.02% 3 Missing and 3 partials ⚠️
vyper/semantics/types/function.py 76.92% 5 Missing and 1 partial ⚠️
vyper/semantics/types/module.py 92.85% 3 Missing ⚠️
vyper/ast/nodes.py 91.30% 1 Missing and 1 partial ⚠️
vyper/semantics/analysis/base.py 91.66% 1 Missing ⚠️
vyper/semantics/types/user.py 0.00% 1 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3786      +/-   ##
==========================================
+ Coverage   85.02%   85.08%   +0.05%     
==========================================
  Files          92       92              
  Lines       13767    13875     +108     
  Branches     3082     3113      +31     
==========================================
+ Hits        11706    11805      +99     
- Misses       1572     1576       +4     
- Partials      489      494       +5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@charles-cooper charles-cooper marked this pull request as ready for review February 20, 2024 18:23
@charles-cooper charles-cooper merged commit a91af13 into vyperlang:master Feb 25, 2024
@trocher trocher mentioned this pull request Apr 22, 2024
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.

4 participants