cgen: fix tests

pull/3996/head
Alexander Medvednikov 2020-03-11 23:43:01 +01:00
parent a182b5c531
commit bcdb897f07
3 changed files with 4 additions and 2 deletions

View File

@ -685,7 +685,7 @@ fn (g mut Gen) expr(node ast.Expr) {
receiver_name = typ_sym.name
if typ_sym.kind == .array && it.name in
// TODO performance, detect `array` method differently
['repeat', 'sort_with_compare', 'free', 'push_many', 'trim'] {
['repeat', 'sort_with_compare', 'free', 'push_many', 'trim', 'first', 'clone'] {
// && rec_sym.name == 'array' {
// && rec_sym.name == 'array' && receiver_name.starts_with('array') {
// `array_byte_clone` => `array_clone`

View File

@ -56,7 +56,7 @@ int main() {
Color color = Color_red;
localmod__pub_foo();
int ten = localmod__get_int_10();
println(localmod__pub_int_const);
println(int_str(localmod__pub_int_const));
int g = ((int)(3.0));
byte* bytes = ((byte*)(0));
User user_ptr = (User*)memdup(&(User){}, sizeof(User));
@ -96,6 +96,7 @@ i < 10; i++) {
bool b2 = (*(bool*)array_get(bools, 0)) || true;
bool b3 = get_bool() || true;
int f = array_first(nums);
array_int c = array_clone(nums);
string d = tos3("d");
println(string_add(s, d));
}

View File

@ -81,6 +81,7 @@ fn foo(a int) {
b2 := bools[0] || true
b3 := get_bool() || true
f := nums.first()
c := nums.clone()
d := 'd'
println(s + d)
//cloned = nums.clone()