Skip to content

Commit

Permalink
@go -> golang
Browse files Browse the repository at this point in the history
  • Loading branch information
Hunam6 committed Jul 1, 2022
1 parent 1cb752f commit c78d98c
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 16 deletions.
2 changes: 1 addition & 1 deletion cmd/v/v.v
Original file line number Diff line number Diff line change
Expand Up @@ -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..])
}
Expand Down
2 changes: 1 addition & 1 deletion vlib/v/ast/types.v
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ pub enum Language {
v
c
js
@go
golang
amd64 // aka x86_64
i386
arm64 // 64-bit arm
Expand Down
6 changes: 3 additions & 3 deletions vlib/v/builder/compile.v
Original file line number Diff line number Diff line change
Expand Up @@ -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?')
Expand All @@ -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
Expand Down Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions vlib/v/checker/checker.v
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
4 changes: 2 additions & 2 deletions vlib/v/checker/fn.v
Original file line number Diff line number Diff line change
Expand Up @@ -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<T>() instead of foo<int>()
Expand Down Expand Up @@ -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)
Expand Down
7 changes: 2 additions & 5 deletions vlib/v/parser/parser.v
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down Expand Up @@ -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{
Expand Down
4 changes: 2 additions & 2 deletions vlib/v/pref/pref.v
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 }
Expand Down

0 comments on commit c78d98c

Please sign in to comment.