v2: update parse type not to prefix builtin types with module

pull/3755/head
joe-conigliaro 2020-02-17 02:16:19 +11:00 committed by GitHub
parent 195f3f465b
commit 1007dd8f23
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -110,7 +110,7 @@ pub fn (p mut Parser) parse_type() table.Type {
name += '.' + p.tok.lit name += '.' + p.tok.lit
} }
// `Foo` in module `mod` means `mod.Foo` // `Foo` in module `mod` means `mod.Foo`
else if p.mod != 'main' { else if p.mod != 'main' && !(name in table.builtin_type_names) {
name = p.mod + '.' + name name = p.mod + '.' + name
} }
// p.warn('get type $name') // p.warn('get type $name')

View File

@ -574,7 +574,7 @@ pub fn (p mut Parser) name_expr() (ast.Expr,table.Type) {
expr,_ = p.expr(0) expr,_ = p.expr(0)
// TODO, string(b, len) // TODO, string(b, len)
// if table.type_idx(to_typ) == table.string_type_idx && p.tok.kind == .comma { // if table.type_idx(to_typ) == table.string_type_idx && p.tok.kind == .comma {
if p.tok.kind == .comma && name == 'string' { if p.tok.kind == .comma && table.type_idx(to_typ) == table.string_type_idx {
p.check(.comma) p.check(.comma)
p.expr(0) // len p.expr(0) // len
} }