parser: fix error for 'for smartcast' - part 1 (#13629)

pull/13635/head
yuyi 2022-03-02 18:18:03 +08:00 committed by GitHub
parent 7f8f571ed2
commit 22017ff8f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

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

View File

@ -2734,7 +2734,7 @@ fn (mut p Parser) dot_expr(left ast.Expr) ast.Expr {
} }
mut is_mut := false mut is_mut := false
mut mut_pos := token.Pos{} mut mut_pos := token.Pos{}
if p.inside_match || p.inside_if_expr { if p.inside_match || p.inside_if_expr || p.inside_for {
match left { match left {
ast.Ident, ast.SelectorExpr { ast.Ident, ast.SelectorExpr {
is_mut = left.is_mut is_mut = left.is_mut