// Copyright (c) 2020-now by the Zeek Project. See LICENSE for details. #pragma once #include #include #include #include #include namespace hilti::ctor { /** AST node for a enum constructor. */ class Enum : public Ctor { public: auto value() const { return child(0); } QualifiedType* type() const final { return child(1); } static auto create(ASTContext* ctx, type::enum_::Label* label, const Meta& meta = {}) { return ctx->make(ctx, {label, QualifiedType::createExternal(ctx, label->enumType(), Constness::Const, meta)}, meta); } protected: Enum(ASTContext* ctx, Nodes children, Meta meta) : Ctor(ctx, NodeTags, std::move(children), std::move(meta)) {} HILTI_NODE_1(ctor::Enum, Ctor, final); }; } // namespace hilti::ctor