Skip to content

Commit

Permalink
update to new Node::parent() signature
Browse files Browse the repository at this point in the history
  • Loading branch information
fhackett committed Aug 21, 2024
1 parent 39f4c40 commit d19c8b9
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 18 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ FetchContent_Declare(
FetchContent_Declare(
trieste
GIT_REPOSITORY https://github.com/microsoft/trieste
GIT_TAG d51038b8392220637ce912e12fffc2c86715e54b
GIT_TAG 7ddc75733bc74ee43b98d4999fe15045f4115f69
)

FetchContent_MakeAvailable(cmake_utils)
Expand Down
2 changes: 1 addition & 1 deletion src/internal.cc
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ namespace rego
return false;
}

return is_in(node->parent()->intrusive_ptr_from_this(), types);
return is_in(node->parent(), types);
}

bool is_constant(const Node& term)
Expand Down
6 changes: 3 additions & 3 deletions src/reader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -665,17 +665,17 @@ namespace
}};

pass.pre(Comma, [comma_groups](Node node) {
comma_groups->insert(node->parent());
comma_groups->insert(node->parent_unsafe());
return 0;
});

pass.pre(Colon, [colon_groups](Node node) {
colon_groups->insert(node->parent());
colon_groups->insert(node->parent_unsafe());
return 0;
});

pass.pre(Or, [or_groups](Node node) {
auto group = node->parent();
auto group = node->parent_unsafe();
auto pos = group->find(node);
for (auto it = group->begin(); it != pos; ++it)
{
Expand Down
3 changes: 1 addition & 2 deletions src/unifier.cc
Original file line number Diff line number Diff line change
Expand Up @@ -411,8 +411,7 @@ namespace rego
"Recursion detected in rule body: " + std::string(m_rule.view()));
}

logging::Debug() << "=====Unification====="
<< "exprs: " << m_statements;
logging::Debug() << "=====Unification=====" << "exprs: " << m_statements;

{
logging::LocalIndent indent;
Expand Down
2 changes: 1 addition & 1 deletion src/unify.cc
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ namespace rego
return name.find("query$") != std::string::npos;
}

return in_query(node->parent()->intrusive_ptr_from_this());
return in_query(node->parent());
}

bool contains_local(const Node& node)
Expand Down
2 changes: 1 addition & 1 deletion src/unify/absolute_refs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ namespace
return Ref << (RefHead << (Var ^ "data")) << refargseq;
}

Node ref = build_ref(leaf->parent()->intrusive_ptr_from_this());
Node ref = build_ref(leaf->parent());

if (leaf->type() == Policy || leaf->type() == DataModule)
{
Expand Down
10 changes: 5 additions & 5 deletions src/unify/enumerate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ namespace
find_all_refs_in(local->scope(), (local / Var)->location(), refs);
for (auto& ref : refs)
{
if (ref->parent() == local.get())
if (ref->parent() == local)
{
continue;
}
Expand Down Expand Up @@ -61,7 +61,7 @@ namespace

Node next_enum(Node local)
{
Node unifybody = local->parent()->intrusive_ptr_from_this();
Node unifybody = local->parent();
auto it = unifybody->find(local) + 1;
return find_enum(unifybody, it);
}
Expand Down Expand Up @@ -302,21 +302,21 @@ namespace rego
if (is_in(local, {LiteralEnum}))
{
// should this local be defined here?
Node unifybody = local->parent()->intrusive_ptr_from_this();
Node unifybody = local->parent();
bool requires_move = false;
while (!should_be_defined_in(local, unifybody))
{
// we need to keep popping out of nested enums until we find the
// correct scope
requires_move = true;
NodeDef* literalenum = unifybody->parent();
Node literalenum = unifybody->parent();
if (literalenum->type() != LiteralEnum)
{
// we've popped out of the nested enums
break;
}

unifybody = literalenum->parent()->intrusive_ptr_from_this();
unifybody = literalenum->parent();
}

if (requires_move)
Expand Down
4 changes: 2 additions & 2 deletions src/unify/lift_to_rule.cc
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ namespace
}
}

Node get_version(NodeDef* node)
Node get_version(Node node)
{
if (node == Top)
{
Expand All @@ -151,7 +151,7 @@ namespace
return (*it)->clone();
}

return err(node->intrusive_ptr_from_this(), "Missing version");
return err(node, "Missing version");
}

return get_version(node->parent());
Expand Down
3 changes: 1 addition & 2 deletions src/unify/symbols.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ namespace
auto it = module->find_first(Version, module->begin());
if (it == module->end())
{
return err(
module->intrusive_ptr_from_this(), "No version found in module");
return err(module, "No version found in module");
}
return (*it)->clone();
}
Expand Down

0 comments on commit d19c8b9

Please sign in to comment.