cashscript icon indicating copy to clipboard operation
cashscript copied to clipboard

Add an 'unused' modifier

Open rkalis opened this issue 2 years ago • 4 comments

Allow variables and parameters to have an unused modifier that indicates it is ok for them to be unused.

contract Test(int unused a, int b) {
    function test(int c) {
        require(b == c);
    }
}

rkalis avatar Jun 13 '22 10:06 rkalis

@nathanielCherian looks like we might need an array of modifiers after all 😬

rkalis avatar Jun 13 '22 10:06 rkalis

Wow, we were just talking about how there couldn't possibly be more modifiers😂

The array of modifiers code is saved on one of my branches so I'll look into that again and try implementing the new unused modifier.

nathanielCherian avatar Jun 14 '22 06:06 nathanielCherian

Hey! Currently working on this and I had a question about the implementation.

As of now, the constant keyword can only be applied to variables (not ParameterNodes). Should we extend the constant keyword to parameters as well?

Also for the unused modifier, do you see this being used for parameters exclusively or include VariableNodes too?

nathanielCherian avatar Aug 06 '22 00:08 nathanielCherian

Hey @nathanielCherian! Sorry, I completely missed this comment, apologies for the late reply!

I think the unused modifier should apply to parameters and variables. The constant modifier I'm not super sure, but maybe for consistency we can also apply it to parameters.

rkalis avatar Mar 22 '23 11:03 rkalis