cmd/v: fix `run`

pull/4274/head
Alexander Medvednikov 2020-04-07 01:09:25 +02:00
parent b7560fe4bf
commit 33644a4f91
2 changed files with 8 additions and 2 deletions

View File

@ -47,8 +47,8 @@ fn main() {
return return
} }
prefs, command := parse_args(args) prefs, command := parse_args(args)
//println('main() command = $command')
if prefs.is_verbose { if prefs.is_verbose {
println('command = "$command"')
println(util.full_v_version()) println(util.full_v_version())
} }
if prefs.is_verbose { if prefs.is_verbose {
@ -168,6 +168,12 @@ fn parse_args(args []string) (&pref.Preferences, string) {
if command.ends_with('.v') || os.exists(command) { if command.ends_with('.v') || os.exists(command) {
res.path = 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() res.fill_with_defaults()
return res, command return res, command
} }

View File

@ -117,7 +117,7 @@ fn (p mut Parser) fn_decl() ast.FnDecl {
p.error('function names cannot contain uppercase letters, use snake_case instead') 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) { 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] { if p.tok.kind in [.plus, .minus, .mul, .div, .mod] {