mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
parse_files(); ast.File
This commit is contained in:
@ -9,6 +9,10 @@ import (
|
||||
strings
|
||||
filepath
|
||||
compiler.x64
|
||||
//v.table
|
||||
//v.parser
|
||||
//v.gen
|
||||
//v.types
|
||||
)
|
||||
|
||||
pub const (
|
||||
@ -25,7 +29,8 @@ enum BuildMode {
|
||||
}
|
||||
|
||||
const (
|
||||
supported_platforms = ['windows', 'mac', 'macos', 'linux', 'freebsd', 'openbsd', 'netbsd', 'dragonfly', 'android', 'js', 'solaris', 'haiku']
|
||||
supported_platforms = ['windows', 'mac', 'macos', 'linux', 'freebsd', 'openbsd', 'netbsd',
|
||||
'dragonfly', 'android', 'js', 'solaris', 'haiku']
|
||||
)
|
||||
|
||||
enum OS {
|
||||
@ -373,6 +378,43 @@ pub fn (v mut V) compile() {
|
||||
v.cc()
|
||||
}
|
||||
|
||||
/*
|
||||
pub fn (v mut V) compile2() {
|
||||
if os.user_os() != 'windows' && v.pref.ccompiler == 'msvc' {
|
||||
verror('Cannot build with msvc on ${os.user_os()}')
|
||||
}
|
||||
//cgen.genln('// Generated by V')
|
||||
println('compile2()')
|
||||
if v.pref.is_verbose {
|
||||
println('all .v files before:')
|
||||
println(v.files)
|
||||
}
|
||||
v.add_v_files_to_compile()
|
||||
if v.pref.is_verbose {
|
||||
println('all .v files:')
|
||||
println(v.files)
|
||||
}
|
||||
table := &table.Table{}
|
||||
files := parser.parse_files(v.files, table)
|
||||
c := gen.cgen(files)
|
||||
println('out: $v.out_name_c')
|
||||
os.write_file(v.out_name_c, c)
|
||||
/*
|
||||
cgen.genln(c_builtin_types)
|
||||
|
||||
if !v.pref.is_bare {
|
||||
cgen.genln(c_headers)
|
||||
}
|
||||
else {
|
||||
cgen.genln(bare_c_headers)
|
||||
}
|
||||
}
|
||||
*/
|
||||
v.cc()
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
pub fn (v mut V) compile_x64() {
|
||||
$if !linux {
|
||||
println('v -x64 can only generate Linux binaries for now')
|
||||
@ -513,7 +555,7 @@ pub fn (v mut V) generate_main() {
|
||||
else if v.v_fmt_file=='' && !v.pref.is_repl {
|
||||
verror('function `main` is not declared in the main module')
|
||||
}
|
||||
}
|
||||
}
|
||||
else if v.pref.is_test {
|
||||
if v.table.main_exists() {
|
||||
verror('test files cannot have function `main`')
|
||||
|
Reference in New Issue
Block a user