@@ -316,7 +316,8 @@ class Parser {
316
316
// / Identifier expressions.
317
317
FailureOr<ast::Expr *> parseArrayAttrExpr ();
318
318
FailureOr<ast::Expr *> parseAttributeExpr ();
319
- FailureOr<ast::Expr *> parseCallExpr (ast::Expr *parentExpr);
319
+ FailureOr<ast::Expr *> parseCallExpr (ast::Expr *parentExpr,
320
+ bool isNegated = false );
320
321
FailureOr<ast::Expr *> parseDeclRefExpr (StringRef name, SMRange loc);
321
322
FailureOr<ast::Expr *> parseDictAttrExpr ();
322
323
FailureOr<ast::Expr *> parseIdentifierExpr ();
@@ -406,7 +407,7 @@ class Parser {
406
407
407
408
FailureOr<ast::CallExpr *>
408
409
createCallExpr (SMRange loc, ast::Expr *parentExpr,
409
- MutableArrayRef<ast::Expr *> arguments);
410
+ MutableArrayRef<ast::Expr *> arguments, bool isNegated );
410
411
FailureOr<ast::DeclRefExpr *> createDeclRefExpr (SMRange loc, ast::Decl *decl);
411
412
FailureOr<ast::DeclRefExpr *>
412
413
createInlineVariableExpr (ast::Type type, StringRef name, SMRange loc,
@@ -1844,6 +1845,11 @@ FailureOr<ast::Expr *> Parser::parseExpr() {
1844
1845
case Token::dot:
1845
1846
lhsExpr = parseMemberAccessExpr (*lhsExpr);
1846
1847
break ;
1848
+ case Token::exclam:
1849
+ // TODO: Fx: This parses the "!" as suffix instead of prefix.
1850
+ consumeToken (Token::exclam);
1851
+ lhsExpr = parseCallExpr (*lhsExpr, /* isNegated = */ true );
1852
+ break ;
1847
1853
case Token::l_paren:
1848
1854
lhsExpr = parseCallExpr (*lhsExpr);
1849
1855
break ;
@@ -1912,7 +1918,8 @@ FailureOr<ast::Expr *> Parser::parseAttributeExpr() {
1912
1918
return ast::AttributeExpr::create (ctx, loc, attrExpr);
1913
1919
}
1914
1920
1915
- FailureOr<ast::Expr *> Parser::parseCallExpr (ast::Expr *parentExpr) {
1921
+ FailureOr<ast::Expr *> Parser::parseCallExpr (ast::Expr *parentExpr,
1922
+ bool isNegated) {
1916
1923
consumeToken (Token::l_paren);
1917
1924
1918
1925
// Parse the arguments of the call.
@@ -1936,7 +1943,7 @@ FailureOr<ast::Expr *> Parser::parseCallExpr(ast::Expr *parentExpr) {
1936
1943
if (failed (parseToken (Token::r_paren, " expected `)` after argument list" )))
1937
1944
return failure ();
1938
1945
1939
- return createCallExpr (loc, parentExpr, arguments);
1946
+ return createCallExpr (loc, parentExpr, arguments, isNegated );
1940
1947
}
1941
1948
1942
1949
FailureOr<ast::Expr *> Parser::parseDeclRefExpr (StringRef name, SMRange loc) {
@@ -2789,7 +2796,8 @@ Parser::validateTypeRangeConstraintExpr(const ast::Expr *typeExpr) {
2789
2796
2790
2797
FailureOr<ast::CallExpr *>
2791
2798
Parser::createCallExpr (SMRange loc, ast::Expr *parentExpr,
2792
- MutableArrayRef<ast::Expr *> arguments) {
2799
+ MutableArrayRef<ast::Expr *> arguments,
2800
+ bool isNegated = false ) {
2793
2801
ast::Type parentType = parentExpr->getType ();
2794
2802
2795
2803
ast::CallableDecl *callableDecl = tryExtractCallableDecl (parentExpr);
@@ -2835,7 +2843,7 @@ Parser::createCallExpr(SMRange loc, ast::Expr *parentExpr,
2835
2843
}
2836
2844
2837
2845
return ast::CallExpr::create (ctx, loc, parentExpr, arguments,
2838
- callableDecl->getResultType ());
2846
+ callableDecl->getResultType (), isNegated );
2839
2847
}
2840
2848
2841
2849
FailureOr<ast::DeclRefExpr *> Parser::createDeclRefExpr (SMRange loc,
@@ -2959,8 +2967,7 @@ FailureOr<ast::OperationExpr *> Parser::createOperationExpr(
2959
2967
OpResultTypeContext resultTypeContext,
2960
2968
SmallVectorImpl<ast::Expr *> &operands,
2961
2969
MutableArrayRef<ast::NamedAttributeDecl *> attributes,
2962
- SmallVectorImpl<ast::Expr *> &results,
2963
- unsigned numRegions) {
2970
+ SmallVectorImpl<ast::Expr *> &results, unsigned numRegions) {
2964
2971
std::optional<StringRef> opNameRef = name->getName ();
2965
2972
const ods::Operation *odsOp = lookupODSOperation (opNameRef);
2966
2973
0 commit comments