From c78d98c0bae8381811438de001f009fbe5e881e8 Mon Sep 17 00:00:00 2001 From: Hunam Date: Fri, 1 Jul 2022 16:07:43 +0200 Subject: [PATCH] `@go` -> `golang` --- cmd/v/v.v | 2 +- vlib/v/ast/types.v | 2 +- vlib/v/builder/compile.v | 6 +++--- vlib/v/checker/checker.v | 4 ++-- vlib/v/checker/fn.v | 4 ++-- vlib/v/parser/parser.v | 7 ++----- vlib/v/pref/pref.v | 4 ++-- 7 files changed, 13 insertions(+), 16 deletions(-) diff --git a/cmd/v/v.v b/cmd/v/v.v index 4a304156dd..e3e10020f0 100644 --- a/cmd/v/v.v +++ b/cmd/v/v.v @@ -176,7 +176,7 @@ fn rebuild(prefs &pref.Preferences) { .interpret { util.launch_tool(prefs.is_verbose, 'builders/interpret_builder', os.args[1..]) } - .@go { + .golang { println('using Go WIP backend...') util.launch_tool(prefs.is_verbose, 'builders/go_builder', os.args[1..]) } diff --git a/vlib/v/ast/types.v b/vlib/v/ast/types.v index 71b4eb552c..44ba74266d 100644 --- a/vlib/v/ast/types.v +++ b/vlib/v/ast/types.v @@ -35,7 +35,7 @@ pub enum Language { v c js - @go + golang amd64 // aka x86_64 i386 arm64 // 64-bit arm diff --git a/vlib/v/builder/compile.v b/vlib/v/builder/compile.v index d0afb65ced..4aa0d5e77b 100644 --- a/vlib/v/builder/compile.v +++ b/vlib/v/builder/compile.v @@ -88,7 +88,7 @@ fn (mut b Builder) run_compiled_executable_and_exit() { os.find_abs_path_of_executable(node_basename) or { panic('Could not find `$node_basename` in system path. Do you have Node.js installed?') } - } else if b.pref.backend == .@go { + } else if b.pref.backend == .golang { go_basename := $if windows { 'go.exe' } $else { 'go' } os.find_abs_path_of_executable(go_basename) or { panic('Could not find `$go_basename` in system path. Do you have Go installed?') @@ -99,7 +99,7 @@ fn (mut b Builder) run_compiled_executable_and_exit() { mut run_args := []string{cap: b.pref.run_args.len + 1} if b.pref.backend.is_js() { run_args << compiled_file - } else if b.pref.backend == .@go { + } else if b.pref.backend == .golang { run_args << ['run', compiled_file] } run_args << b.pref.run_args @@ -195,7 +195,7 @@ pub fn (v Builder) get_builtin_files() []string { if v.pref.backend.is_js() { builtin_files << v.v_files_from_dir(os.join_path(location, 'builtin', 'js')) - } else if v.pref.backend == .@go { + } else if v.pref.backend == .golang { builtin_files << v.v_files_from_dir(os.join_path(location, 'builtin', 'go')) } else { diff --git a/vlib/v/checker/checker.v b/vlib/v/checker/checker.v index eea829fce9..7f372a7e50 100644 --- a/vlib/v/checker/checker.v +++ b/vlib/v/checker/checker.v @@ -1765,14 +1765,14 @@ fn (mut c Checker) hash_stmt(mut node ast.HashStmt) { if c.ct_cond_stack.len > 0 { node.ct_conds = c.ct_cond_stack.clone() } - if c.pref.backend.is_js() || c.pref.backend == .@go { + if c.pref.backend.is_js() || c.pref.backend == .golang { // consider the the best way to handle the .go.vv files if !c.file.path.ends_with('.js.v') && !c.file.path.ends_with('.go.v') && !c.file.path.ends_with('.go.vv') { c.error('hash statements are only allowed in backend specific files such "x.js.v" and "x.go.v"', node.pos) } - if c.mod == 'main' && c.pref.backend != .@go { + if c.mod == 'main' && c.pref.backend != .golang { c.error('hash statements are not allowed in the main module. Place them in a separate module.', node.pos) } diff --git a/vlib/v/checker/fn.v b/vlib/v/checker/fn.v index 55b25c2b3a..7e8fef265d 100644 --- a/vlib/v/checker/fn.v +++ b/vlib/v/checker/fn.v @@ -438,7 +438,7 @@ pub fn (mut c Checker) call_expr(mut node ast.CallExpr) ast.Type { pub fn (mut c Checker) fn_call(mut node ast.CallExpr, mut continue_check &bool) ast.Type { fn_name := node.name - if fn_name == 'main' && node.language != .@go { + if fn_name == 'main' && node.language != .golang { c.error('the `main` function cannot be called in the program', node.pos) } mut has_generic := false // foo() instead of foo() @@ -1292,7 +1292,7 @@ pub fn (mut c Checker) method_call(mut node ast.CallExpr) ast.Type { } else { c.fail_if_unreadable(node.left, left_type, 'receiver') } - if left_sym.language != .js && left_sym.language != .@go + if left_sym.language != .js && left_sym.language != .golang && (!left_sym.is_builtin() && method.mod != 'builtin') && method.language == .v && method.no_body { c.error('cannot call a method that does not have a body', node.pos) diff --git a/vlib/v/parser/parser.v b/vlib/v/parser/parser.v index 9d1acc9428..6af2a219b8 100644 --- a/vlib/v/parser/parser.v +++ b/vlib/v/parser/parser.v @@ -204,7 +204,7 @@ pub fn (mut p Parser) set_path(path string) { p.file_backend_mode = .js } 'go' { - p.file_backend_mode = .@go + p.file_backend_mode = .golang } else { arch := pref.arch_from_string(actual_language) or { pref.Arch._auto } @@ -3136,11 +3136,8 @@ fn (mut p Parser) module_decl() ast.Module { full_name := util.qualify_module(p.pref, name, p.file_name) p.mod = full_name p.builtin_mod = p.mod == 'builtin' - dump(p.builtin_mod) - dump(p.file_backend_mode) - dump(p.language) // NOTE: Not so sure about that - if p.builtin_mod && p.file_backend_mode == .@go { + if p.builtin_mod && p.file_backend_mode == .golang { is_skipped = true } mod_node = ast.Module{ diff --git a/vlib/v/pref/pref.v b/vlib/v/pref/pref.v index de602eb8b2..5b2440957a 100644 --- a/vlib/v/pref/pref.v +++ b/vlib/v/pref/pref.v @@ -51,7 +51,7 @@ pub enum Backend { js_freestanding // The JavaScript freestanding backend native // The Native backend interpret // Interpret the ast - @go // Go backend + golang // Go backend } pub fn (b Backend) is_js() bool { @@ -922,7 +922,7 @@ pub fn backend_from_string(s string) ?Backend { match s { 'c' { return .c } 'js' { return .js_node } - 'go' { return .@go } + 'go' { return .golang } 'js_node' { return .js_node } 'js_browser' { return .js_browser } 'js_freestanding' { return .js_freestanding }