Skip to content

Commit 2d519b3

Browse files
committed
Remove closure in getRules
1 parent 24bbe7d commit 2d519b3

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

internal/format/rulesmap.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,23 @@ import (
55
"sync"
66

77
"github.com/microsoft/typescript-go/internal/ast"
8-
"github.com/microsoft/typescript-go/internal/core"
98
)
109

1110
func getRules(context *formattingContext) []*ruleImpl {
1211
bucket := getRulesMap()[getRuleBucketIndex(context.currentTokenSpan.Kind, context.nextTokenSpan.Kind)]
1312
if len(bucket) > 0 {
1413
var rules []*ruleImpl
1514
ruleActionMask := ruleActionNone
15+
outer:
1616
for _, rule := range bucket {
1717
acceptRuleActions := ^getRuleActionExclusion(ruleActionMask)
18-
if rule.Action()&acceptRuleActions != 0 && core.Every(rule.Context(), func(cb func(ctx *formattingContext) bool) bool { return cb(context) }) {
18+
if rule.Action()&acceptRuleActions != 0 {
19+
preds := rule.Context()
20+
for _, p := range preds {
21+
if !p(context) {
22+
continue outer
23+
}
24+
}
1925
rules = append(rules, rule)
2026
ruleActionMask |= rule.Action()
2127
}

0 commit comments

Comments
 (0)