From 852849862884f421f5abb0dcd40b5b5b69ff87aa Mon Sep 17 00:00:00 2001 From: Rajit Manohar Date: Tue, 22 Dec 2020 15:14:43 -0500 Subject: [PATCH] consistent direction flags --- act/types.m4 | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/act/types.m4 b/act/types.m4 index 7b6b42a5..86166829 100644 --- a/act/types.m4 +++ b/act/types.m4 @@ -124,22 +124,34 @@ data_type[InstType *]: T_INT [ chan_dir ] [ "<" wpint_expr ">" ] return $0->tf->NewEnum ($0->scope, d, $4); }}; -chan_type[InstType *]: "chan" [ chan_dir ] "(" physical_inst_type ")" +chan_type[InstType *]: "chan" [ chan_dir ] "(" physical_inst_type ")" [ chan_dir ] {{X: ActRet *r; Type::direction d; InstType *ret; if (OPT_EXISTS ($2)) { + if (OPT_EXISTS ($6)) { + $E("Direction flags can only be specified once"); + } r = OPT_VALUE ($2); $A(r->type == R_DIR); d = r->u.dir; FREE (r); } else { - d = Type::NONE; + if (OPT_EXISTS ($6)) { + r = OPT_VALUE ($6); + $A(r->type == R_DIR); + d = r->u.dir; + FREE (r); + } + else { + d = Type::NONE; + } } OPT_FREE ($2); + OPT_FREE ($6); InstType *t = $4; if (!TypeFactory::isDataType (t)) {