diff --git a/vlib/v/gen/cgen.v b/vlib/v/gen/cgen.v index c25d2ac032..1f4f79880a 100644 --- a/vlib/v/gen/cgen.v +++ b/vlib/v/gen/cgen.v @@ -1196,6 +1196,7 @@ fn (g mut Gen) ident(node ast.Ident) { } fn (g mut Gen) if_expr(node ast.IfExpr) { + // println('if_expr pos=$node.pos.line_nr') // g.writeln('/* if is_expr=$node.is_expr */') // If expression? Assign the value to a temp var. // Previously ?: was used, but it's too unreliable. diff --git a/vlib/v/gen/tests/1.c b/vlib/v/gen/tests/1.c index 006633a3ea..94ed91f369 100644 --- a/vlib/v/gen/tests/1.c +++ b/vlib/v/gen/tests/1.c @@ -45,11 +45,10 @@ struct varg_int { int args[0]; }; -//3 - // - -int main() { +int main(int argc, char** argv) { + _init(); + os__args = os__init_os_args(argc, (byteptr*)argv); int a = 10; a++; int negative = -a; @@ -176,8 +175,6 @@ void matches() { println((a == 10) ? tos3("ten") : tos3("not ten")); } -//10 - void end() { int i = 2; int key = 10; @@ -185,8 +182,6 @@ void end() { int e = 2 + 3 * 4; } -//20 - void localmod__pub_foo() { int a = 10; } @@ -195,3 +190,8 @@ int localmod__get_int_10() { return 10; } +void _init() { + pi2 = pi; +} + + diff --git a/vlib/v/gen/tests/2.c b/vlib/v/gen/tests/2.c index cab9c0f71a..b3a9ca4741 100644 --- a/vlib/v/gen/tests/2.c +++ b/vlib/v/gen/tests/2.c @@ -75,7 +75,7 @@ void end() { } -int main() { +int main(int argc, char** argv) { return 0; } diff --git a/vlib/v/gen/tests/3.c b/vlib/v/gen/tests/3.c index df41cb985d..9b83706b46 100644 --- a/vlib/v/gen/tests/3.c +++ b/vlib/v/gen/tests/3.c @@ -62,7 +62,7 @@ void handle_expr(Expr e) { ; } -int main() { +int main(int argc, char** argv) { User user = (User){ 0}; user.age = 10; diff --git a/vlib/v/table/table.v b/vlib/v/table/table.v index 94793c6e02..732a5719ad 100644 --- a/vlib/v/table/table.v +++ b/vlib/v/table/table.v @@ -220,7 +220,7 @@ pub fn (t &Table) get_type_symbol(typ Type) &TypeSymbol { return &t.types[idx] } // this should never happen - panic('get_type_symbol: invalid type (typ=$typ idx=${idx}). This should neer happen') + panic('get_type_symbol: invalid type (typ=$typ idx=${idx}). This should never happen') } // this will override or register builtin type