Skip to content

Commit 0aebea5

Browse files
committed
removed unnecessary struct
1 parent 7b4292c commit 0aebea5

File tree

2 files changed

+12
-18
lines changed

2 files changed

+12
-18
lines changed

parser/ast.go

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -138,15 +138,15 @@ type SourceOverdraft struct {
138138
Bounded *Literal
139139
}
140140

141-
type SourceAllotmentValue interface{ sourceAllotmentValue() }
141+
type AllotmentValue interface{ allotmentValue() }
142142

143-
func (*RemainingAllotment) sourceAllotmentValue() {}
144-
func (*RatioLiteral) sourceAllotmentValue() {}
145-
func (*VariableLiteral) sourceAllotmentValue() {}
143+
func (*RemainingAllotment) allotmentValue() {}
144+
func (*RatioLiteral) allotmentValue() {}
145+
func (*VariableLiteral) allotmentValue() {}
146146

147147
type SourceAllotmentItem struct {
148148
Range Range
149-
Allotment SourceAllotmentValue
149+
Allotment AllotmentValue
150150
From Source
151151
}
152152

@@ -164,12 +164,6 @@ func (*DestinationAllotment) destination() {}
164164
func (d *DestinationInorder) GetRange() Range { return d.Range }
165165
func (d *DestinationAllotment) GetRange() Range { return d.Range }
166166

167-
type DestinationAllotmentValue interface{ destinationAllotmentValue() }
168-
169-
func (*RemainingAllotment) destinationAllotmentValue() {}
170-
func (*RatioLiteral) destinationAllotmentValue() {}
171-
func (*VariableLiteral) destinationAllotmentValue() {}
172-
173167
type DestinationInorder struct {
174168
Range Range
175169
Clauses []DestinationInorderClause
@@ -202,7 +196,7 @@ type DestinationAllotment struct {
202196

203197
type DestinationAllotmentItem struct {
204198
Range Range
205-
Allotment DestinationAllotmentValue
199+
Allotment AllotmentValue
206200
To KeptOrDestination
207201
}
208202

parser/parser.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ func parsePercentageRatio(source string, range_ Range) *RatioLiteral {
264264
}
265265
}
266266

267-
func parseAllotment(allotmentCtx parser.IAllotmentContext) SourceAllotmentValue {
267+
func parseAllotment(allotmentCtx parser.IAllotmentContext) AllotmentValue {
268268
switch allotmentCtx := allotmentCtx.(type) {
269269
case *parser.PortionedAllotmentContext:
270270
return parsePortionSource(allotmentCtx.Portion())
@@ -281,7 +281,7 @@ func parseAllotment(allotmentCtx parser.IAllotmentContext) SourceAllotmentValue
281281
return nil
282282

283283
default:
284-
return utils.NonExhaustiveMatchPanic[SourceAllotmentValue](allotmentCtx.GetText())
284+
return utils.NonExhaustiveMatchPanic[AllotmentValue](allotmentCtx.GetText())
285285
}
286286
}
287287

@@ -446,7 +446,7 @@ func parseKeptOrDestination(clauseCtx parser.IKeptOrDestinationContext) KeptOrDe
446446

447447
}
448448

449-
func parseDestinationAllotment(allotmentCtx parser.IAllotmentContext) DestinationAllotmentValue {
449+
func parseDestinationAllotment(allotmentCtx parser.IAllotmentContext) AllotmentValue {
450450
switch allotmentCtx := allotmentCtx.(type) {
451451
case *parser.RemainingAllotmentContext:
452452
return &RemainingAllotment{
@@ -463,11 +463,11 @@ func parseDestinationAllotment(allotmentCtx parser.IAllotmentContext) Destinatio
463463
return nil
464464

465465
default:
466-
return utils.NonExhaustiveMatchPanic[DestinationAllotmentValue](allotmentCtx.GetText())
466+
return utils.NonExhaustiveMatchPanic[AllotmentValue](allotmentCtx.GetText())
467467
}
468468
}
469469

470-
func parseDestinationPortion(portionCtx parser.IPortionContext) DestinationAllotmentValue {
470+
func parseDestinationPortion(portionCtx parser.IPortionContext) AllotmentValue {
471471
switch portionCtx.(type) {
472472
case *parser.RatioContext:
473473
return parseRatio(portionCtx.GetText(), ctxToRange(portionCtx))
@@ -479,7 +479,7 @@ func parseDestinationPortion(portionCtx parser.IPortionContext) DestinationAllot
479479
return nil
480480

481481
default:
482-
return utils.NonExhaustiveMatchPanic[DestinationAllotmentValue](portionCtx.GetText())
482+
return utils.NonExhaustiveMatchPanic[AllotmentValue](portionCtx.GetText())
483483
}
484484
}
485485

0 commit comments

Comments
 (0)