roadmap: io streams

pull/5902/head
Alexander Medvednikov 2020-07-20 22:51:17 +02:00
parent 059722f211
commit 303b65c0b9
3 changed files with 6 additions and 3 deletions

View File

@ -12,6 +12,7 @@
- make `-autofree` the default - make `-autofree` the default
- parallel parser (and maybe checker/gen?) - parallel parser (and maybe checker/gen?)
- `recover()` from panics - `recover()` from panics
- IO streams

View File

@ -742,6 +742,8 @@ fn (mut g Gen) stmt(node ast.Stmt) {
} }
} }
if g.pref.use_cache { if g.pref.use_cache {
// We are using prebuilt modules, we do not need to generate
// their functions in main.c.
if node.mod != 'main' { if node.mod != 'main' {
skip = true skip = true
} }

View File

@ -107,7 +107,7 @@ fn (mut g Gen) gen_fn_decl(it ast.FnDecl, skip bool) {
fargs, fargtypes := g.fn_args(it.args, it.is_variadic) fargs, fargtypes := g.fn_args(it.args, it.is_variadic)
if it.no_body || (g.pref.use_cache && it.is_builtin) || skip { if it.no_body || (g.pref.use_cache && it.is_builtin) || skip {
// Just a function header. Builtin function bodies are defined in builtin.o // Just a function header. Builtin function bodies are defined in builtin.o
g.definitions.writeln('); // NO BODY') g.definitions.writeln(');') // // NO BODY')
g.writeln(');') g.writeln(');')
return return
} }
@ -142,11 +142,11 @@ fn (mut g Gen) gen_fn_decl(it ast.FnDecl, skip bool) {
g.profile_fn(it.name) g.profile_fn(it.name)
} }
g.stmts(it.stmts) g.stmts(it.stmts)
// //////////// //
if it.return_type == table.void_type { if it.return_type == table.void_type {
g.write_defer_stmts_when_needed() g.write_defer_stmts_when_needed()
} }
// ///////// //
if g.autofree && !g.pref.experimental { if g.autofree && !g.pref.experimental {
// TODO: remove this, when g.write_autofree_stmts_when_needed works properly // TODO: remove this, when g.write_autofree_stmts_when_needed works properly
g.autofree_scope_vars(it.body_pos.pos) g.autofree_scope_vars(it.body_pos.pos)