mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
allow field 'type'
This commit is contained in:
parent
830f63e86a
commit
31032d3a62
@ -321,7 +321,7 @@ fn (p mut Parser) fn_decl() {
|
|||||||
if !is_sig && !is_fn_header {
|
if !is_sig && !is_fn_header {
|
||||||
for {
|
for {
|
||||||
p.next()
|
p.next()
|
||||||
if p.tok.is_decl() {
|
if p.tok.is_decl() && !(p.prev_tok == .dot && p.tok == .key_type) {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -935,7 +935,7 @@ fn new_v(args[]string) *V {
|
|||||||
]
|
]
|
||||||
// Location of all vlib files
|
// Location of all vlib files
|
||||||
vroot := os.dir(os.executable())
|
vroot := os.dir(os.executable())
|
||||||
println('VROOT=$vroot')
|
//println('VROOT=$vroot')
|
||||||
// v.exe's parent directory should contain vlib
|
// v.exe's parent directory should contain vlib
|
||||||
if os.dir_exists(vroot) && os.dir_exists(vroot + '/vlib/builtin') {
|
if os.dir_exists(vroot) && os.dir_exists(vroot + '/vlib/builtin') {
|
||||||
|
|
||||||
|
@ -1561,8 +1561,10 @@ fn (p &Parser) fileis(s string) bool {
|
|||||||
// user.company.name => `str_typ` is `Company`
|
// user.company.name => `str_typ` is `Company`
|
||||||
fn (p mut Parser) dot(str_typ string, method_ph int) string {
|
fn (p mut Parser) dot(str_typ string, method_ph int) string {
|
||||||
p.check(.dot)
|
p.check(.dot)
|
||||||
field_name := p.lit
|
mut field_name := p.lit
|
||||||
p.fgen(field_name)
|
if p.tok == .key_type {
|
||||||
|
field_name = 'type'
|
||||||
|
}
|
||||||
p.log('dot() field_name=$field_name typ=$str_typ')
|
p.log('dot() field_name=$field_name typ=$str_typ')
|
||||||
//if p.fileis('main.v') {
|
//if p.fileis('main.v') {
|
||||||
//println('dot() field_name=$field_name typ=$str_typ prev_tok=${prev_tok.str()}')
|
//println('dot() field_name=$field_name typ=$str_typ prev_tok=${prev_tok.str()}')
|
||||||
|
Loading…
Reference in New Issue
Block a user