Skip to content

Commit

Permalink
prevent escape from scope
Browse files Browse the repository at this point in the history
Signed-off-by: Dmitry Stoletov <[email protected]>
  • Loading branch information
irvis committed Jan 30, 2021
1 parent 7b38bd3 commit 7cb4ea6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion formatter/body.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func (body) InnerStatement(prev, cur *element) (bool, statement) {
return false, nil
}

func (body) TypeOf() typeStatement { return tsNone }
func (body) TypeOf() typeStatement { return tsBody }

func (b *body) IsEnd(prev, cur *element) (bool, bool) {
if cur.Token.Type == nEnd {
Expand Down
4 changes: 4 additions & 0 deletions formatter/chain_statments.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ func (cs *chainStatments) ExctractStatement(ts typeStatement) statement {
if cs.chain[i].TypeOf() == ts {
item = i
}

if cs.chain[i].TypeOf() == tsBody {
break
}
}

if item == -1 {
Expand Down
1 change: 1 addition & 0 deletions formatter/document.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ const (
tsFuncCallStatement
tsTable
tsUnknow
tsBody
)

// chunk ::= block
Expand Down

0 comments on commit 7cb4ea6

Please sign in to comment.