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

Replace libdparse with DMD in BodyOnDisabledFuncsCheck #127

Merged
merged 2 commits into from
Aug 8, 2024

Conversation

Vladiwostok
Copy link
Collaborator

This check warns for disabled functions that have a disabled body. Disabled aggregates are ignored.

@Vladiwostok Vladiwostok linked an issue May 1, 2024 that may be closed by this pull request
return hasDisabledMemberFunctionAttribute(dec.memberFunctionAttributes);
}
bool isCurrentDisabled = isDisabled || (node.storage_class & STC.disable) != 0;
if (isCurrentDisabled)
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is the only use of this variable. You could simply inline the condition.

if (attr.atAttribute !is null && attr.atAttribute.identifier.text == "disable")
return true;
bool isCurrentDisabled = isDisabled || (node.storage_class & STC.disable) != 0;
if (isCurrentDisabled && node.fbody !is null)
Copy link
Collaborator

Choose a reason for hiding this comment

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

ditto.

^^ [warn]: Function marked with '@disabled' should not have a body +/
~this() {} /+
^^ [warn]: Destructor marked with '@disabled' should not have a body +/
this() {} // [warn]: Constructor marked with '@disabled' should not have a body
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm a bit worried that currently we are simply using the line to output the warning whereas upstream dscanner seems to also have some column information. This indeed makes it easier to follow where the problem is. I know that this is just for internal use, but this still might meet some opposition when trying to integrate to upstream.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I know, however this isn't the only check where warnings are not verified for column number. I plan on going through all visitors and fixing various diffs that are still present even after the rebase, such as column verification, nolint config, autofix

@RazvanN7 RazvanN7 merged commit dffbf3a into Dlang-UPB:replace_libdparse Aug 8, 2024
17 checks passed
@Vladiwostok Vladiwostok deleted the body-on-disabled branch August 8, 2024 09:11
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.

Replace libdparse with DMD in BodyOnDisabledFuncsCheck
2 participants