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

all: mutability check (part 1); enable mutable sumtype args

This commit is contained in:
Alexander Medvednikov
2020-09-22 05:28:29 +02:00
parent 1ee0939f69
commit 624f22e27e
12 changed files with 122 additions and 125 deletions

View File

@ -37,8 +37,7 @@ pub fn (s &Scope) find_with_scope(name string) ?(ScopeObject, &Scope) {
}
pub fn (s &Scope) find(name string) ?ScopeObject {
for sc := s; true; sc = sc.parent
{
for sc := s; true; sc = sc.parent {
if name in sc.objects {
return sc.objects[name]
}
@ -85,6 +84,7 @@ pub fn (s &Scope) known_var(name string) bool {
}
pub fn (mut s Scope) update_var_type(name string, typ table.Type) {
s.end_pos = s.end_pos // TODO mut bug
match mut s.objects[name] {
Var {
if it.typ == typ {