// Copyright (c) 2020-now by the Zeek Project. See LICENSE for details. #pragma once #include #include #include namespace hilti::ctor { /** AST node for a constructor that's been coerced from one type to another. */ class Coerced : public Ctor { public: auto originalCtor() const { return child(0); } auto coercedCtor() const { return child(1); } QualifiedType* type() const final { return coercedCtor()->type(); } static auto create(ASTContext* ctx, Ctor* orig, Ctor* new_, Meta meta = {}) { return ctx->make(ctx, {orig, new_}, std::move(meta)); } protected: Coerced(ASTContext* ctx, Nodes children, Meta meta) : Ctor(ctx, NodeTags, std::move(children), std::move(meta)) {} HILTI_NODE_1(ctor::Coerced, Ctor, final); }; } // namespace hilti::ctor