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

[Feature/Bug] No stdlib comments in bash generated #393

Closed
Mte90 opened this issue Aug 8, 2024 · 3 comments · Fixed by #408
Closed

[Feature/Bug] No stdlib comments in bash generated #393

Mte90 opened this issue Aug 8, 2024 · 3 comments · Fixed by #408
Assignees
Labels
bug Something isn't working enhancement New feature or request

Comments

@Mte90
Copy link
Member

Mte90 commented Aug 8, 2024

After #367 now when you compile a bash script that include a stdlib there are comments from that stdlib.

An example:

import * from "std/math"

// Output 
// 1
// 1

main {
    echo abs(1);
    echo abs(-1);
}
#!/usr/bin/env bash
# Written in [Amber](https://amber-lang.com/)
# version: 0.3.4-alpha
# date: 2024-08-08 14:52:58
# Returns the number rounded to the nearest integer
# Returns the largest integer less than or equal to the number
# Returns the smallest integer greater than or equal to the number
# Returns the absolute value of the number
function abs__4_v0 {
    local number=$1
    if [ $(echo ${number} '<' 0 | bc -l | sed '/\./ s/\.\{0,1\}0\{1,\}$//') != 0 ]; then
        __AF_abs4_v0=$(echo '-' ${number} | bc -l | sed '/\./ s/\.\{0,1\}0\{1,\}$//')
        return 0
    fi
    __AF_abs4_v0=${number}
    return 0
}

abs__4_v0 1
__AF_abs4_v0__8_10="$__AF_abs4_v0"
echo "$__AF_abs4_v0__8_10"
abs__4_v0 $(echo '-' 1 | bc -l | sed '/\./ s/\.\{0,1\}0\{1,\}$//')
__AF_abs4_v0__9_10="$__AF_abs4_v0"
echo "$__AF_abs4_v0__9_10"

As we can see now includes all the documentation for the math stdlib also for the stuff unused.
I think that if we are talking about stdlib there should be no comments and also that if you import something the comments shouldn't be there for stuff that you are not using.

@Mte90 Mte90 added bug Something isn't working enhancement New feature or request labels Aug 8, 2024
@Mte90 Mte90 changed the title [Feature] No stdlib comments in bash generated [Feature/Bug] No stdlib comments in bash generated Aug 8, 2024
@Mte90
Copy link
Member Author

Mte90 commented Aug 8, 2024

No I checked the issues was happening also before that PR.
Probably the PR that added the documentation generator had that issue too.
@Ph0enixKM this is for you

@Ph0enixKM
Copy link
Member

So the /// should be persisted in code as #? Will do.

@Mte90
Copy link
Member Author

Mte90 commented Aug 8, 2024

I think so, but also there is the issue that printed the whole comments in the file not just the one involved in the function so there is a bug somewhere.

@Ph0enixKM Ph0enixKM linked a pull request Aug 13, 2024 that will close this issue
@b1ek b1ek closed this as completed in #408 Aug 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants