Spicy
exception.h
1 // Copyright (c) 2020-2021 by the Zeek Project. See LICENSE for details.
2 
3 #pragma once
4 
5 #include <utility>
6 
7 #include <hilti/ast/type.h>
8 
9 namespace hilti {
10 namespace type {
11 
14 public:
15  Exception(Meta m = Meta()) : TypeBase({node::none}, std::move(m)) {}
16  Exception(Type base, Meta m = Meta()) : TypeBase({std::move(base)}, std::move(m)) {}
17  Exception(Wildcard /*unused*/, Meta m = Meta()) : TypeBase({node::none}, std::move(m)), _wildcard(true) {}
18 
19  hilti::optional_ref<const Type> baseType() const { return children()[0].tryAs<Type>(); }
20 
21  bool operator==(const Exception& other) const { return baseType() == other.baseType(); }
22 
24  auto isEqual(const Type& other) const { return node::isEqual(this, other); }
26  auto _isResolved(ResolvedState* rstate) const {
27  return baseType().has_value() ? type::detail::isResolved(baseType(), rstate) : true;
28  }
30  auto typeParameters() const { return children(); }
32  auto isWildcard() const { return _wildcard; }
34  auto properties() const { return node::Properties{}; }
35 
36 private:
37  bool _wildcard = false;
38 };
39 
40 } // namespace type
41 } // namespace hilti
auto isWildcard() const
Definition: exception.h:32
const Node none
Definition: node.cc:14
const auto & children() const
Definition: node.h:470
auto properties() const
Definition: exception.h:34
Definition: meta.h:18
Definition: exception.h:13
Definition: type.h:159
Definition: optional-ref.h:22
std::map< std::string, node::detail::PropertyValue > Properties
Definition: node.h:99
Definition: type.h:198
Definition: type.h:33
Definition: type.h:269
auto typeParameters() const
Definition: exception.h:30
auto isEqual(const Type &other) const
Definition: exception.h:24
auto _isResolved(ResolvedState *rstate) const
Definition: exception.h:26