Improved SSA and added unused value checks
All checks were successful
/ test (push) Successful in 17s
All checks were successful
/ test (push) Successful in 17s
This commit is contained in:
parent
cc2e98ca49
commit
2b703e9af2
25 changed files with 519 additions and 213 deletions
16
src/core/CheckDeadCode.go
Normal file
16
src/core/CheckDeadCode.go
Normal file
|
@ -0,0 +1,16 @@
|
|||
package core
|
||||
|
||||
import (
|
||||
"git.urbach.dev/cli/q/src/errors"
|
||||
)
|
||||
|
||||
// CheckDeadCode checks for dead values.
|
||||
func (f *Function) CheckDeadCode() error {
|
||||
for instr := range f.Values {
|
||||
if instr.IsConst() && instr.Alive() == 0 {
|
||||
return errors.New(&UnusedValue{Value: instr.String()}, f.File, instr.Token().Position)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue