12 const std::shared_ptr<Misc> Comma;
13 const std::shared_ptr<Identifier> ID;
14 const std::shared_ptr<Expr> Default;
15 const std::shared_ptr<Misc> Ellipsis;
19 std::shared_ptr<Identifier> ID, std::shared_ptr<Expr> Default)
20 :
Node(NK_Formal, Range), Comma(std::move(Comma)), ID(std::move(ID)),
21 Default(std::move(Default)) {}
24 std::shared_ptr<Misc> Ellipsis)
25 :
Node(NK_Formal, Range), Comma(std::move(Comma)),
26 Ellipsis(std::move(Ellipsis)) {
27 assert(this->Ellipsis &&
"Ellipsis must not be null");
31 assert(Ellipsis &&
"Ellipsis must not be null");
35 [[nodiscard]]
bool isEllipsis()
const {
return Ellipsis !=
nullptr; }
39 [[nodiscard]]
Misc *
comma()
const {
return Comma.get(); }
45 return {Ellipsis.get()};
47 return {ID.get(), Default.get()};
59 const std::vector<std::shared_ptr<Formal>> Members;
62 const std::map<std::string, const Formal *> Dedup;
67 std::map<std::string, const Formal *> Dedup)
68 :
Node(NK_Formals, Range), Members(std::move(Members)),
69 Dedup(std::move(Dedup)) {}
74 const std::map<std::string, const Formal *> &
dedup() {
return Dedup; }
76 [[nodiscard]]
const std::map<std::string, const Formal *> &
dedup()
const {
82 Children.reserve(Members.size());
83 for (
const auto &Member : Members) {
84 Children.emplace_back(Member.get());
91 const std::shared_ptr<Identifier> ID;
92 const std::shared_ptr<Formals> F;
96 std::shared_ptr<Formals> F)
97 :
Node(NK_LambdaArg, Range), ID(std::move(ID)), F(std::move(F)) {}
104 return {ID.get(), F.get()};
109 const std::shared_ptr<LambdaArg> Arg;
110 const std::shared_ptr<Expr> Body;
114 std::shared_ptr<Expr> Body)
115 :
Expr(NK_ExprLambda, Range), Arg(std::move(Arg)), Body(std::move(Body)) {
119 [[nodiscard]]
Expr *
body()
const {
return Body.get(); }
122 return {Arg.get(), Body.get()};
ExprLambda(LexerCursorRange Range, std::shared_ptr< LambdaArg > Arg, std::shared_ptr< Expr > Body)
ChildVector children() const override
Identifier. Variable names, attribute names, etc.
Formals * formals() const
LambdaArg(LexerCursorRange Range, std::shared_ptr< Identifier > ID, std::shared_ptr< Formals > F)
ChildVector children() const override
Misc node, used for parentheses, keywords, etc.
boost::container::small_vector< Node *, 8 > ChildVector