Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fix(inspections): fix unused params inspection for function declarations #260

Merged
merged 3 commits into from
Feb 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,20 @@ primitive Int;
asm fun foo(a: Int) { DROP }
------------------------------------------------------------------------
no issues

========================================================================
Unused parameter inspection in native function
========================================================================
primitive Int;

@name(__foo)
native foo(a: Int);
------------------------------------------------------------------------
no issues

========================================================================
Unused parameter inspection for function declaration
========================================================================
fun foo(param: Int);
------------------------------------------------------------------------
no issues
3 changes: 2 additions & 1 deletion server/src/psi/Decls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,8 @@ export class MessageFunction extends Node {
export class Fun extends NamedNode {
public hasBody(): boolean {
if (this.isAbstract()) return false
return this.node.type !== "native_function" && this.node.type !== "asm_function"
if (this.node.type === "asm_function" || this.node.type === "native_function") return false
return this.node.childForFieldName("body") !== null
}

public get bodyPresentation(): string {
Expand Down