cgen: update the test

pull/3902/head
Alexander Medvednikov 2020-03-05 01:36:44 +01:00
parent 484320ed08
commit bcaf72eccb
3 changed files with 10 additions and 8 deletions

View File

@ -186,8 +186,10 @@ fn (g mut Gen) stmt(node ast.Stmt) {
sym := g.table.get_type_symbol(it.receiver.typ) sym := g.table.get_type_symbol(it.receiver.typ)
styp := sym.name.replace('.', '__') styp := sym.name.replace('.', '__')
g.write('$styp $it.receiver.name') g.write('$styp $it.receiver.name')
g.definitions.write('$styp $it.receiver.name')
if it.args.len > 0 { if it.args.len > 0 {
g.write(', ') g.write(', ')
g.definitions.write(', ')
} }
} }
// //

View File

@ -1,5 +1,5 @@
void foo(int a); void foo(int a);
void User_inc_age(int n); void User_inc_age(User u, int n);
int get_int(string a); int get_int(string a);
bool get_bool(); bool get_bool();
int get_int2(); int get_int2();
@ -75,7 +75,7 @@ i < 10; i++) {
int f = TODO_first(nums); int f = TODO_first(nums);
} }
void User_inc_age(int n) { void User_inc_age(User u, int n) {
u.age += n; u.age += n;
} }

View File

@ -2,9 +2,9 @@ multi_return_int_string mr_test();
int testa(); int testa();
string testb(int a); string testb(int a);
int testc(int a); int testc(int a);
int Foo_testa(); int Foo_testa(Foo f);
int Foo_testb(); int Foo_testb(Foo f);
int Bar_testa(); int Bar_testa(Bar b);
int main() { int main() {
Bar b = (Bar){ Bar b = (Bar){
@ -55,17 +55,17 @@ int testc(int a) {
return a; return a;
} }
int Foo_testa() { int Foo_testa(Foo f) {
int a = TODO_testb(f); int a = TODO_testb(f);
a = 1; a = 1;
return 4; return 4;
} }
int Foo_testb() { int Foo_testb(Foo f) {
return 4; return 4;
} }
int Bar_testa() { int Bar_testa(Bar b) {
return 4; return 4;
} }