cgen_test fixes
							parent
							
								
									c12985d1d7
								
							
						
					
					
						commit
						b2d1f55702
					
				|  | @ -1196,6 +1196,7 @@ fn (g mut Gen) ident(node ast.Ident) { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| fn (g mut Gen) if_expr(node ast.IfExpr) { | 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 */')
 | 	// g.writeln('/* if is_expr=$node.is_expr */')
 | ||||||
| 	// If expression? Assign the value to a temp var.
 | 	// If expression? Assign the value to a temp var.
 | ||||||
| 	// Previously ?: was used, but it's too unreliable.
 | 	// Previously ?: was used, but it's too unreliable.
 | ||||||
|  |  | ||||||
|  | @ -45,11 +45,10 @@ struct varg_int { | ||||||
| 	int args[0]; | 	int args[0]; | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| //3
 |  | ||||||
| 
 |  | ||||||
| //
 | //
 | ||||||
| 
 | int main(int argc, char** argv) { | ||||||
| int main() { | 	_init(); | ||||||
|  | 	os__args = os__init_os_args(argc, (byteptr*)argv); | ||||||
| 	int a = 10; | 	int a = 10; | ||||||
| 	a++; | 	a++; | ||||||
| 	int negative = -a; | 	int negative = -a; | ||||||
|  | @ -176,8 +175,6 @@ void matches() { | ||||||
| 	println((a == 10) ? tos3("ten") : tos3("not ten")); | 	println((a == 10) ? tos3("ten") : tos3("not ten")); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| //10
 |  | ||||||
| 
 |  | ||||||
| void end() { | void end() { | ||||||
| 	int i = 2; | 	int i = 2; | ||||||
| 	int key = 10; | 	int key = 10; | ||||||
|  | @ -185,8 +182,6 @@ void end() { | ||||||
| 	int e = 2 + 3 * 4; | 	int e = 2 + 3 * 4; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| //20
 |  | ||||||
| 
 |  | ||||||
| void localmod__pub_foo() { | void localmod__pub_foo() { | ||||||
| 	int a = 10; | 	int a = 10; | ||||||
| } | } | ||||||
|  | @ -195,3 +190,8 @@ int localmod__get_int_10() { | ||||||
| 	return 10; | 	return 10; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | void _init() { | ||||||
|  | 	pi2 = pi; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |  | ||||||
|  | @ -75,7 +75,7 @@ void end() { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| int main() { | int main(int argc, char** argv) { | ||||||
| 	return 0; | 	return 0; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -62,7 +62,7 @@ void handle_expr(Expr e) { | ||||||
| 	; | 	; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| int main() { | int main(int argc, char** argv) { | ||||||
| 	User user = (User){ | 	User user = (User){ | ||||||
| 0}; | 0}; | ||||||
| 	user.age = 10; | 	user.age = 10; | ||||||
|  |  | ||||||
|  | @ -220,7 +220,7 @@ pub fn (t &Table) get_type_symbol(typ Type) &TypeSymbol { | ||||||
| 		return &t.types[idx] | 		return &t.types[idx] | ||||||
| 	} | 	} | ||||||
| 	// this should never happen
 | 	// 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
 | // this will override or register builtin type
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue