1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

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

This commit is contained in:
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
}
// `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
}
// 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)
// TODO, string(b, len)
// 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.expr(0) // len
}