Spicy
hilti
toolchain
include
ast
ctors
coerced.h
1
// Copyright (c) 2020-now by the Zeek Project. See LICENSE for details.
2
3
#pragma once
4
5
#include <memory>
6
#include <utility>
7
8
#include <hilti/ast/ctor.h>
9
10
namespace
hilti::ctor {
11
13
class
Coerced
:
public
Ctor
{
14
public
:
15
auto
originalCtor()
const
{
return
child<Ctor>(0); }
16
auto
coercedCtor()
const
{
return
child<Ctor>(1); }
17
18
QualifiedType
*
type
() const final {
return
coercedCtor()->type(); }
19
20
static
auto
create(
ASTContext
* ctx,
Ctor
* orig,
Ctor
* new_,
Meta
meta
= {}) {
21
return
ctx->
make
<Coerced>(ctx, {orig, new_}, std::move(
meta
));
22
}
23
24
protected
:
25
Coerced(ASTContext* ctx, Nodes
children
, Meta
meta
) : Ctor(ctx, NodeTags, std::move(
children
), std::move(
meta
)) {}
26
27
HILTI_NODE_1(ctor::Coerced, Ctor,
final
);
28
};
29
30
}
// namespace hilti::ctor
hilti::ASTContext
Definition:
ast-context.h:121
hilti::ASTContext::make
T * make(Args &&... args)
Definition:
ast-context.h:366
hilti::Ctor
Definition:
ctor.h:14
hilti::Meta
Definition:
meta.h:30
hilti::Node::children
const auto & children() const
Definition:
node.h:364
hilti::Node::meta
const auto & meta() const
Definition:
node.h:306
hilti::QualifiedType
Definition:
type.h:362
hilti::ctor::Coerced
Definition:
coerced.h:13
hilti::ctor::Coerced::type
QualifiedType * type() const final
Definition:
coerced.h:18
Generated by
1.9.1