alex

/

v Public
0 Issues 1 Contributor 0 Releases 4 Branches
Additions: 13 Deletions: 16 View patch
1 .interpret {
2 util.launch_tool(prefs.is_verbose, 'builders/interpret_builder', os.args[1..])
3 }
4- [email protected]go {
5+ .golang {
6 println('using Go WIP backend...')
7 util.launch_tool(prefs.is_verbose, 'builders/go_builder', os.args[1..])
8 }
9
1 v
2 c
3 js
4- @go
5+ golang
6 amd64 // aka x86_64
7 i386
8 arm64 // 64-bit arm
9
1 os.find_abs_path_of_executable(node_basename) or {
2 panic('Could not find `$node_basename` in system path. Do you have Node.js installed?')
3 }
4- } else if b.pref.backend == [email protected]go {
5+ } else if b.pref.backend == .golang {
6 go_basename := $if windows { 'go.exe' } $else { 'go' }
7 os.find_abs_path_of_executable(go_basename) or {
8 panic('Could not find `$go_basename` in system path. Do you have Go installed?')
9 mut run_args := []string{cap: b.pref.run_args.len + 1}
10 if b.pref.backend.is_js() {
11 run_args << compiled_file
12- } else if b.pref.backend == [email protected]go {
13+ } else if b.pref.backend == .golang {
14 run_args << ['run', compiled_file]
15 }
16 run_args << b.pref.run_args
17 if v.pref.backend.is_js() {
18 builtin_files << v.v_files_from_dir(os.join_path(location, 'builtin',
19 'js'))
20- } else if v.pref.backend == [email protected]go {
21+ } else if v.pref.backend == .golang {
22 builtin_files << v.v_files_from_dir(os.join_path(location, 'builtin',
23 'go'))
24 } else {
25
1 if c.ct_cond_stack.len > 0 {
2 node.ct_conds = c.ct_cond_stack.clone()
3 }
4- if c.pref.backend.is_js() || c.pref.backend == [email protected]go {
5+ if c.pref.backend.is_js() || c.pref.backend == .golang {
6 // consider the the best way to handle the .go.vv files
7 if !c.file.path.ends_with('.js.v') && !c.file.path.ends_with('.go.v')
8 && !c.file.path.ends_with('.go.vv') {
9 c.error('hash statements are only allowed in backend specific files such "x.js.v" and "x.go.v"',
10 node.pos)
11 }
12- if c.mod == 'main' && c.pref.backend != [email protected]go {
13+ if c.mod == 'main' && c.pref.backend != .golang {
14 c.error('hash statements are not allowed in the main module. Place them in a separate module.',
15 node.pos)
16 }
17
1
2 pub fn (mut c Checker) fn_call(mut node ast.CallExpr, mut continue_check &bool) ast.Type {
3 fn_name := node.name
4- if fn_name == 'main' && node.language != [email protected]go {
5+ if fn_name == 'main' && node.language != .golang {
6 c.error('the `main` function cannot be called in the program', node.pos)
7 }
8 mut has_generic := false // foo<T>() instead of foo<int>()
9 } else {
10 c.fail_if_unreadable(node.left, left_type, 'receiver')
11 }
12- if left_sym.language != .js && left_sym.language != [email protected]go
13+ if left_sym.language != .js && left_sym.language != .golang
14 && (!left_sym.is_builtin() && method.mod != 'builtin') && method.language == .v
15 && method.no_body {
16 c.error('cannot call a method that does not have a body', node.pos)
17
1 p.file_backend_mode = .js
2 }
3 'go' {
4- p.file_backend_mode = [email protected]go
5+ p.file_backend_mode = .golang
6 }
7 else {
8 arch := pref.arch_from_string(actual_language) or { pref.Arch._auto }
9 full_name := util.qualify_module(p.pref, name, p.file_name)
10 p.mod = full_name
11 p.builtin_mod = p.mod == 'builtin'
12- dump(p.builtin_mod)
13- dump(p.file_backend_mode)
14- dump(p.language)
15 // NOTE: Not so sure about that
16- if p.builtin_mod && p.file_backend_mode == [email protected]go {
17+ if p.builtin_mod && p.file_backend_mode == .golang {
18 is_skipped = true
19 }
20 mod_node = ast.Module{
21
1 js_freestanding // The JavaScript freestanding backend
2 native // The Native backend
3 interpret // Interpret the ast
4- @go // Go backend
5+ golang // Go backend
6 }
7
8 pub fn (b Backend) is_js() bool {
9 match s {
10 'c' { return .c }
11 'js' { return .js_node }
12- 'go' { return [email protected]go }
13+ 'go' { return .golang }
14 'js_node' { return .js_node }
15 'js_browser' { return .js_browser }
16 'js_freestanding' { return .js_freestanding }
17