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

Generate a Libraries struct #255

Merged
merged 4 commits into from
Mar 31, 2020
Merged

Generate a Libraries struct #255

merged 4 commits into from
Mar 31, 2020

Conversation

nlordell
Copy link
Contributor

@nlordell nlordell commented Mar 30, 2020

This PR generates a Libraries struct with named fields for each library. This makes things like the order in which the libraries are specified not matter and makes the API much less error prone.

This PR was made possible because of the recent change to generate all the code in a module (w00t) and is a much simple solution to the proposed new linking API. As such this PR closes #144
and closes #96.

I created #254 to capture the second half of #96 which is still not implemented.

Test Plan

Updated example 😄

@nlordell nlordell requested a review from a team March 30, 2020 11:48
Copy link
Contributor

@fleupold fleupold left a comment

Choose a reason for hiding this comment

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

🆒

let link = {
let link_libraries = libs.iter().map(|name| {
let name_lit = Literal::string(&name);
let field = util::safe_ident(&name.to_snake_case());
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: since this logic is shared with the loop above, how about making the one above return a pair of (lib_struct_fields, link_libraries)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point!

@nlordell nlordell merged commit b3d99e8 into master Mar 31, 2020
@nlordell nlordell deleted the libraries_struct branch March 31, 2020 07:00
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.

Improve deployment of contracts with linked libraries
3 participants