mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-25 00:55:11 +01:00
Require effectful func's args to be effect-free
This commit is contained in:
1 parent
81eecf2936
commit
0822842344
1 file changed
+9
@@ -1078,6 +1078,15 @@ func (p *parser) parseOperand() (*a.Expr, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
if flags.AsEffect() != 0 {
|
||||||
|
for _, arg := range args {
|
||||||
|
o := arg.AsArg().Value()
|
||||||
|
if o.Effect() != 0 {
|
||||||
|
return nil, fmt.Errorf(`parse: effectful function call %q has effectful argument %q at %s:%d`,
|
||||||
|
lhs.Str(p.tm), o.Str(p.tm), p.filename, p.line())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
lhs = a.NewExpr(flags, t.IDOpenParen, 0, 0, lhs.AsNode(), nil, nil, args)
|
lhs = a.NewExpr(flags, t.IDOpenParen, 0, 0, lhs.AsNode(), nil, nil, args)
|
||||||
|
|
||||||
case t.IDOpenBracket:
|
case t.IDOpenBracket:
|
||||||
|
|||||||
Reference in new issue
Block a user