xo-reader2: utest with variable reference. Works !
This commit is contained in:
parent
058d518e8b
commit
ef7fc21287
2 changed files with 8 additions and 3 deletions
|
|
@ -27,7 +27,7 @@ namespace xo {
|
||||||
Binding::print(std::ostream & os) const
|
Binding::print(std::ostream & os) const
|
||||||
{
|
{
|
||||||
if (i_link_ == c_link_global) {
|
if (i_link_ == c_link_global) {
|
||||||
os << "{path:global}";
|
os << "{path:global:" << j_slot_ << "}";
|
||||||
} else if (i_link_ == c_link_sentinel) {
|
} else if (i_link_ == c_link_sentinel) {
|
||||||
os << "{path}";
|
os << "{path}";
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -69,6 +69,8 @@ namespace xo {
|
||||||
DGlobalSymtab::upsert_variable(obj<AAllocator> mm,
|
DGlobalSymtab::upsert_variable(obj<AAllocator> mm,
|
||||||
DVariable * var)
|
DVariable * var)
|
||||||
{
|
{
|
||||||
|
scope log(XO_DEBUG(true), std::string_view(*var->name()));
|
||||||
|
|
||||||
// It's possible there's already a global variable
|
// It's possible there's already a global variable
|
||||||
// with the same name.
|
// with the same name.
|
||||||
//
|
//
|
||||||
|
|
@ -78,6 +80,8 @@ namespace xo {
|
||||||
DVariable * existing = this->lookup_variable(var->name());
|
DVariable * existing = this->lookup_variable(var->name());
|
||||||
|
|
||||||
if (existing) {
|
if (existing) {
|
||||||
|
log && log("variable with this symbol already exists");
|
||||||
|
|
||||||
if (existing == var) {
|
if (existing == var) {
|
||||||
// impossible, but.. noop, right?
|
// impossible, but.. noop, right?
|
||||||
return;
|
return;
|
||||||
|
|
@ -91,6 +95,8 @@ namespace xo {
|
||||||
//
|
//
|
||||||
(*vars_)[existing->path().j_slot()] = obj<AGCObject,DVariable>(var);
|
(*vars_)[existing->path().j_slot()] = obj<AGCObject,DVariable>(var);
|
||||||
} else {
|
} else {
|
||||||
|
log && log("variable is new");
|
||||||
|
|
||||||
DArray::size_type n = vars_->size();
|
DArray::size_type n = vars_->size();
|
||||||
|
|
||||||
// NOTE: expansion of var_ array here is moot at present (Feb 2026),
|
// NOTE: expansion of var_ array here is moot at present (Feb 2026),
|
||||||
|
|
@ -146,8 +152,7 @@ namespace xo {
|
||||||
{
|
{
|
||||||
assert(sym);
|
assert(sym);
|
||||||
|
|
||||||
scope log(XO_DEBUG(true), "stub");
|
scope log(XO_DEBUG(true), std::string_view(*sym));
|
||||||
log && log(xtag("sym", std::string_view(*sym)));
|
|
||||||
|
|
||||||
auto ix = map_->find(sym);
|
auto ix = map_->find(sym);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue