Skip to content

Commit

Permalink
Merge pull request #34 from widmogrod/feature/make-inf-more-robust
Browse files Browse the repository at this point in the history
Make variant inference intensive to --name or -name
  • Loading branch information
widmogrod authored Jan 3, 2023
2 parents ab87b34 + 5b9493d commit 69cec26
Show file tree
Hide file tree
Showing 10 changed files with 37 additions and 37 deletions.
2 changes: 1 addition & 1 deletion example/calculator_example.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package example

//go:generate go run ../cmd/mkunion/main.go --name=Calc --types=Lit,Sum,Mul
//go:generate go run ../cmd/mkunion/main.go --name=Calc
type (
Lit struct{ V int }
Sum struct{ Left, Right Calc }
Expand Down
2 changes: 1 addition & 1 deletion example/simple_example.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package example

//go:generate go run ../cmd/mkunion/main.go -name=Vehicle -types=Plane,Car,Boat
//go:generate go run ../cmd/mkunion/main.go -name=Vehicle
type (
Car struct{}
Plane struct{}
Expand Down
14 changes: 7 additions & 7 deletions example/simple_example_mkunion_vehicle_default_reducer.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions example/simple_example_mkunion_vehicle_default_visitor.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions example/simple_example_mkunion_vehicle_reducer_bfs.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions example/simple_example_mkunion_vehicle_reducer_dfs.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 9 additions & 9 deletions example/simple_example_mkunion_vehicle_visitor.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion example/tree_example.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package example

//go:generate go run ../cmd/mkunion/main.go -name=Tree -types=Branch,Leaf
//go:generate go run ../cmd/mkunion/main.go -name=Tree
type (
Branch struct{ L, R Tree }
Leaf struct{ Value int }
Expand Down
2 changes: 1 addition & 1 deletion example/where_predicate_example.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package example

//go:generate go run ../cmd/mkunion/main.go -name=WherePredicate -types=Eq,And,Or,Path
//go:generate go run ../cmd/mkunion/main.go -name=WherePredicate
type (
Eq struct{ V interface{} }
And []WherePredicate
Expand Down
2 changes: 1 addition & 1 deletion infer_defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func InferFromFile(filename string) (*InferredInfo, error) {
}

var (
matchGoGenerateExtractUnionName = regexp.MustCompile(`go:generate .* -name=(\w+)`)
matchGoGenerateExtractUnionName = regexp.MustCompile(`go:generate .* -{1,2}name=(\w+)`)
)

type InferredInfo struct {
Expand Down

0 comments on commit 69cec26

Please sign in to comment.