From 33644a4f91f2664adae959b67c0d000c4598a77d Mon Sep 17 00:00:00 2001 From: Alexander Medvednikov Date: Tue, 7 Apr 2020 01:09:25 +0200 Subject: [PATCH] cmd/v: fix `run` --- cmd/v/v.v | 8 +++++++- vlib/v/parser/fn.v | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/cmd/v/v.v b/cmd/v/v.v index b3b5fa38e8..c1d5ae1552 100644 --- a/cmd/v/v.v +++ b/cmd/v/v.v @@ -47,8 +47,8 @@ fn main() { return } prefs, command := parse_args(args) - //println('main() command = $command') if prefs.is_verbose { + println('command = "$command"') println(util.full_v_version()) } if prefs.is_verbose { @@ -168,6 +168,12 @@ fn parse_args(args []string) (&pref.Preferences, string) { if command.ends_with('.v') || os.exists(command) { res.path = command } + else if command == 'run' { + res.path = args[args.len-1] + } + if res.is_verbose { + println('setting pref.path to "$res.path"') + } res.fill_with_defaults() return res, command } diff --git a/vlib/v/parser/fn.v b/vlib/v/parser/fn.v index c2f22957db..285cf91333 100644 --- a/vlib/v/parser/fn.v +++ b/vlib/v/parser/fn.v @@ -117,7 +117,7 @@ fn (p mut Parser) fn_decl() ast.FnDecl { p.error('function names cannot contain uppercase letters, use snake_case instead') } if is_method && p.table.get_type_symbol(rec_type).has_method(name) { - p.warn('duplicate method `$name`') + p.error('duplicate method `$name`') } } if p.tok.kind in [.plus, .minus, .mul, .div, .mod] {