diff --git a/vlib/v/checker/checker.v b/vlib/v/checker/checker.v index 9d2f448b05..c4a6f37b87 100644 --- a/vlib/v/checker/checker.v +++ b/vlib/v/checker/checker.v @@ -12,6 +12,7 @@ import v.pref import v.util import v.errors import v.pkgconfig +import v.gen.native const int_min = int(0x80000000) @@ -2069,7 +2070,14 @@ pub fn (mut c Checker) fn_call(mut call_expr ast.CallExpr) ast.Type { c.table.fns[fn_name].usages++ } } - if c.pref.is_script && !found { + if !found && c.pref.backend == .native { + if fn_name in native.builtins { + found = true + c.table.fns[fn_name].usages++ + return ast.string_type + } + } + if !found && c.pref.is_script && !found { os_name := 'os.$fn_name' if f := c.table.find_fn(os_name) { if f.generic_names.len == call_expr.concrete_types.len { diff --git a/vlib/v/gen/native/gen.v b/vlib/v/gen/native/gen.v index ef4796312a..2b895fe639 100644 --- a/vlib/v/gen/native/gen.v +++ b/vlib/v/gen/native/gen.v @@ -11,6 +11,8 @@ import v.errors import v.pref import term +pub const builtins = ['println', 'exit'] + interface CodeGen { g Gen allocate_var(name string, size int, initial_val int) @@ -70,8 +72,7 @@ pub fn gen(files []ast.File, table &ast.Table, out_name string, pref &pref.Prefe eprintln('Warning: ${file.warnings[0]}') } if file.errors.len > 0 { - eprintln('Error ${file.errors[0]}') - // verror('Error ${file.errors[0]}') + verror('Error ${file.errors[0]}') } g.stmts(file.stmts) }