allow field 'type'

pull/1177/head
Alexander Medvednikov 2019-07-16 13:01:39 +02:00
parent 830f63e86a
commit 31032d3a62
3 changed files with 6 additions and 4 deletions

View File

@ -321,7 +321,7 @@ fn (p mut Parser) fn_decl() {
if !is_sig && !is_fn_header {
for {
p.next()
if p.tok.is_decl() {
if p.tok.is_decl() && !(p.prev_tok == .dot && p.tok == .key_type) {
break
}
}

View File

@ -935,7 +935,7 @@ fn new_v(args[]string) *V {
]
// Location of all vlib files
vroot := os.dir(os.executable())
println('VROOT=$vroot')
//println('VROOT=$vroot')
// v.exe's parent directory should contain vlib
if os.dir_exists(vroot) && os.dir_exists(vroot + '/vlib/builtin') {

View File

@ -1561,8 +1561,10 @@ fn (p &Parser) fileis(s string) bool {
// user.company.name => `str_typ` is `Company`
fn (p mut Parser) dot(str_typ string, method_ph int) string {
p.check(.dot)
field_name := p.lit
p.fgen(field_name)
mut field_name := p.lit
if p.tok == .key_type {
field_name = 'type'
}
p.log('dot() field_name=$field_name typ=$str_typ')
//if p.fileis('main.v') {
//println('dot() field_name=$field_name typ=$str_typ prev_tok=${prev_tok.str()}')