Skip to content

Commit

Permalink
Fix printing of enum constants.
Browse files Browse the repository at this point in the history
I believe this path never triggered so far, but it does now with the
new constant folding.
  • Loading branch information
rsmmr committed Dec 16, 2022
1 parent 7ce919c commit fa7e160
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion hilti/toolchain/src/compiler/visitors/printer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,10 @@ struct Visitor : visitor::PreOrder<void, Visitor> {
out << "default<" << n.type() << ">(" << std::make_pair(n.typeArguments(), ", ") << ")";
}

void operator()(const ctor::Enum& n, position_t p) { out << *p.node.as<Type>().typeID() << "::" << n.value(); }
void operator()(const ctor::Enum& n, position_t p) {
assert(n.type().typeID());
out << *n.type().typeID() << "::" << n.value().id();
}

void operator()(const ctor::Error& n) { out << "error(\"" << n.value() << "\")"; }

Expand Down

0 comments on commit fa7e160

Please sign in to comment.