Spicy
type.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 #include <hilti/ast/types/any.h>
9 
10 namespace hilti::type {
11 
14 public:
15  Type_(Type t, Meta m = Meta()) : TypeBase(nodes(std::move(t)), std::move(m)) {}
16  Type_(Wildcard /*unused*/, Meta m = Meta()) : TypeBase(nodes(type::Any()), std::move(m)), _wildcard(true) {}
17 
18  const auto& typeValue() const { return child<Type>(0); }
19 
20  bool operator==(const Type_& other) const { return typeValue() == other.typeValue(); }
21 
23  auto isEqual(const Type& other) const { return node::isEqual(this, other); }
25  auto _isResolved(ResolvedState* rstate) const { return type::detail::isResolved(typeValue(), rstate); }
27  auto typeParameters() const { return children(); }
29  auto isWildcard() const { return _wildcard; }
31  auto properties() const { return node::Properties{}; }
32 
33 private:
34  bool _wildcard = false;
35 };
36 
37 } // namespace hilti::type
const auto & children() const
Definition: node.h:471
auto _isResolved(ResolvedState *rstate) const
Definition: type.h:25
auto typeParameters() const
Definition: type.h:27
Definition: meta.h:19
auto properties() const
Definition: type.h:31
Definition: type.h:158
Definition: any.h:12
std::map< std::string, node::detail::PropertyValue > Properties
Definition: node.h:97
Definition: type.h:197
Definition: type.h:13
auto isWildcard() const
Definition: type.h:29
Definition: type.h:268
auto isEqual(const Type &other) const
Definition: type.h:23
Definition: type.h:25