mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
cgen_test fixes
This commit is contained in:
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) {
|
||||
// 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.
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
@ -75,7 +75,7 @@ void end() {
|
||||
}
|
||||
|
||||
|
||||
int main() {
|
||||
int main(int argc, char** argv) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -62,7 +62,7 @@ void handle_expr(Expr e) {
|
||||
;
|
||||
}
|
||||
|
||||
int main() {
|
||||
int main(int argc, char** argv) {
|
||||
User user = (User){
|
||||
0};
|
||||
user.age = 10;
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user