diff options
author | pennae <github@quasiparticle.net> | 2022-04-22 21:45:39 +0200 |
---|---|---|
committer | pennae <github@quasiparticle.net> | 2022-04-25 15:37:01 +0200 |
commit | a385e51a086006c0f7d7c4bc6ed910dbe5375c4d (patch) | |
tree | 2b9776ddd7fa0977827e21379cd138cc54943071 /src/libexpr/attr-set.cc | |
parent | 7f814d6d9af9d78f922d59115a94078f807676a8 (diff) |
rename SymbolIdx -> Symbol, Symbol -> SymbolStr
after #6218 `Symbol` no longer confers a uniqueness invariant on the
string it wraps, it is now possible to create multiple symbols that
compare equal but whose string contents have different addresses. this
guarantee is now only provided by `SymbolIdx`, leaving `Symbol` only as
a string wrapper that knows about the intricacies of how symbols need to
be formatted for output.
this change renames `SymbolIdx` to `Symbol` to restore the previous
semantics of `Symbol` to that name. we also keep the wrapper type and
rename it to `SymbolStr` instead of returning plain strings from lookups
into the symbol table because symbols are formatted for output in many
places. theoretically we do not need `SymbolStr`, only a function that
formats a string for output as a symbol, but having to wrap every symbol
that appears in a message into eg `formatSymbol()` is error-prone and
inconvient.
Diffstat (limited to 'src/libexpr/attr-set.cc')
-rw-r--r-- | src/libexpr/attr-set.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libexpr/attr-set.cc b/src/libexpr/attr-set.cc index 1d17ef7e4..61996eae4 100644 --- a/src/libexpr/attr-set.cc +++ b/src/libexpr/attr-set.cc @@ -26,7 +26,7 @@ Bindings * EvalState::allocBindings(size_t capacity) /* Create a new attribute named 'name' on an existing attribute set stored in 'vAttrs' and return the newly allocated Value which is associated with this attribute. */ -Value * EvalState::allocAttr(Value & vAttrs, const SymbolIdx & name) +Value * EvalState::allocAttr(Value & vAttrs, const Symbol & name) { Value * v = allocValue(); vAttrs.attrs->push_back(Attr(name, v)); @@ -40,7 +40,7 @@ Value * EvalState::allocAttr(Value & vAttrs, std::string_view name) } -Value & BindingsBuilder::alloc(const SymbolIdx & name, PosIdx pos) +Value & BindingsBuilder::alloc(const Symbol & name, PosIdx pos) { auto value = state.allocValue(); bindings->push_back(Attr(name, value, pos)); |