mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
parser: check (mut f Foo) syntax
This commit is contained in:
@@ -152,7 +152,7 @@ fn new_gen_vc(flag_options FlagOptions) &GenVC {
|
||||
}
|
||||
|
||||
// WebhookServer init
|
||||
pub fn (ws mut WebhookServer) init() {
|
||||
pub fn (mut ws WebhookServer) init() {
|
||||
|
||||
mut fp := flag.new_flag_parser(os.args.clone())
|
||||
flag_options := parse_flags(mut fp)
|
||||
@@ -162,7 +162,7 @@ pub fn (ws mut WebhookServer) init() {
|
||||
}
|
||||
|
||||
// gen webhook
|
||||
pub fn (ws mut WebhookServer) genhook() {
|
||||
pub fn (mut ws WebhookServer) genhook() {
|
||||
ws.gen_vc.generate()
|
||||
// error in generate
|
||||
if ws.gen_vc.gen_error {
|
||||
@@ -191,7 +191,7 @@ fn parse_flags(fp mut flag.FlagParser) FlagOptions {
|
||||
}
|
||||
|
||||
// init
|
||||
fn (gen_vc mut GenVC) init() {
|
||||
fn (mut gen_vc GenVC) init() {
|
||||
// purge repos if flag is passed
|
||||
if gen_vc.options.purge {
|
||||
gen_vc.purge_repos()
|
||||
@@ -199,7 +199,7 @@ fn (gen_vc mut GenVC) init() {
|
||||
}
|
||||
|
||||
// regenerate
|
||||
fn (gen_vc mut GenVC) generate() {
|
||||
fn (mut gen_vc GenVC) generate() {
|
||||
// set errors to false
|
||||
gen_vc.gen_error = false
|
||||
|
||||
@@ -316,17 +316,17 @@ fn (gen_vc mut GenVC) generate() {
|
||||
}
|
||||
|
||||
// only execute when dry_run option is false, otherwise just log
|
||||
fn (gen_vc mut GenVC) cmd_exec_safe(cmd string) string {
|
||||
fn (mut gen_vc GenVC) cmd_exec_safe(cmd string) string {
|
||||
return gen_vc.command_execute(cmd, gen_vc.options.dry_run)
|
||||
}
|
||||
|
||||
// always execute command
|
||||
fn (gen_vc mut GenVC) cmd_exec(cmd string) string {
|
||||
fn (mut gen_vc GenVC) cmd_exec(cmd string) string {
|
||||
return gen_vc.command_execute(cmd, false)
|
||||
}
|
||||
|
||||
// execute command
|
||||
fn (gen_vc mut GenVC) command_execute(cmd string, dry bool) string {
|
||||
fn (mut gen_vc GenVC) command_execute(cmd string, dry bool) string {
|
||||
// if dry is true then dont execute, just log
|
||||
if dry {
|
||||
return gen_vc.command_execute_dry(cmd)
|
||||
@@ -352,13 +352,13 @@ fn (gen_vc mut GenVC) command_execute(cmd string, dry bool) string {
|
||||
}
|
||||
|
||||
// just log cmd, dont execute
|
||||
fn (gen_vc mut GenVC) command_execute_dry(cmd string) string {
|
||||
fn (mut gen_vc GenVC) command_execute_dry(cmd string) string {
|
||||
gen_vc.logger.info('cmd (dry): "$cmd"')
|
||||
return ''
|
||||
}
|
||||
|
||||
// delete repo directories
|
||||
fn (gen_vc mut GenVC) purge_repos() {
|
||||
fn (mut gen_vc GenVC) purge_repos() {
|
||||
// delete old repos (better to be fully explicit here, since these are destructive operations)
|
||||
mut repo_dir := '$gen_vc.options.work_dir/$git_repo_dir_v'
|
||||
if os.is_dir(repo_dir) {
|
||||
@@ -373,7 +373,7 @@ fn (gen_vc mut GenVC) purge_repos() {
|
||||
}
|
||||
|
||||
// check if file size is too short
|
||||
fn (gen_vc mut GenVC) assert_file_exists_and_is_not_too_short(f string, emsg string){
|
||||
fn (mut gen_vc GenVC) assert_file_exists_and_is_not_too_short(f string, emsg string){
|
||||
if !os.exists(f) {
|
||||
gen_vc.logger.error('$err_msg_build: $emsg .')
|
||||
gen_vc.gen_error = true
|
||||
|
||||
@@ -27,7 +27,7 @@ pub mut:
|
||||
message_handler &TestMessageHandler
|
||||
}
|
||||
|
||||
pub fn (mh mut TestMessageHandler) append_message(msg string) {
|
||||
pub fn (mut mh TestMessageHandler) append_message(msg string) {
|
||||
mh.mtx.lock()
|
||||
mh.messages << msg
|
||||
mh.mtx.unlock()
|
||||
@@ -54,11 +54,11 @@ pub fn new_test_session(_vargs string) TestSession {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn (ts mut TestSession) init() {
|
||||
pub fn (mut ts TestSession) init() {
|
||||
ts.benchmark = benchmark.new_benchmark_no_cstep()
|
||||
}
|
||||
|
||||
pub fn (ts mut TestSession) test() {
|
||||
pub fn (mut ts TestSession) test() {
|
||||
ts.init()
|
||||
mut remaining_files := []string{}
|
||||
for dot_relative_file in ts.files {
|
||||
@@ -111,7 +111,7 @@ pub fn (ts mut TestSession) test() {
|
||||
eprintln(term.h_divider('-'))
|
||||
}
|
||||
|
||||
pub fn (m mut TestMessageHandler) display_message() {
|
||||
pub fn (mut m TestMessageHandler) display_message() {
|
||||
m.mtx.lock()
|
||||
defer {
|
||||
m.messages.clear()
|
||||
|
||||
@@ -92,7 +92,7 @@ pub mut:
|
||||
vvlocation string // v.v or compiler/ or cmd/v, depending on v version
|
||||
}
|
||||
|
||||
pub fn (vgit_context mut VGitContext) compile_oldv_if_needed() {
|
||||
pub fn (mut vgit_context VGitContext) compile_oldv_if_needed() {
|
||||
vgit_context.vexename = if os.user_os() == 'windows' { 'v.exe' } else { 'v' }
|
||||
vgit_context.vexepath = os.real_path(os.join_path(vgit_context.path_v, vgit_context.vexename))
|
||||
mut command_for_building_v_from_c_source := ''
|
||||
|
||||
@@ -40,7 +40,7 @@ mut:
|
||||
cleanup bool // should the tool run a cleanup first
|
||||
}
|
||||
|
||||
fn (c mut Context) compile_oldv_if_needed() {
|
||||
fn (mut c Context) compile_oldv_if_needed() {
|
||||
mut vgit_context := vgit.VGitContext{
|
||||
workdir: c.vgo.workdir
|
||||
v_repo_url: c.vgo.v_repo_url
|
||||
|
||||
@@ -36,7 +36,7 @@ fn start_testing(total_number_of_tests int, vfilename string) BenchedTests {
|
||||
}
|
||||
|
||||
// Called before each test_ function, defined in file_test.v
|
||||
fn (b mut BenchedTests) testing_step_start(stepfunc string) {
|
||||
fn (mut b BenchedTests) testing_step_start(stepfunc string) {
|
||||
b.step_func_name = stepfunc.replace('main__', '').replace('__', '.')
|
||||
b.oks = C.g_test_oks
|
||||
b.fails = C.g_test_fails
|
||||
@@ -44,7 +44,7 @@ fn (b mut BenchedTests) testing_step_start(stepfunc string) {
|
||||
}
|
||||
|
||||
// Called after each test_ function, defined in file_test.v
|
||||
fn (b mut BenchedTests) testing_step_end() {
|
||||
fn (mut b BenchedTests) testing_step_end() {
|
||||
ok_diff := C.g_test_oks - b.oks
|
||||
fail_diff := C.g_test_fails - b.fails
|
||||
// ////////////////////////////////////////////////////////////////
|
||||
@@ -76,7 +76,7 @@ fn (b &BenchedTests) fn_name() string {
|
||||
}
|
||||
|
||||
// Called at the end of the test program produced by `v -stats file_test.v`
|
||||
fn (b mut BenchedTests) end_testing() {
|
||||
fn (mut b BenchedTests) end_testing() {
|
||||
b.bench.stop()
|
||||
println(INNER_INDENT + b.bench.total_message('running V tests in "' + os.file_name(b.test_suit_file) + '"'))
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ mut:
|
||||
temp_lines []string // all the temporary expressions/printlns
|
||||
}
|
||||
|
||||
fn (r mut Repl) checks() bool {
|
||||
fn (mut r Repl) checks() bool {
|
||||
mut in_string := false
|
||||
was_indent := r.indent > 0
|
||||
|
||||
|
||||
Reference in New Issue
Block a user