mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-04 22:02:52 +01:00
Change result_id to use is_valid instead of an optional. (#2449)
Incrementally shrinks size, but should also make the errors a bit clearer with better context.
This commit is contained in:
@@ -23,6 +23,7 @@ struct SemanticsNodeId : public IndexBase {
|
||||
static auto MakeCrossReference(int32_t index) -> SemanticsNodeId {
|
||||
return SemanticsNodeId(index | CrossReferenceBit);
|
||||
}
|
||||
|
||||
// Constructs a cross-reference node ID for a builtin. This relies on
|
||||
// SemanticsIR guarantees for builtin cross-reference placement.
|
||||
static auto MakeBuiltinReference(SemanticsBuiltinKind kind)
|
||||
@@ -30,6 +31,9 @@ struct SemanticsNodeId : public IndexBase {
|
||||
return MakeCrossReference(kind.AsInt());
|
||||
}
|
||||
|
||||
// Constructs an explicitly invalid instance.
|
||||
static auto MakeInvalid() -> SemanticsNodeId { return SemanticsNodeId(); }
|
||||
|
||||
using IndexBase::IndexBase;
|
||||
|
||||
auto is_cross_reference() const -> bool { return index & CrossReferenceBit; }
|
||||
|
||||
Reference in New Issue
Block a user