mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
@go
-> golang
This commit is contained in:
parent
1cb752f722
commit
c78d98c0ba
@ -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..])
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ pub enum Language {
|
||||
v
|
||||
c
|
||||
js
|
||||
@go
|
||||
golang
|
||||
amd64 // aka x86_64
|
||||
i386
|
||||
arm64 // 64-bit arm
|
||||
|
@ -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 {
|
||||
|
@ -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)
|
||||
}
|
||||
|
@ -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>()
|
||||
@ -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)
|
||||
|
@ -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{
|
||||
|
@ -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 }
|
||||
|
Loading…
Reference in New Issue
Block a user