mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
v2: handle var decl & assign stmt together 1st step combining
This commit is contained in:
@ -63,6 +63,14 @@ pub fn (s mut Scope) override_var(var VarDecl) {
|
||||
s.vars[var.name] = var
|
||||
}
|
||||
|
||||
pub fn (s &Scope) outermost() &Scope {
|
||||
mut sc := s
|
||||
for !isnil(sc.parent) {
|
||||
sc = sc.parent
|
||||
}
|
||||
return sc
|
||||
}
|
||||
|
||||
// returns the innermost scope containing pos
|
||||
pub fn (s &Scope) innermost(pos int) ?&Scope {
|
||||
if s.contains(pos) {
|
||||
|
Reference in New Issue
Block a user