Switch constexpr factory functions to constexpr values. (#2581)

Using the same const/constexpr done in EnumBase, adds Invalid and Builtin* values to replace Make functions that produced the same. This should make it clearer at call sites what the cost actually is, and reduces the syntactic overhead for MakeBuiltinReference in particular.

Really, this is that MakeBuiltinReference has been feeling pretty verbose, so I did that, and then one MakeInvalid is right next to it, and then obviously I should replace the other MakeInvalid for consistency...
This commit is contained in:
Jon Ross-Perkins
2023-02-06 15:57:33 -08:00
committed by GitHub
parent 1a8a41a5a6
commit 5a0613283b
4 changed files with 33 additions and 29 deletions
+2 -3
View File
@@ -36,9 +36,8 @@ class SemanticsNodeStack {
// Pushes a solo parse tree node onto the stack. Used when there is no
// IR generated by the node.
auto Push(ParseTree::Node parse_node) -> void {
PushEntry(
{.parse_node = parse_node, .node_id = SemanticsNodeId::MakeInvalid()},
DebugLog::None);
PushEntry({.parse_node = parse_node, .node_id = SemanticsNodeId::Invalid},
DebugLog::None);
}
// Pushes a parse tree node onto the stack.