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

cgen: gen str() from eprintln and eprint as well

This commit is contained in:
Daniel Däschle 2020-04-17 16:15:28 +02:00 committed by GitHub
parent 420ecaf31d
commit c1d9e22ca6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -46,7 +46,7 @@ pub fn gen(files []ast.File, out_name string) {
mut g := Gen{
sect_header_name_pos: 0
// buf: []
out_name: out_name
}
g.generate_elf_header()
@ -366,9 +366,9 @@ fn (g mut Gen) expr(node ast.Expr) {
// `user := User{name: 'Bob'}`
ast.StructInit {}
ast.CallExpr {
if it.name == 'println' || it.name == 'print' {
if it.name in ['println', 'print', 'eprintln', 'eprint'] {
expr := it.args[0].expr
g.gen_print_from_expr(expr, it.name == 'println')
g.gen_print_from_expr(expr, it.name in ['println', 'eprintln'])
}
/*
g.write('${it.name}(')