Skip to content

Commit

Permalink
Clear error message when for loops/select statements are used
Browse files Browse the repository at this point in the history
  • Loading branch information
Amit Davidson committed Oct 18, 2020
1 parent 1634412 commit 34d3a58
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions ssaUtils/CFG.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package ssaUtils
import (
"github.com/amit-davidson/Chronos/domain"
"golang.org/x/tools/go/ssa"
"strings"
)

type CFG struct {
Expand Down Expand Up @@ -96,6 +97,12 @@ func GetDefersSummary(Context *domain.Context, startBlock *ssa.BasicBlock, defer
}

func (cfg *CFG) traverseGraph(Context *domain.Context, block *ssa.BasicBlock) {
unsupportedBlocks := []string{"loop", "select"}
for _, ub := range unsupportedBlocks {
if strings.Contains(block.Comment, ub) {
panic("For loops/select statements are not supported") // Can't return in this flow so we panic
}
}
nextBlocks := cfg.getNextBlocks(block)
prevBlocks := cfg.getPreviousBlocks(block)

Expand Down

0 comments on commit 34d3a58

Please sign in to comment.