mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
v.ast: fix dump(os.real_path(Makefile))
printing main.os.real_path
This commit is contained in:
parent
4bea35b028
commit
e8c8f0e7c0
@ -311,6 +311,9 @@ pub fn (x Expr) str() string {
|
||||
if x.mod == '' && x.name == '' {
|
||||
return x.left.str() + '($sargs)$propagate_suffix'
|
||||
}
|
||||
if x.name.contains('.') {
|
||||
return '${x.name}($sargs)$propagate_suffix'
|
||||
}
|
||||
return '${x.mod}.${x.name}($sargs)$propagate_suffix'
|
||||
}
|
||||
CharLiteral {
|
||||
|
@ -1,17 +1,19 @@
|
||||
[vlib/v/tests/inout/dump_expression.vv:2] 1: 1
|
||||
[vlib/v/tests/inout/dump_expression.vv:7] 'a': a
|
||||
[vlib/v/tests/inout/dump_expression.vv:23] p: Point{
|
||||
[vlib/v/tests/inout/dump_expression.vv:4] 1: 1
|
||||
[vlib/v/tests/inout/dump_expression.vv:9] 'a': a
|
||||
[vlib/v/tests/inout/dump_expression.vv:25] p: Point{
|
||||
x: 1
|
||||
y: 2
|
||||
z: 3
|
||||
}
|
||||
[vlib/v/tests/inout/dump_expression.vv:24] p_mut: Point{
|
||||
[vlib/v/tests/inout/dump_expression.vv:26] p_mut: Point{
|
||||
x: 1
|
||||
y: 2
|
||||
z: 3
|
||||
}
|
||||
[vlib/v/tests/inout/dump_expression.vv:25] p_ptr: &Point{
|
||||
[vlib/v/tests/inout/dump_expression.vv:27] p_ptr: &Point{
|
||||
x: 1
|
||||
y: 2
|
||||
z: 3
|
||||
}
|
||||
[vlib/v/tests/inout/dump_expression.vv:38] os.file_name(vexe).replace('.exe', ''): v
|
||||
[vlib/v/tests/inout/dump_expression.vv:41] f.read(mut buf): 10
|
||||
|
@ -1,3 +1,5 @@
|
||||
import os
|
||||
|
||||
fn dump_of_int() {
|
||||
x := dump(1) + 1
|
||||
assert x == 2
|
||||
@ -31,8 +33,18 @@ fn dump_of_struct() {
|
||||
assert x3 == Point{101, 2, 3}
|
||||
}
|
||||
|
||||
fn dump_of_callexpr() {
|
||||
vexe := @VEXE
|
||||
dump(os.file_name(vexe).replace('.exe', ''))
|
||||
mut f := os.open_file(os.join_path(os.dir(vexe), 'Makefile'), 'r') or { return }
|
||||
mut buf := []byte{len:10}
|
||||
dump( f.read(mut buf) or { -999 })
|
||||
f.close()
|
||||
}
|
||||
|
||||
fn main() {
|
||||
dump_of_int()
|
||||
dump_of_string()
|
||||
dump_of_struct()
|
||||
dump_of_callexpr()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user