// Copyright (c) 2020-now by the Zeek Project. See LICENSE for details. #pragma once #include #include #include #include namespace hilti::declaration { /** AST node for a property declaration. */ class Property : public Declaration { public: auto expression() const { return childTryAs<::hilti::Expression>(0); } std::string_view displayName() const final { return "property"; } static auto create(ASTContext* ctx, ID id, Meta meta = {}) { return ctx->make(ctx, {}, std::move(id), std::move(meta)); } static auto create(ASTContext* ctx, ID id, hilti::Expression* expr, Meta meta = {}) { return ctx->make(ctx, {expr}, std::move(id), std::move(meta)); } protected: Property(ASTContext* ctx, Nodes children, ID id, Meta meta) : Declaration(ctx, NodeTags, std::move(children), std::move(id), Linkage::Private, std::move(meta)) {} HILTI_NODE_1(declaration::Property, Declaration, final); }; using Properties = std::vector; } // namespace hilti::declaration