mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
live reload: All of the [live] functions are reloaded now, not just the first one.
This commit is contained in:
parent
b3bdcfda42
commit
97e97222ee
@ -319,11 +319,25 @@ fn (p mut Parser) fn_decl() {
|
|||||||
if is_sig || p.first_run() || is_live || is_fn_header || skip_main_in_test {
|
if is_sig || p.first_run() || is_live || is_fn_header || skip_main_in_test {
|
||||||
// First pass? Skip the body for now [BIG]
|
// First pass? Skip the body for now [BIG]
|
||||||
if !is_sig && !is_fn_header {
|
if !is_sig && !is_fn_header {
|
||||||
|
mut opened_scopes := 0
|
||||||
|
mut closed_scopes := 0
|
||||||
for {
|
for {
|
||||||
|
if p.tok == .lcbr {
|
||||||
|
opened_scopes++
|
||||||
|
}
|
||||||
|
if p.tok == .rcbr {
|
||||||
|
closed_scopes++
|
||||||
|
}
|
||||||
p.next()
|
p.next()
|
||||||
if p.tok.is_decl() && !(p.prev_tok == .dot && p.tok == .key_type) {
|
if p.tok.is_decl() && !(p.prev_tok == .dot && p.tok == .key_type) {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
//fn body ended, and a new fn attribute declaration like [live] is starting?
|
||||||
|
if closed_scopes > opened_scopes && p.prev_tok == .rcbr {
|
||||||
|
if p.tok == .lsbr {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Live code reloading? Load all fns from .so
|
// Live code reloading? Load all fns from .so
|
||||||
|
Loading…
Reference in New Issue
Block a user