mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
v2: simplify the type system; an initial version of the V interpreter
This commit is contained in:
@ -134,13 +134,13 @@ fn (v mut V) cc() {
|
||||
}
|
||||
|
||||
if !v.pref.is_so
|
||||
&& v.pref.build_mode != .build_module
|
||||
&& v.pref.build_mode != .build_module
|
||||
&& os.user_os() == 'windows'
|
||||
&& !v.out_name.ends_with('.exe')
|
||||
{
|
||||
v.out_name += '.exe'
|
||||
}
|
||||
|
||||
|
||||
// linux_host := os.user_os() == 'linux'
|
||||
v.log('cc() isprod=$v.pref.is_prod outname=$v.out_name')
|
||||
if v.pref.is_so {
|
||||
@ -356,13 +356,11 @@ start:
|
||||
if res.output.len < 30 {
|
||||
println(res.output)
|
||||
} else {
|
||||
max := 50
|
||||
n := if res.output.len > max { max } else { res.output.len }
|
||||
partial_output := res.output[res.output.len-n..].trim_right('\r\n')
|
||||
print(partial_output)
|
||||
if n < max {
|
||||
println('...\n(Use `v -cg` to print the entire error message)\n')
|
||||
}
|
||||
q := res.output.all_after('error: ').limit(150)
|
||||
println('==================')
|
||||
println(q)
|
||||
println('==================')
|
||||
println('...\n(Use `v -cg` to print the entire error message)\n')
|
||||
}
|
||||
}
|
||||
verror('C error. This should never happen. ' + '\nPlease create a GitHub issue: https://github.com/vlang/v/issues/new/choose')
|
||||
|
@ -63,7 +63,7 @@ fn (p mut Parser) bool_expression() string {
|
||||
p.gen('}')
|
||||
//p.satisfies_interface(expected, typ, true)
|
||||
}
|
||||
// e.g. `return BinaryExpr{}` in a function expecting `Expr`
|
||||
// e.g. `return InfixExpr{}` in a function expecting `Expr`
|
||||
if expected != typ && expected in p.table.sum_types { // TODO perf
|
||||
//p.warn('SUM CAST exp=$expected typ=$typ p.exp=$p.expected_type')
|
||||
T := p.table.find_type(typ)
|
||||
@ -87,7 +87,8 @@ fn (p mut Parser) bool_expression() string {
|
||||
if typ in p.table.sum_types {
|
||||
T := p.table.find_type(cast_typ)
|
||||
if T.parent != typ {
|
||||
p.error('cannot cast `$typ` to `$cast_typ`. `$cast_typ` is not a variant of `$typ`')
|
||||
p.error('cannot cast `$typ` to `$cast_typ`. `$cast_typ` is not a variant of `$typ`' +
|
||||
'parent=$T.parent')
|
||||
}
|
||||
p.cgen.set_placeholder(start_ph, '*($cast_typ*)')
|
||||
p.gen('.obj')
|
||||
|
@ -405,7 +405,6 @@ pub fn (v mut V) compile_x64() {
|
||||
}
|
||||
//v.files << v.v_files_from_dir(filepath.join(v.pref.vlib_path,'builtin','bare'))
|
||||
v.files << v.dir
|
||||
|
||||
mut b := builder.new_builder()
|
||||
b.build_x64(v.files, v.out_name)
|
||||
}
|
||||
|
Reference in New Issue
Block a user