From 7eaf289e33f2ba39269e7b94cf03ea569396893f Mon Sep 17 00:00:00 2001 From: Alexander Medvednikov Date: Thu, 3 Oct 2019 02:21:38 +0300 Subject: [PATCH] remove accidental duplicate code --- compiler/fn.v | 2 +- compiler/parser.v | 43 ------------------------------------------- 2 files changed, 1 insertion(+), 44 deletions(-) diff --git a/compiler/fn.v b/compiler/fn.v index 929b323ff0..25377aee99 100644 --- a/compiler/fn.v +++ b/compiler/fn.v @@ -92,7 +92,7 @@ fn (p mut Parser) mark_var_changed(v Var) { fn (p mut Parser) mark_arg_moved(v Var) { for i, arg in p.cur_fn.args { if arg.name == v.name { - //println('setting f $p.cur_fn.name arg $arg.name to is_mut') + println('setting f=$p.cur_fn.name arg=$arg.name to is_mut') p.cur_fn.args[i].is_moved = true break } diff --git a/compiler/parser.v b/compiler/parser.v index b71b84b589..2b8af9a8d4 100644 --- a/compiler/parser.v +++ b/compiler/parser.v @@ -1716,49 +1716,6 @@ fn (p mut Parser) name_expr() string { { name = p.prepend_mod(name) } - - // Variable, checked before modules, so module shadowing is allowed. - // (`gg = gg.newcontext(); gg.draw_rect(...)`) - for { // TODO remove - mut v := p.find_var_check_new_var(name) or { break } - if name == '_' { - p.error('cannot use `_` as value') - } - if ptr { - p.gen('&') - } - else if deref { - p.gen('*') - } - if p.pref.autofree && v.typ == 'string' && v.is_arg && - p.assigned_type == 'string' { - p.warn('setting moved ' + v.typ) - p.mark_arg_moved(v) - } - mut typ := p.var_expr(v) - // *var - if deref { - if !typ.contains('*') && !typ.ends_with('ptr') { - println('name="$name", t=$v.typ') - p.error('dereferencing requires a pointer, but got `$typ`') - } - typ = typ.replace('ptr', '')// TODO - typ = typ.replace('*', '')// TODO - } - // &var - else if ptr { - typ += '*' - } - if p.inside_return_expr { - //println('marking $v.name returned') - p.mark_var_returned(v) - // v.is_returned = true // TODO modifying a local variable - // that's not used afterwards, this should be a compilation - // error - } - return typ - } // TODO REMOVE for{} - // if known_type || is_c_struct_init || (p.first_pass() && p.peek() == .lcbr) { // known type? int(4.5) or Color.green (enum) if p.table.known_type(name) {