chore: throw error with duplicated destination labels#308
chore: throw error with duplicated destination labels#3080xrusowsky wants to merge 6 commits intohuff-language:stagefrom
Conversation
|
Hey, thank you for doing this! |
|
The example in ERC721 is common throughout a lot of contracts in huffmate, another larger bit of work would involve namespacing the labels further to the macro in which they are defined in, such that we address them |
|
I see, that makes total sense! That feature feels more advanced, but i'm happy to give it a go. Besides throwing an error if there is a duplicated label within a namespace, if we were to go that route, how would you handle a scenario such as this one? #295 (comment)
would u raise an out-of-scope error as the user would be trying to invoke a jumpdest for a label which had been defined in another macro (namespace)? |
|
As suggested by @iFrostizz on discord, I’ve removed the labels hashmap and moved towards caching labels directly within the Will try to work on the label namespacing over the weekend. |
Overview
This PR addresses issue #295 and aims to fulfill the feature requests made by @erhant and @Philogy.
Proposed Changes
ParserErrorKind::DuplicateLabel(String).Caveats
test_erc721_compilecurrently fails due to non-unique labels (errorandcont) inhuff-examples/erc721/contracts/ERC721.huff.ERC721.huffshould be renamed for uniqueness.Impact
ERC721.huffto ensure all tests pass with the new label uniqueness constraints.