Better parse checking on "funcall" rule.

This commit is contained in:
caheckman 2019-11-14 16:23:45 -05:00
parent 719841eb20
commit 410b92c611

View file

@ -1246,7 +1246,17 @@ funcall returns [VectorSTL<OpTpl> value]
@init { @init {
$Return::noReturn = true; $Return::noReturn = true;
} }
: e=expr_apply { $value = (VectorSTL<OpTpl>) e; } : e=expr_apply {
if (e instanceof VectorSTL<?>)
$value = (VectorSTL<OpTpl>) e;
else {
Location loc = null;
if (e instanceof ExprTree) {
loc = ((ExprTree)e).location;
}
reportError(loc,"Functional operator requires a return value");
}
}
; ;
build_stmt returns [VectorSTL<OpTpl> ops] build_stmt returns [VectorSTL<OpTpl> ops]