Spicy
hilti
toolchain
include
ast
expression.h
1
// Copyright (c) 2020-now by the Zeek Project. See LICENSE for details.
2
3
#pragma once
4
5
#include <string>
6
#include <utility>
7
8
#include <hilti/ast/forward.h>
9
#include <hilti/ast/node.h>
10
#include <hilti/ast/type.h>
11
12
namespace
hilti {
13
15
class
Expression
:
public
Node
{
16
public
:
18
auto
isConstant
()
const
{
return
type
()->
isConstant
(); }
19
21
auto
isResolved
(
node::CycleDetector
* cd =
nullptr
)
const
{
return
type
()->
type
()->
isResolved
(cd); }
22
24
virtual
QualifiedType
*
type
()
const
= 0;
25
26
protected
:
27
Expression
(
ASTContext
* ctx, node::Tags node_tags,
Nodes
children
,
Meta
meta
)
28
:
Node
::
Node
(ctx, node_tags, std::move(
children
), std::move(
meta
)) {}
29
30
std::string
_dump
()
const override
;
31
32
HILTI_NODE_0(
Expression
,
override
);
33
};
34
35
namespace
expression {
36
38
inline
bool
areResolved(
const
node::Range<Expression>
& exprs) {
39
for
(
const
auto
& e : exprs ) {
40
if
( ! e->isResolved() )
41
return
false
;
42
}
43
44
return
true
;
45
}
46
47
}
// namespace expression
48
49
}
// namespace hilti
hilti::ASTContext
Definition:
ast-context.h:121
hilti::Expression
Definition:
expression.h:15
hilti::Expression::isResolved
auto isResolved(node::CycleDetector *cd=nullptr) const
Definition:
expression.h:21
hilti::Expression::_dump
std::string _dump() const override
Definition:
expression.cc:13
hilti::Expression::type
virtual QualifiedType * type() const =0
hilti::Expression::isConstant
auto isConstant() const
Definition:
expression.h:18
hilti::Meta
Definition:
meta.h:30
hilti::Node
Definition:
node.h:240
hilti::Node::children
const auto & children() const
Definition:
node.h:364
hilti::Node::meta
const auto & meta() const
Definition:
node.h:306
hilti::Nodes
Definition:
forward.h:758
hilti::QualifiedType
Definition:
type.h:362
hilti::QualifiedType::type
UnqualifiedType * type(bool follow=true) const
Definition:
type.h:369
hilti::QualifiedType::isConstant
bool isConstant() const
Definition:
type.h:372
hilti::UnqualifiedType::isResolved
virtual bool isResolved(node::CycleDetector *cd=nullptr) const
Definition:
type.h:296
hilti::node::CycleDetector
Definition:
node.h:1122
hilti::node::Range
Definition:
node-range.h:92
Generated by
1.9.1