mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-18 00:32:11 +01:00
Ensure that assert's and args are effect-free
This commit is contained in:
1 parent
00c5f77c19
commit
7a0a345d41
1 file changed
+8
@@ -523,6 +523,10 @@ func (p *parser) parseAssertNode() (*a.Node, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if condition.Effect() != 0 {
|
||||
return nil, fmt.Errorf(`parse: assert-condition %q is not effect-free at %s:%d`,
|
||||
condition.Str(p.tm), p.filename, p.line())
|
||||
}
|
||||
reason, args := t.ID(0), []*a.Node(nil)
|
||||
if p.peek1() == t.IDVia {
|
||||
p.src = p.src[1:]
|
||||
@@ -891,6 +895,10 @@ func (p *parser) parseArgNode() (*a.Node, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if value.Effect() != 0 {
|
||||
return nil, fmt.Errorf(`parse: arg-value %q is not effect-free at %s:%d`,
|
||||
value.Str(p.tm), p.filename, p.line())
|
||||
}
|
||||
return a.NewArg(name, value).AsNode(), nil
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user