• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

forst-lang / forst / 16012315797

01 Jul 2025 11:25PM UTC coverage: 37.792% (+0.5%) from 37.308%
16012315797

Pull #17

github

haveyaseen
tests: Increase parser test coverage
Pull Request #17: feat: Shape guards

1666 of 4519 new or added lines in 83 files covered. (36.87%)

89 existing lines in 29 files now uncovered.

2989 of 7909 relevant lines covered (37.79%)

6.56 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

59.26
/forst/internal/parser/scope_stack.go
1
package parser
2

3
import (
4
        "github.com/sirupsen/logrus"
5
)
6

7
// ScopeStack manages a stack of scopes during type checking
8
type ScopeStack struct {
9
        scopes  []*Scope
10
        current *Scope
11
        log     *logrus.Logger
12
}
13

14
// NewScopeStack creates a new stack with a global scope
15
func NewScopeStack(log *logrus.Logger) *ScopeStack {
63✔
16
        globalScope := NewScope("", true, false, log)
63✔
17
        scopes := []*Scope{globalScope}
63✔
18
        return &ScopeStack{
63✔
19
                scopes:  scopes,
63✔
20
                current: globalScope,
63✔
21
                log:     log,
63✔
22
        }
63✔
23
}
63✔
24

25
// PushScope creates and pushes a new scope for the given AST node
26
func (ss *ScopeStack) PushScope(scope *Scope) {
31✔
27
        if scope.IsGlobal {
31✔
NEW
28
                ss.log.Fatalf("Cannot push global scope")
×
NEW
29
        }
×
30
        ss.scopes = append(ss.scopes, scope)
31✔
31
        ss.current = scope
31✔
32
}
33

NEW
34
func (ss *ScopeStack) PopScope() {
×
NEW
35
        if ss.current.IsGlobal {
×
NEW
36
                ss.log.Fatalf("Cannot pop global scope")
×
NEW
37
        }
×
NEW
38
        ss.scopes = ss.scopes[:len(ss.scopes)-1]
×
NEW
39
        ss.current = ss.scopes[len(ss.scopes)-1]
×
40
}
41

42
func (ss *ScopeStack) CurrentScope() *Scope {
30✔
43
        return ss.current
30✔
44
}
30✔
45

NEW
46
func (ss *ScopeStack) GlobalScope() *Scope {
×
NEW
47
        return ss.scopes[0]
×
NEW
48
}
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc