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

[BUG] nameof does not work on functions #673

Open
Thesola10 opened this issue Feb 8, 2025 · 0 comments · May be fixed by #674
Open

[BUG] nameof does not work on functions #673

Thesola10 opened this issue Feb 8, 2025 · 0 comments · May be fixed by #674
Labels
bug Something isn't working

Comments

@Thesola10
Copy link

Thesola10 commented Feb 8, 2025

Describe the bug
In Amber, the nameof builtin keyword returns the compiled name of a variable in-scope. Unfortunately, it doesn't currently work for functions.

To Reproduce
Compile the following:

fun a() {
    echo "Trapped"
}

trust $trap {nameof a} SIGTERM SIGKILL SIGINT SIGABRT$

This will fail with the message: Variable 'a' not found

Expected behavior
The script compiles successfully, and {nameof a} is replaced with the compiled name of the function (something akin to a__1_v0)

Additional context
As shown in the example above, the ability to use nameof on functions is necessary to use them in traps, for instance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant