Skip to content

Commit 0a620fa

Browse files
committed
activate feature flags in CLI
1 parent 3dc51d4 commit 0a620fa

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

internal/analysis/check.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -462,6 +462,11 @@ func (res *CheckResult) checkSource(source parser.Source) {
462462
res.checkSource(source)
463463
}
464464

465+
case *parser.SourceOneof:
466+
for _, source := range source.Sources {
467+
res.checkSource(source)
468+
}
469+
465470
case *parser.SourceCapped:
466471
onExit := res.enterCappedSource()
467472

internal/cmd/run.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ var runStdinFlag bool
2727
var runOutFormatOpt string
2828

2929
var overdraftFeatureFlag bool
30+
var oneOfFeatureFlag bool
3031

3132
type inputOpts struct {
3233
Script string `json:"script"`
@@ -121,6 +122,9 @@ func run(path string) {
121122
if overdraftFeatureFlag {
122123
featureFlags[interpreter.ExperimentalOverdraftFunctionFeatureFlag] = struct{}{}
123124
}
125+
if oneOfFeatureFlag {
126+
featureFlags[interpreter.ExperimentalOneofFeatureFlag] = struct{}{}
127+
}
124128

125129
result, err := interpreter.RunProgram(context.Background(), parseResult.Value, opt.Variables, interpreter.StaticStore{
126130
Balances: opt.Balances,
@@ -201,6 +205,7 @@ func getRunCmd() *cobra.Command {
201205

202206
// Feature flag
203207
cmd.Flags().BoolVar(&overdraftFeatureFlag, interpreter.ExperimentalOverdraftFunctionFeatureFlag, false, "feature flag to enable the overdraft() function")
208+
cmd.Flags().BoolVar(&oneOfFeatureFlag, interpreter.ExperimentalOneofFeatureFlag, false, "feature flag to enable the oneof combinator")
204209

205210
// Output options
206211
cmd.Flags().StringVar(&runOutFormatOpt, "output-format", OutputFormatPretty, "Set the output format. Available options: pretty, json.")

0 commit comments

Comments
 (0)