Lines Matching defs:Id
175 // Tests that a stencil with a single parameter (`Id`) evaluates to the expected
176 // string, when `Id` is bound to the expression-statement in `Snippet`.
177 void testExpr(StringRef Id, StringRef Snippet, const Stencil &Stencil,
179 auto StmtMatch = matchStmt(Snippet, expr().bind(Id));
185 void testFailure(StringRef Id, StringRef Snippet, const Stencil &Stencil,
187 auto StmtMatch = matchStmt(Snippet, expr().bind(Id));
195 StringRef Id = "id";
196 testExpr(Id, "3;", cat(node(std::string(Id))), "3");
200 StringRef Id = "id";
201 testExpr(Id, "3;", ifBound(Id, cat("5"), cat("7")), "5");
205 StringRef Id = "id";
206 testExpr(Id, "3;", ifBound("other", cat("5"), cat("7")), "7");
262 StringRef Id = "id";
263 testExpr(Id, "3;", expression(Id), "3");
268 StringRef Id = "id";
269 testExpr(Id, "(3);", expression(Id), "(3)");
273 StringRef Id = "id";
274 testExpr(Id, "3+4;", expression(Id), "(3+4)");
281 StringRef Id = "id";
282 testFailure(Id, "3;", expression("ACACA"),
287 StringRef Id = "id";
288 testExpr(Id, "int *x; x;", deref(Id), "*x");
292 StringRef Id = "id";
293 testExpr(Id, "int *x; x + 1;", deref(Id), "*(x + 1)");
297 StringRef Id = "id";
298 testExpr(Id, "int x; &x;", deref(Id), "x");
302 StringRef Id = "id";
303 testExpr(Id, "int x; x;", addressOf(Id), "&x");
307 StringRef Id = "id";
308 testExpr(Id, "int *x; *x;", addressOf(Id), "x");
312 StringRef Id = "id";
313 testExpr(Id, "int x; x;", maybeDeref(Id), "x");
317 StringRef Id = "id";
318 testExpr(Id, "int *x; x;", maybeDeref(Id), "*x");
322 StringRef Id = "id";
323 testExpr(Id, "int *x; x + 1;", maybeDeref(Id), "*(x + 1)");
327 StringRef Id = "id";
328 testExpr(Id, "int x; &x;", maybeDeref(Id), "x");
332 StringRef Id = "id";
337 testExpr(Id, Snippet, maybeDeref(Id), "*x");
341 StringRef Id = "id";
344 matchStmt(Snippet, memberExpr(hasObjectExpression(expr().bind(Id))));
346 const Stencil Stencil = maybeDeref(Id);
351 StringRef Id = "id";
352 testExpr(Id, "int *x; x;", maybeAddressOf(Id), "x");
356 StringRef Id = "id";
357 testExpr(Id, "int x; x;", addressOf(Id), "&x");
361 StringRef Id = "id";
362 testExpr(Id, "int x; x + 1;", maybeAddressOf(Id), "&(x + 1)");
366 StringRef Id = "id";
367 testExpr(Id, "int *x; *x;", addressOf(Id), "x");
371 StringRef Id = "id";
372 testExpr(Id, "std::unique_ptr<S> x; x;", maybeAddressOf(Id), "x");
376 StringRef Id = "id";
379 matchStmt(Snippet, memberExpr(hasObjectExpression(expr().bind(Id))));
381 const Stencil Stencil = maybeAddressOf(Id);
386 StringRef Id = "id";
387 testExpr(Id, "std::unique_ptr<S> x; *x;", maybeAddressOf(Id), "&*x");
395 StringRef Id = "id";
396 testExpr(Id, Snippet, access(Id, "field"), "x.field");
404 StringRef Id = "id";
405 testExpr(Id, Snippet, access(Id, cat("field")), "x.field");
413 StringRef Id = "id";
414 testExpr(Id, Snippet, access(Id, "field"), "x.field");
422 StringRef Id = "id";
423 testExpr(Id, Snippet, access(Id, "field"), "x->field");
431 StringRef Id = "id";
432 testExpr(Id, Snippet, access(Id, "field"), "x->field");
440 StringRef Id = "id";
441 testExpr(Id, Snippet, access(Id, "field"), "x->field");
449 StringRef Id = "id";
450 testExpr(Id, Snippet, access(Id, "field"), "x->field");
458 StringRef Id = "id";
460 matchStmt(Snippet, memberExpr(hasObjectExpression(expr().bind(Id))));
462 EXPECT_THAT_EXPECTED(access(Id, "field")->eval(StmtMatch->Result),
591 StringRef Id = "id";
592 auto SimpleFn = [Id](const MatchResult &R) {
593 return std::string(R.Nodes.getNodeAs<Stmt>(Id) != nullptr ? "Bound"
596 testExpr(Id, "3;", run(SimpleFn), "Bound");
680 auto S = describe("Id");
681 StringRef Expected = R"repr(describe("Id"))repr";
686 auto S = dPrint("Id");
687 StringRef Expected = R"repr(dPrint("Id"))repr";
692 auto S = expression("Id");
693 StringRef Expected = R"repr(expression("Id"))repr";
698 auto S = deref("Id");
699 StringRef Expected = R"repr(deref("Id"))repr";
704 auto S = addressOf("Id");
705 StringRef Expected = R"repr(addressOf("Id"))repr";
715 auto S = access("Id", "memberData");
716 StringRef Expected = R"repr(access("Id", "memberData"))repr";
721 auto S = access("Id", cat(name("otherId")));
722 StringRef Expected = R"repr(access("Id", selection(...)))repr";
727 auto S = access("Id", cat("foo_", "bar"));
728 StringRef Expected = R"repr(access("Id", seq("foo_", "bar")))repr";
733 auto S = ifBound("Id", cat("trueText"), access("exprId", "memberData"));
735 R"repr(ifBound("Id", "trueText", access("exprId", "memberData")))repr";