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

ast: fix error for 'for smartcast' - part 2 (#13635)

This commit is contained in:
yuyi 2022-03-02 22:01:20 +08:00 committed by GitHub
parent ffe6ff3cc8
commit 36e80266e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 11 deletions

View File

@ -269,8 +269,8 @@ pub fn (e &SelectorExpr) root_ident() ?Ident {
for mut root is SelectorExpr {
root = root.expr
}
if root is Ident {
return root as Ident
if mut root is Ident {
return root
}
return none

View File

@ -1489,9 +1489,8 @@ pub fn (mut t Table) resolve_generic_to_concrete(generic_type Type, generic_name
mut elem_type := sym.info.elem_type
mut elem_sym := t.sym(elem_type)
mut dims := 1
for elem_sym.info is Array {
info := elem_sym.info as Array
elem_type = info.elem_type
for mut elem_sym.info is Array {
elem_type = elem_sym.info.elem_type
elem_sym = t.sym(elem_type)
dims++
}
@ -1646,9 +1645,8 @@ pub fn (mut t Table) unwrap_generic_type(typ Type, generic_names []string, concr
mut elem_type := ts.info.elem_type
mut elem_sym := t.sym(elem_type)
mut dims := 1
for elem_sym.info is Array {
info := elem_sym.info as Array
elem_type = info.elem_type
for mut elem_sym.info is Array {
elem_type = elem_sym.info.elem_type
elem_sym = t.sym(elem_type)
dims++
}
@ -1857,9 +1855,8 @@ pub fn (mut t Table) replace_generic_type(typ Type, generic_types []Type) {
mut elem_type := ts.info.elem_type
mut elem_sym := t.sym(elem_type)
mut dims := 1
for elem_sym.info is Array {
info := elem_sym.info as Array
elem_type = info.elem_type
for mut elem_sym.info is Array {
elem_type = elem_sym.info.elem_type
elem_sym = t.sym(elem_type)
dims++
}