Skip to content

Commit

Permalink
Merge branch 'souffle-lang:master' into compoundconj
Browse files Browse the repository at this point in the history
  • Loading branch information
quentin committed Dec 19, 2023
2 parents 5d3bc52 + f766700 commit bba07d6
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 4 deletions.
5 changes: 2 additions & 3 deletions src/ast/UserDefinedAggregator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,9 @@ Node::NodeVec UserDefinedAggregator::getChildren() const {
}

void UserDefinedAggregator::print(std::ostream& os) const {
os << "@" << name;
os << " init: " << *initValue;
os << "@@" << name << " " << *initValue;
if (targetExpression) {
os << " " << *targetExpression;
os << ", " << *targetExpression;
}
os << " : { " << join(body) << " }";
}
Expand Down
1 change: 1 addition & 0 deletions src/ram/Aggregate.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ class Aggregate : public RelationOperation, public AbstractAggregate {
RelationOperation::apply(map);
condition = map(std::move(condition));
expression = map(std::move(expression));
function->apply(map);
}

static bool classof(const Node* n) {
Expand Down
2 changes: 2 additions & 0 deletions src/ram/Aggregator.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ class Aggregator {
return {};
}

virtual void apply(const NodeMapper&) {}

/**
* @brief Create a cloning (i.e. deep copy) of this node
*/
Expand Down
1 change: 1 addition & 0 deletions src/ram/IndexAggregate.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ class IndexAggregate : public IndexOperation, public AbstractAggregate {
IndexOperation::apply(map);
condition = map(std::move(condition));
expression = map(std::move(expression));
function->apply(map);
}

static bool classof(const Node* n) {
Expand Down
6 changes: 5 additions & 1 deletion src/ram/UserDefinedAggregator.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ class UserDefinedAggregator : public Aggregator {
os << name << " INIT " << *initValue << " ";
}

void apply(const NodeMapper& map) override {
initValue = map(std::move(initValue));
}

protected:
/** Aggregation function */
const std::string name;
Expand All @@ -92,4 +96,4 @@ class UserDefinedAggregator : public Aggregator {
/** Stateful */
const bool stateful;
};
} // namespace souffle::ram
} // namespace souffle::ram

0 comments on commit bba07d6

Please sign in to comment.