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

Unable to use ooc-style argument of main in match #866

Closed
horasal opened this issue Feb 24, 2015 · 1 comment
Closed

Unable to use ooc-style argument of main in match #866

horasal opened this issue Feb 24, 2015 · 1 comment
Milestone

Comments

@horasal
Copy link
Contributor

@horasal horasal commented Feb 24, 2015

main: func(args: ArrayList<String>){
    match(args size){
        case 1 => "%s" printfln(args[0])
        case => 
    }
}

generates :

rock/test.ooc:5:33 error Undefined symbol 'args'
        case 1 => "%s" printfln(args[0])
                                ~~~~    

[FAIL]

because we replaced args with __%module%__main

A simple and dirty hack can be as follows:

vdfe1 := VariableDecl new(null, arg getName(), VariableAccess new(vdfe, token), token)
body add(0, vdfe1)

for main: func(args: ArrayList<String>), this finally generates:

__%module%__args := strArrayListFromCString(argc, argv)
arg := __%module%__args
@horasal horasal changed the title match do not works well with arguments of main match does not work well with arguments of main Feb 24, 2015
@horasal horasal changed the title match does not work well with arguments of main Unable to use ooc-style argument of main in match Feb 24, 2015
@fasterthanlime
Copy link
Collaborator

@fasterthanlime fasterthanlime commented Jul 8, 2015

I wonder why we're mangling the argument's name in the first place..

Loading

@fasterthanlime fasterthanlime added this to the 0.9.10 milestone Jul 10, 2015
@fasterthanlime fasterthanlime added this to the 0.9.10 milestone Jul 10, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants