Skip to content

Commit

Permalink
Expand parameter names in ESTree node constructors
Browse files Browse the repository at this point in the history
Summary: A minor quality-of-life improvement when working with ESTree node constructors: Previously their parameters would be named `ARG0NM_`, `ARG1NM_` etc, but now they will be expanded to their actual names. This is an IntelliSense-only change.

Reviewed By: tmikov

Differential Revision: D25191861

fbshipit-source-id: c6b510ffd9e9ab4079845f25d4390282e8f42601
  • Loading branch information
motiz88 authored and facebook-github-bot committed Dec 3, 2020
1 parent a3f92b1 commit 2214e2f
Showing 1 changed file with 89 additions and 89 deletions.
178 changes: 89 additions & 89 deletions include/hermes/AST/ESTree.h
Original file line number Diff line number Diff line change
Expand Up @@ -414,25 +414,25 @@ using BaseNode = Node;
} \
};

#define ESTREE_NODE_1_ARGS(NAME, BASE, ARG0TY, ARG0NM, ARG0OPT) \
class NAME##Node : public BASE##Node, \
public detail::DecoratorTrait<NAME##Node>::Type { \
public: \
ARG0TY _##ARG0NM; \
explicit NAME##Node(detail::ParamTrait<ARG0TY>::Type ARG0NM_) \
: BASE##Node(NodeKind::NAME), _##ARG0NM(std::move(ARG0NM_)) {} \
template <class Visitor> \
void visit(Visitor &V) { \
if (!V.shouldVisit(this)) { \
return; \
} \
V.enter(this); \
ESTreeVisit(V, _##ARG0NM); \
V.leave(this); \
} \
static bool classof(const Node *V) { \
return V->getKind() == NodeKind::NAME; \
} \
#define ESTREE_NODE_1_ARGS(NAME, BASE, ARG0TY, ARG0NM, ARG0OPT) \
class NAME##Node : public BASE##Node, \
public detail::DecoratorTrait<NAME##Node>::Type { \
public: \
ARG0TY _##ARG0NM; \
explicit NAME##Node(detail::ParamTrait<ARG0TY>::Type ARG0NM##_) \
: BASE##Node(NodeKind::NAME), _##ARG0NM(std::move(ARG0NM##_)) {} \
template <class Visitor> \
void visit(Visitor &V) { \
if (!V.shouldVisit(this)) { \
return; \
} \
V.enter(this); \
ESTreeVisit(V, _##ARG0NM); \
V.leave(this); \
} \
static bool classof(const Node *V) { \
return V->getKind() == NodeKind::NAME; \
} \
};

#define ESTREE_NODE_2_ARGS( \
Expand All @@ -443,11 +443,11 @@ using BaseNode = Node;
ARG0TY _##ARG0NM; \
ARG1TY _##ARG1NM; \
explicit NAME##Node( \
detail::ParamTrait<ARG0TY>::Type ARG0NM_, \
detail::ParamTrait<ARG1TY>::Type ARG1NM_) \
detail::ParamTrait<ARG0TY>::Type ARG0NM##_, \
detail::ParamTrait<ARG1TY>::Type ARG1NM##_) \
: BASE##Node(NodeKind::NAME), \
_##ARG0NM(std::move(ARG0NM_)), \
_##ARG1NM(std::move(ARG1NM_)) {} \
_##ARG0NM(std::move(ARG0NM##_)), \
_##ARG1NM(std::move(ARG1NM##_)) {} \
template <class Visitor> \
void visit(Visitor &V) { \
if (!V.shouldVisit(this)) { \
Expand Down Expand Up @@ -482,13 +482,13 @@ using BaseNode = Node;
ARG1TY _##ARG1NM; \
ARG2TY _##ARG2NM; \
explicit NAME##Node( \
detail::ParamTrait<ARG0TY>::Type ARG0NM_, \
detail::ParamTrait<ARG1TY>::Type ARG1NM_, \
detail::ParamTrait<ARG2TY>::Type ARG2NM_) \
detail::ParamTrait<ARG0TY>::Type ARG0NM##_, \
detail::ParamTrait<ARG1TY>::Type ARG1NM##_, \
detail::ParamTrait<ARG2TY>::Type ARG2NM##_) \
: BASE##Node(NodeKind::NAME), \
_##ARG0NM(std::move(ARG0NM_)), \
_##ARG1NM(std::move(ARG1NM_)), \
_##ARG2NM(std::move(ARG2NM_)) {} \
_##ARG0NM(std::move(ARG0NM##_)), \
_##ARG1NM(std::move(ARG1NM##_)), \
_##ARG2NM(std::move(ARG2NM##_)) {} \
template <class Visitor> \
void visit(Visitor &V) { \
if (!V.shouldVisit(this)) { \
Expand Down Expand Up @@ -528,15 +528,15 @@ using BaseNode = Node;
ARG2TY _##ARG2NM; \
ARG3TY _##ARG3NM; \
explicit NAME##Node( \
detail::ParamTrait<ARG0TY>::Type ARG0NM_, \
detail::ParamTrait<ARG1TY>::Type ARG1NM_, \
detail::ParamTrait<ARG2TY>::Type ARG2NM_, \
detail::ParamTrait<ARG3TY>::Type ARG3NM_) \
detail::ParamTrait<ARG0TY>::Type ARG0NM##_, \
detail::ParamTrait<ARG1TY>::Type ARG1NM##_, \
detail::ParamTrait<ARG2TY>::Type ARG2NM##_, \
detail::ParamTrait<ARG3TY>::Type ARG3NM##_) \
: BASE##Node(NodeKind::NAME), \
_##ARG0NM(std::move(ARG0NM_)), \
_##ARG1NM(std::move(ARG1NM_)), \
_##ARG2NM(std::move(ARG2NM_)), \
_##ARG3NM(std::move(ARG3NM_)) {} \
_##ARG0NM(std::move(ARG0NM##_)), \
_##ARG1NM(std::move(ARG1NM##_)), \
_##ARG2NM(std::move(ARG2NM##_)), \
_##ARG3NM(std::move(ARG3NM##_)) {} \
template <class Visitor> \
void visit(Visitor &V) { \
if (!V.shouldVisit(this)) { \
Expand Down Expand Up @@ -582,17 +582,17 @@ using BaseNode = Node;
ARG3TY _##ARG3NM; \
ARG4TY _##ARG4NM; \
explicit NAME##Node( \
detail::ParamTrait<ARG0TY>::Type ARG0NM_, \
detail::ParamTrait<ARG1TY>::Type ARG1NM_, \
detail::ParamTrait<ARG2TY>::Type ARG2NM_, \
detail::ParamTrait<ARG3TY>::Type ARG3NM_, \
detail::ParamTrait<ARG4TY>::Type ARG4NM_) \
detail::ParamTrait<ARG0TY>::Type ARG0NM##_, \
detail::ParamTrait<ARG1TY>::Type ARG1NM##_, \
detail::ParamTrait<ARG2TY>::Type ARG2NM##_, \
detail::ParamTrait<ARG3TY>::Type ARG3NM##_, \
detail::ParamTrait<ARG4TY>::Type ARG4NM##_) \
: BASE##Node(NodeKind::NAME), \
_##ARG0NM(std::move(ARG0NM_)), \
_##ARG1NM(std::move(ARG1NM_)), \
_##ARG2NM(std::move(ARG2NM_)), \
_##ARG3NM(std::move(ARG3NM_)), \
_##ARG4NM(std::move(ARG4NM_)) {} \
_##ARG0NM(std::move(ARG0NM##_)), \
_##ARG1NM(std::move(ARG1NM##_)), \
_##ARG2NM(std::move(ARG2NM##_)), \
_##ARG3NM(std::move(ARG3NM##_)), \
_##ARG4NM(std::move(ARG4NM##_)) {} \
template <class Visitor> \
void visit(Visitor &V) { \
if (!V.shouldVisit(this)) { \
Expand Down Expand Up @@ -643,19 +643,19 @@ using BaseNode = Node;
ARG4TY _##ARG4NM; \
ARG5TY _##ARG5NM; \
explicit NAME##Node( \
detail::ParamTrait<ARG0TY>::Type ARG0NM_, \
detail::ParamTrait<ARG1TY>::Type ARG1NM_, \
detail::ParamTrait<ARG2TY>::Type ARG2NM_, \
detail::ParamTrait<ARG3TY>::Type ARG3NM_, \
detail::ParamTrait<ARG4TY>::Type ARG4NM_, \
detail::ParamTrait<ARG5TY>::Type ARG5NM_) \
detail::ParamTrait<ARG0TY>::Type ARG0NM##_, \
detail::ParamTrait<ARG1TY>::Type ARG1NM##_, \
detail::ParamTrait<ARG2TY>::Type ARG2NM##_, \
detail::ParamTrait<ARG3TY>::Type ARG3NM##_, \
detail::ParamTrait<ARG4TY>::Type ARG4NM##_, \
detail::ParamTrait<ARG5TY>::Type ARG5NM##_) \
: BASE##Node(NodeKind::NAME), \
_##ARG0NM(std::move(ARG0NM_)), \
_##ARG1NM(std::move(ARG1NM_)), \
_##ARG2NM(std::move(ARG2NM_)), \
_##ARG3NM(std::move(ARG3NM_)), \
_##ARG4NM(std::move(ARG4NM_)), \
_##ARG5NM(std::move(ARG5NM_)) {} \
_##ARG0NM(std::move(ARG0NM##_)), \
_##ARG1NM(std::move(ARG1NM##_)), \
_##ARG2NM(std::move(ARG2NM##_)), \
_##ARG3NM(std::move(ARG3NM##_)), \
_##ARG4NM(std::move(ARG4NM##_)), \
_##ARG5NM(std::move(ARG5NM##_)) {} \
template <class Visitor> \
void visit(Visitor &V) { \
if (!V.shouldVisit(this)) { \
Expand Down Expand Up @@ -711,21 +711,21 @@ using BaseNode = Node;
ARG5TY _##ARG5NM; \
ARG6TY _##ARG6NM; \
explicit NAME##Node( \
detail::ParamTrait<ARG0TY>::Type ARG0NM_, \
detail::ParamTrait<ARG1TY>::Type ARG1NM_, \
detail::ParamTrait<ARG2TY>::Type ARG2NM_, \
detail::ParamTrait<ARG3TY>::Type ARG3NM_, \
detail::ParamTrait<ARG4TY>::Type ARG4NM_, \
detail::ParamTrait<ARG5TY>::Type ARG5NM_, \
detail::ParamTrait<ARG6TY>::Type ARG6NM_) \
detail::ParamTrait<ARG0TY>::Type ARG0NM##_, \
detail::ParamTrait<ARG1TY>::Type ARG1NM##_, \
detail::ParamTrait<ARG2TY>::Type ARG2NM##_, \
detail::ParamTrait<ARG3TY>::Type ARG3NM##_, \
detail::ParamTrait<ARG4TY>::Type ARG4NM##_, \
detail::ParamTrait<ARG5TY>::Type ARG5NM##_, \
detail::ParamTrait<ARG6TY>::Type ARG6NM##_) \
: BASE##Node(NodeKind::NAME), \
_##ARG0NM(std::move(ARG0NM_)), \
_##ARG1NM(std::move(ARG1NM_)), \
_##ARG2NM(std::move(ARG2NM_)), \
_##ARG3NM(std::move(ARG3NM_)), \
_##ARG4NM(std::move(ARG4NM_)), \
_##ARG5NM(std::move(ARG5NM_)), \
_##ARG6NM(std::move(ARG6NM_)) {} \
_##ARG0NM(std::move(ARG0NM##_)), \
_##ARG1NM(std::move(ARG1NM##_)), \
_##ARG2NM(std::move(ARG2NM##_)), \
_##ARG3NM(std::move(ARG3NM##_)), \
_##ARG4NM(std::move(ARG4NM##_)), \
_##ARG5NM(std::move(ARG5NM##_)), \
_##ARG6NM(std::move(ARG6NM##_)) {} \
template <class Visitor> \
void visit(Visitor &V) { \
if (!V.shouldVisit(this)) { \
Expand Down Expand Up @@ -786,23 +786,23 @@ using BaseNode = Node;
ARG6TY _##ARG6NM; \
ARG7TY _##ARG7NM; \
explicit NAME##Node( \
detail::ParamTrait<ARG0TY>::Type ARG0NM_, \
detail::ParamTrait<ARG1TY>::Type ARG1NM_, \
detail::ParamTrait<ARG2TY>::Type ARG2NM_, \
detail::ParamTrait<ARG3TY>::Type ARG3NM_, \
detail::ParamTrait<ARG4TY>::Type ARG4NM_, \
detail::ParamTrait<ARG5TY>::Type ARG5NM_, \
detail::ParamTrait<ARG6TY>::Type ARG6NM_, \
detail::ParamTrait<ARG7TY>::Type ARG7NM_) \
detail::ParamTrait<ARG0TY>::Type ARG0NM##_, \
detail::ParamTrait<ARG1TY>::Type ARG1NM##_, \
detail::ParamTrait<ARG2TY>::Type ARG2NM##_, \
detail::ParamTrait<ARG3TY>::Type ARG3NM##_, \
detail::ParamTrait<ARG4TY>::Type ARG4NM##_, \
detail::ParamTrait<ARG5TY>::Type ARG5NM##_, \
detail::ParamTrait<ARG6TY>::Type ARG6NM##_, \
detail::ParamTrait<ARG7TY>::Type ARG7NM##_) \
: BASE##Node(NodeKind::NAME), \
_##ARG0NM(std::move(ARG0NM_)), \
_##ARG1NM(std::move(ARG1NM_)), \
_##ARG2NM(std::move(ARG2NM_)), \
_##ARG3NM(std::move(ARG3NM_)), \
_##ARG4NM(std::move(ARG4NM_)), \
_##ARG5NM(std::move(ARG5NM_)), \
_##ARG6NM(std::move(ARG6NM_)), \
_##ARG7NM(std::move(ARG7NM_)) {} \
_##ARG0NM(std::move(ARG0NM##_)), \
_##ARG1NM(std::move(ARG1NM##_)), \
_##ARG2NM(std::move(ARG2NM##_)), \
_##ARG3NM(std::move(ARG3NM##_)), \
_##ARG4NM(std::move(ARG4NM##_)), \
_##ARG5NM(std::move(ARG5NM##_)), \
_##ARG6NM(std::move(ARG6NM##_)), \
_##ARG7NM(std::move(ARG7NM##_)) {} \
template <class Visitor> \
void visit(Visitor &V) { \
if (!V.shouldVisit(this)) { \
Expand Down

0 comments on commit 2214e2f

Please sign in to comment.