|
@@ -310,30 +310,31 @@ auto MatchNode(Args... args) -> ExpectedNode {
|
|
|
// MatchParameterList(MatchParameterListEnd()),
|
|
// MatchParameterList(MatchParameterListEnd()),
|
|
|
// MatchDeclarationEnd(";")),
|
|
// MatchDeclarationEnd(";")),
|
|
|
// MatchFileEnd()});
|
|
// MatchFileEnd()});
|
|
|
-#define CARBON_PARSE_NODE_KIND(kind) \
|
|
|
|
|
- template <typename... Args> \
|
|
|
|
|
- auto Match##kind(Args... args)->ExpectedNode { \
|
|
|
|
|
- return MatchNode(ParseNodeKind::kind(), args...); \
|
|
|
|
|
|
|
+#define CARBON_PARSE_NODE_KIND(kind) \
|
|
|
|
|
+ template <typename... Args> \
|
|
|
|
|
+ auto Match##kind(Args... args)->ExpectedNode { \
|
|
|
|
|
+ return MatchNode(ParseNodeKind::kind(), std::move(args)...); \
|
|
|
}
|
|
}
|
|
|
#include "parse_node_kind.def"
|
|
#include "parse_node_kind.def"
|
|
|
|
|
|
|
|
// Helper for matching a designator `lhs.rhs`.
|
|
// Helper for matching a designator `lhs.rhs`.
|
|
|
auto MatchDesignator(ExpectedNode lhs, std::string rhs) -> ExpectedNode {
|
|
auto MatchDesignator(ExpectedNode lhs, std::string rhs) -> ExpectedNode {
|
|
|
- return MatchDesignatorExpression(lhs, MatchDesignatedName(rhs));
|
|
|
|
|
|
|
+ return MatchDesignatorExpression(std::move(lhs), MatchDesignatedName(rhs));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// Helper for matching a function parameter list.
|
|
// Helper for matching a function parameter list.
|
|
|
template <typename... Args>
|
|
template <typename... Args>
|
|
|
auto MatchParameters(Args... args) -> ExpectedNode {
|
|
auto MatchParameters(Args... args) -> ExpectedNode {
|
|
|
- return MatchParameterList("(", args..., MatchParameterListEnd());
|
|
|
|
|
|
|
+ return MatchParameterList("(", std::move(args)..., MatchParameterListEnd());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// Helper for matching the statements in the body of a simple function
|
|
// Helper for matching the statements in the body of a simple function
|
|
|
// definition with no parameters.
|
|
// definition with no parameters.
|
|
|
template <typename... Args>
|
|
template <typename... Args>
|
|
|
auto MatchFunctionWithBody(Args... args) -> ExpectedNode {
|
|
auto MatchFunctionWithBody(Args... args) -> ExpectedNode {
|
|
|
- return MatchFunctionDeclaration(MatchDeclaredName(), MatchParameters(),
|
|
|
|
|
- MatchCodeBlock(args..., MatchCodeBlockEnd()));
|
|
|
|
|
|
|
+ return MatchFunctionDeclaration(
|
|
|
|
|
+ MatchDeclaredName(), MatchParameters(),
|
|
|
|
|
+ MatchCodeBlock(std::move(args)..., MatchCodeBlockEnd()));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
} // namespace NodeMatchers
|
|
} // namespace NodeMatchers
|