make creation via variables work

This commit is contained in:
DavIvek 2024-02-28 19:15:03 +01:00
parent ef2fcd411b
commit 502d7a6dff
2 changed files with 13 additions and 5 deletions

View File

@ -589,7 +589,7 @@ bool SymbolGenerator::PostVisit(Pattern &) {
}
bool SymbolGenerator::PreVisit(NodeAtom &node_atom) {
auto &scope = scopes_.back();
auto &scope = scopes_.back(); // change this part of code
auto check_node_semantic = [&node_atom, &scope, this](const bool props_or_labels) {
const auto &node_name = node_atom.identifier_->name_;
if ((scope.in_create || scope.in_merge) && props_or_labels && HasSymbol(node_name)) {
@ -602,6 +602,14 @@ bool SymbolGenerator::PreVisit(NodeAtom &node_atom) {
};
scope.in_node_atom = true;
// TODO: check if the node is in create scope, then no need to check for the expression since we don't allow it
for (auto &label : node_atom.labels_) {
if (auto *expression = std::get_if<Expression *>(&label)) {
(*expression)->Accept(*this);
}
}
if (auto *properties = std::get_if<std::unordered_map<PropertyIx, Expression *>>(&node_atom.properties_)) {
bool props_or_labels = !properties->empty() || !node_atom.labels_.empty();

View File

@ -291,10 +291,10 @@ bool CreateNode::CreateNodeCursor::Pull(Frame &frame, ExecutionContext &context)
if (const auto *label_atom = std::get_if<storage::LabelId>(&label)) {
labels.emplace_back(*label_atom);
} else {
// auto key = evaluator.Visit(*std::get<Expression *>(label));
// labels.emplace_back(context.db_accessor->NameToLabel(key.ValueString()));
auto expression = std::get<Expression *>(label);
labels.emplace_back(context.db_accessor->NameToLabel(expression->Accept(evaluator).ValueString()));
// auto expression = std::get<Expression *>(label);
// labels.emplace_back(context.db_accessor->NameToLabel(expression->Accept(evaluator).ValueString()));
// we can't resolve the label here, because frame is empty
continue;
}
}
#ifdef MG_ENTERPRISE