Remove the "? but not !?" effect

This commit is contained in:
Nigel Tao committed 2018-12-16 11:03:31 +11:00
1 parent 9311f7a694
commit dd28f3c0f9
2 files changed
+3 -9

No files matched your search

-2
View File
@@ -129,8 +129,6 @@ func (e Effect) String() string {
return "" return ""
case EffectImpure: case EffectImpure:
return "!" return "!"
case EffectOptional:
return "?"
case EffectImpure | EffectOptional: case EffectImpure | EffectOptional:
return "!?" return "!?"
case EffectImpure | EffectOptional | EffectCoroutine: case EffectImpure | EffectOptional | EffectCoroutine:
+3 -7
View File
@@ -1126,11 +1126,9 @@ func (p *parser) parseOperand() (*a.Expr, error) {
} }
func (p *parser) parseEffect() a.Effect { func (p *parser) parseEffect() a.Effect {
switch p.peek1() { if p.peek1() != t.IDExclam {
case t.IDQuestion: return 0
p.src = p.src[1:] }
return a.EffectOptional
case t.IDExclam:
p.src = p.src[1:] p.src = p.src[1:]
if p.peek1() != t.IDQuestion { if p.peek1() != t.IDQuestion {
return a.EffectImpure return a.EffectImpure
@@ -1142,5 +1140,3 @@ func (p *parser) parseEffect() a.Effect {
p.src = p.src[1:] p.src = p.src[1:]
return a.EffectImpure | a.EffectOptional | a.EffectCoroutine return a.EffectImpure | a.EffectOptional | a.EffectCoroutine
} }
return 0
}