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

Fix argv confersion #151

Merged
merged 10 commits into from
Sep 9, 2023
12 changes: 9 additions & 3 deletions src/c2v.v
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ mut:
translation_start_ticks i64 // initialised before the loop calling .translate_file()
has_cfile bool
returning_bool bool
already_declared_types map[string]bool // to avoid duplicate type declarations
}

fn empty_toml_doc() toml.Doc {
Expand Down Expand Up @@ -139,6 +140,14 @@ fn add_place_data_to_error(err IError) string {
}

fn (mut c C2V) genln(s string) {
if s.starts_with('type ') {
if s in c.already_declared_types {
return
}

c.already_declared_types[s] = true
}

if c.indent > 0 && c.out_line_empty {
c.out.write_string(tabs[c.indent])
}
Expand Down Expand Up @@ -2095,9 +2104,6 @@ fn filter_name(name string) string {
if name in builtin_fn_names {
return 'C.' + name
}
if name == 'argv' {
return 'os.argv'
}
if name == 'FILE' {
return 'C.FILE'
}
Expand Down