mirror of
https://github.com/vsariola/sointu.git
synced 2025-05-28 03:10:24 -04:00
refactor: move ConstructPatterns into compiler package
ConstructPatterns was never used except during compilation, so it makes sense to have it closer where it is used. We could consider making it even private function, as the pattern table construction is quite specific to how compiler compiles and probably not that reusable elsewhere.
This commit is contained in:
parent
e010b2da9d
commit
e28891abd5
@ -91,7 +91,7 @@ func (com *Compiler) Song(song *sointu.Song) (map[string]string, error) {
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf(`could not encode patch: %v`, err)
|
||||
}
|
||||
patterns, sequences, err := vm.ConstructPatterns(song)
|
||||
patterns, sequences, err := ConstructPatterns(song)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf(`could not encode song: %v`, err)
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
package vm
|
||||
package compiler
|
||||
|
||||
import (
|
||||
"errors"
|
@ -1,11 +1,11 @@
|
||||
package vm_test
|
||||
package compiler_test
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
"github.com/vsariola/sointu"
|
||||
"github.com/vsariola/sointu/vm"
|
||||
"github.com/vsariola/sointu/vm/compiler"
|
||||
)
|
||||
|
||||
func TestPatternReusing(t *testing.T) {
|
||||
@ -22,7 +22,7 @@ func TestPatternReusing(t *testing.T) {
|
||||
}},
|
||||
},
|
||||
}
|
||||
patterns, sequences, err := vm.ConstructPatterns(&song)
|
||||
patterns, sequences, err := compiler.ConstructPatterns(&song)
|
||||
if err != nil {
|
||||
t.Fatalf("erorr constructing patterns: %v", err)
|
||||
}
|
||||
@ -49,7 +49,7 @@ func TestUnnecessaryHolds(t *testing.T) {
|
||||
Order: []int{0, 1},
|
||||
}}},
|
||||
}
|
||||
patterns, sequences, err := vm.ConstructPatterns(&song)
|
||||
patterns, sequences, err := compiler.ConstructPatterns(&song)
|
||||
if err != nil {
|
||||
t.Fatalf("erorr constructing patterns: %v", err)
|
||||
}
|
||||
@ -77,7 +77,7 @@ func TestDontCares(t *testing.T) {
|
||||
}},
|
||||
},
|
||||
}
|
||||
patterns, sequences, err := vm.ConstructPatterns(&song)
|
||||
patterns, sequences, err := compiler.ConstructPatterns(&song)
|
||||
if err != nil {
|
||||
t.Fatalf("erorr constructing patterns: %v", err)
|
||||
}
|
Loading…
Reference in New Issue
Block a user