cgen_test fixes

pull/4092/head
Alexander Medvednikov 2020-03-21 11:17:17 +01:00
parent c12985d1d7
commit b2d1f55702
5 changed files with 12 additions and 11 deletions

View File

@ -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.

View File

@ -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;
}

View File

@ -75,7 +75,7 @@ void end() {
}
int main() {
int main(int argc, char** argv) {
return 0;
}

View File

@ -62,7 +62,7 @@ void handle_expr(Expr e) {
;
}
int main() {
int main(int argc, char** argv) {
User user = (User){
0};
user.age = 10;

View File

@ -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