Ph0enixKM / Amber

💎 Amber the programming language compiled to bash
https://amber-lang.com
GNU General Public License v3.0
3.53k stars 70 forks source link

Fix `handle_existing_function` #162

Closed akihiro17 closed 2 weeks ago

akihiro17 commented 3 weeks ago

related to https://github.com/users/Ph0enixKM/projects/2/views/1?pane=issue&itemId=64542562

I think the handle_existing_function only needs to check if the function already exists.

script

fun Foo() {
    echo "Hello"
}

Foo()
Foo()

before

 WARN 
Identifier 'Foo' is not in snake case
at func.ab:1:5

We recommend using snake case with either all uppercase or all lowercase letters for consistency.
To disable this warning use 'allow_camel_case' compiler flag

1| fun Foo() {
2|     echo "Hello"
 WARN 
Identifier 'Foo' is not in snake case
at func.ab:1:5

We recommend using snake case with either all uppercase or all lowercase letters for consistency.
To disable this warning use 'allow_camel_case' compiler flag

1| fun Foo() {
2|     echo "Hello"
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
Hello
Hello

after


 WARN 
Identifier 'Foo' is not in snake case
at func.ab:1:5

We recommend using snake case with either all uppercase or all lowercase letters for consistency.
To disable this warning use 'allow_camel_case' compiler flag

1| fun Foo() {
2|     echo "Hello"
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
Hello
Hello

``