Remove tests with switching on constants for now
This commit is contained in:
parent
94272bff03
commit
0a54232e29
|
@ -14,16 +14,7 @@ Weekday: Int
|
|||
| friday 6
|
||||
| saturday 7
|
||||
|
||||
[print s:String]
|
||||
[printWeekday w:Weekday] = [print switch w
|
||||
| Weekday.sunday 'sunday'
|
||||
| Weekday.monday 'monday'
|
||||
| Weekday.tuesday 'tuesday'
|
||||
| Weekday.wednesday 'wednesday'
|
||||
| Weekday.thursday 'thursday'
|
||||
| Weekday.friday 'friday'
|
||||
| Weekday.saturday 'saturday'
|
||||
* 'unknown']
|
||||
[printWeekday w:Weekday]
|
||||
[f] = [printWeekday Weekday.monday]
|
||||
`)}
|
||||
|
||||
|
@ -39,16 +30,7 @@ Weekday: Int
|
|||
| friday
|
||||
| saturday
|
||||
|
||||
[print s:String]
|
||||
[printWeekday w:Weekday] = [print switch w
|
||||
| Weekday.sunday 'sunday'
|
||||
| Weekday.monday 'monday'
|
||||
| Weekday.tuesday 'tuesday'
|
||||
| Weekday.wednesday 'wednesday'
|
||||
| Weekday.thursday 'thursday'
|
||||
| Weekday.friday 'friday'
|
||||
| Weekday.saturday 'saturday'
|
||||
* 'unknown']
|
||||
[printWeekday w:Weekday]
|
||||
[f] = [printWeekday Weekday.monday]
|
||||
`)}
|
||||
|
||||
|
|
|
@ -900,6 +900,8 @@ func (this *Tree) analyzeSwitch (
|
|||
|
||||
var keyInt int64
|
||||
switch key := key.(type) {
|
||||
// TODO: once constant expression evaluation has been
|
||||
// implemented, add constants here
|
||||
case *entity.LiteralInt:
|
||||
keyInt = int64(key.Value)
|
||||
case *entity.LiteralString:
|
||||
|
|
|
@ -99,6 +99,9 @@ func (this *Tree) analyzeConstantDeclaration (
|
|||
// analyze value
|
||||
value, err := this.analyzeExpression(into, strict, constant.Value)
|
||||
if err != nil { return nil, err }
|
||||
|
||||
// TODO once constant expression evaluation is implemented, do
|
||||
// that here
|
||||
|
||||
// only allow values that can be used as constants
|
||||
err = this.isConstant(value)
|
||||
|
|
|
@ -587,7 +587,7 @@ func (this *Loop) HasExplicitType () bool {
|
|||
// loop
|
||||
return false
|
||||
}
|
||||
func (this *Loop) IsConstant () bool { return false /* TODO this may be decidable */ }
|
||||
func (this *Loop) IsConstant () bool { return false }
|
||||
func (this *Loop) Description () string { return "loop" }
|
||||
func (this *Loop) String () string {
|
||||
return fmt.Sprint("loop ", this.Body)
|
||||
|
|
Loading…
Reference in New Issue