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

feat: add sourcemap to ContractType output #88

Merged
merged 3 commits into from
Feb 3, 2023

Conversation

antazoey
Copy link
Member

@antazoey antazoey commented Feb 2, 2023

What I did

  • Add and use srcmap output.

This stemmed from using Solidity docs to understand Vyper more, regarding sourcemap. However, I wanted to see this part work in Solidity to cross-compare and follow the docs. This is mostly part of my research into building coverage features in Ape.

Question: not sure we would want to merge this until we know we will be using this? That is fine if that is the case. I am mostly focused on Vyper right now, as is the plan.

fixes: APE-582

How I did it

Found the output srcmap that gives the source map similarly to pc_pos_map_compressed in Vyper.

Is this correct?

How to verify it

Checklist

  • Passes all linting checks (pre-commit and CI jobs)
  • New test cases have been added and are passing
  • Documentation has been updated
  • PR title follows Conventional Commit standard (will be automatically included in the changelog)

def test_source_map(project, compiler):
source_path = project.contracts_folder / "MultipleDefinitions.sol"
result = compiler.compile([source_path])[-1]
assert result.sourcemap.__root__ == "124:87:0:-:0;;;;;;;;;;;;;;;;;;;"
Copy link
Member Author

@antazoey antazoey Feb 2, 2023

Choose a reason for hiding this comment

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

Can make this test nicer if ApeWorX/ethpm-types#58 merges + releases

@antazoey antazoey marked this pull request as ready for review February 2, 2023 22:17
Copy link
Contributor

@NotPeopling2day NotPeopling2day left a comment

Choose a reason for hiding this comment

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

I saw your comment about whether we use the info or not, but I don't think it would hurt anything to add it.

@antazoey antazoey merged commit 76f3b14 into ApeWorX:main Feb 3, 2023
@antazoey antazoey deleted the feat/sourcemap branch February 3, 2023 14:14
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.

2 participants