1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

generics: another mut arg test

This commit is contained in:
Alexander Medvednikov 2020-06-05 20:57:02 +02:00
parent 073d9f3179
commit e3917d98c2
3 changed files with 13 additions and 6 deletions

View File

@ -217,7 +217,7 @@ static int fons__tt_buildGlyphBitmap(FONSttFontImpl *font, int glyph, float size
ftError = FT_Set_Pixel_Sizes(font->font, 0, (FT_UInt)(size * (float)font->font->units_per_EM / (float)(font->font->ascender - font->font->descender)));
if (ftError) return 0;
ftError = FT_Load_Glyph(font->font, glyph, FT_LOAD_RENDER);
ftError = FT_Load_Glyph(font->font, glyph, FT_LOAD_RENDER | FT_LOAD_FORCE_AUTOHINT);
if (ftError) return 0;
ftError = FT_Get_Advance(font->font, glyph, FT_LOAD_NO_SCALE, &advFixed);
if (ftError) return 0;

View File

@ -64,15 +64,22 @@ fn (u User) init() {
fn (c City) init() {
}
fn gen_arg<T>(mut x T) {
fn mut_arg<T>(mut x T) {
println(x.foo) // = 'foo'
}
/*
fn mut_arg2<T>(mut x T) T {
println(x.foo) // = 'foo'
return x
}
*/
fn test_create() {
create<User>()
create<City>()
u := User{}
gen_arg<User>(mut u)
mut_arg<User>(mut u)
// mut_arg2<User>(mut u)
}
/*

View File

@ -169,9 +169,9 @@ pub fn run<T>(port int) {
}
}
//fn handle_conn<T>(conn net.Socket, app mut T) {
fn handle_conn<T>(conn net.Socket, app_ T) T {
mut app := app_
fn handle_conn<T>(conn net.Socket, app mut T) {
//fn handle_conn<T>(conn net.Socket, app_ T) T {
//mut app := app_
//first_line := strip(lines[0])
first_line := conn.read_line()
println('firstline="$first_line"')