From 361d12bf43800153f4b9ceab5fc8516dde64ce2d Mon Sep 17 00:00:00 2001 From: Alexander Medvednikov Date: Tue, 14 Jul 2020 00:27:47 +0200 Subject: [PATCH] pref: -experimental flag --- vlib/v/gen/fn.v | 4 ++-- vlib/v/pref/pref.v | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/vlib/v/gen/fn.v b/vlib/v/gen/fn.v index c3abc77f11..93e4a04a03 100644 --- a/vlib/v/gen/fn.v +++ b/vlib/v/gen/fn.v @@ -270,7 +270,7 @@ fn (mut g Gen) call_expr(node ast.CallExpr) { g.write('$styp $tmp_opt = ') } if node.is_method && !node.is_field { - if node.name == 'writeln' && g.pref.show_cc && + if node.name == 'writeln' && g.pref.experimental && node.args.len > 0 && node.args[0].expr is ast.StringInterLiteral && g.table.get_type_symbol(node.receiver_type).name == 'strings.Builder' { g.string_inter_literal_sb_optimized(node) @@ -644,7 +644,7 @@ fn (mut g Gen) ref_or_deref_arg(arg ast.CallArg, expected_type table.Type) { } } if !g.is_json_fn { - arg_typ_sym := g.table.get_type_symbol(arg.typ) + arg_typ_sym := g.table.get_type_symbol(arg.typ) if arg_typ_sym.kind != .function { g.write('(voidptr)&/*qq*/') } diff --git a/vlib/v/pref/pref.v b/vlib/v/pref/pref.v index 0e4ea9aa47..39c57bd96c 100644 --- a/vlib/v/pref/pref.v +++ b/vlib/v/pref/pref.v @@ -116,6 +116,7 @@ pub mut: error_limit int is_vweb bool // skip _ var warning in templates only_check_syntax bool // when true, just parse the files, then stop, before running checker + experimental bool // enable experimental features } pub fn parse_args(args []string) (&Preferences, string) { @@ -196,6 +197,9 @@ pub fn parse_args(args []string) (&Preferences, string) { '-showcc' { res.show_cc = true } + '-experimental' { + res.experimental = true + } '-usecache' { res.use_cache = true }