Skip to content

Commit fcf6e1e

Browse files
committed
Do not support term attributes corresponding to type argument specifications
1 parent 309a5fd commit fcf6e1e

1 file changed

Lines changed: 9 additions & 54 deletions

File tree

src/expr_parser.cpp

Lines changed: 9 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1168,6 +1168,14 @@ void ExprParser::parseAttributeList(
11681168
case Attr::OPAQUE:
11691169
// requires no value
11701170
break;
1171+
case Attr::RESTRICT:
1172+
// requires an expression that follows
1173+
val = parseExpr();
1174+
break;
1175+
case Attr::SYNTAX:
1176+
// ignores the literal kind
1177+
parseLiteralKind();
1178+
break;
11711179
case Attr::REQUIRES: val = parseExprPair(); break;
11721180
default: handled = false; break;
11731181
}
@@ -1225,60 +1233,7 @@ void ExprParser::parseAttributeList(
12251233
}
12261234
break;
12271235
case Kind::NONE:
1228-
{
1229-
// attributes on general terms, including type arguments
1230-
handled = true;
1231-
switch (a)
1232-
{
1233-
case Attr::IMPLICIT:
1234-
case Attr::OPAQUE:
1235-
// requires no value
1236-
break;
1237-
case Attr::VAR:
1238-
{
1239-
if (e.isNull())
1240-
{
1241-
d_lex.parseError("Cannot use :var in this context");
1242-
}
1243-
if (attrs.find(Attr::VAR)!=attrs.end())
1244-
{
1245-
d_lex.parseError("Cannot use :var on the same term more than once");
1246-
}
1247-
std::string name = parseSymbol();
1248-
// e should be a type
1249-
val = d_state.mkSymbol(Kind::PARAM, name, e);
1250-
// immediately bind
1251-
if (!pushedScope)
1252-
{
1253-
pushedScope = true;
1254-
d_state.pushScope();
1255-
}
1256-
bind(name, val);
1257-
}
1258-
break;
1259-
case Attr::RESTRICT:
1260-
{
1261-
// requires an expression that follows
1262-
val = parseExpr();
1263-
}
1264-
break;
1265-
case Attr::REQUIRES:
1266-
{
1267-
// requires a pair
1268-
val = parseExprPair();
1269-
}
1270-
break;
1271-
case Attr::SYNTAX:
1272-
{
1273-
// ignores the literal kind
1274-
parseLiteralKind();
1275-
}
1276-
break;
1277-
default:
1278-
handled = false;
1279-
break;
1280-
}
1281-
}
1236+
// nothing handled
12821237
break;
12831238
default:
12841239
break;

0 commit comments

Comments
 (0)