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 {
11 namespace type {
12 
15 public:
16  Type_(Type t, Meta m = Meta()) : TypeBase({std::move(t)}, std::move(m)) {}
17  Type_(Wildcard /*unused*/, Meta m = Meta()) : TypeBase(std::move(m)), _wildcard(true) {}
18 
19  auto typeValue() const { return _wildcard ? type::Any() : type::effectiveType(child<Type>(0)); }
20 
21  bool operator==(const Type_& other) const { return typeValue() == other.typeValue(); }
22 
24  auto isEqual(const Type& other) const { return node::isEqual(this, other); }
26  auto typeParameters() const { return childs(); }
28  auto isWildcard() const { return _wildcard; }
30  auto properties() const { return node::Properties{}; }
31 
32 private:
33  bool _wildcard = false;
34 };
35 
36 } // namespace type
37 } // namespace hilti
auto & childs() const
Definition: node.h:445
auto typeParameters() const
Definition: type.h:26
Definition: meta.h:18
auto properties() const
Definition: type.h:30
Definition: any.h:13
std::map< std::string, node::detail::PropertyValue > Properties
Definition: node.h:83
Definition: type.h:152
Definition: type.h:14
auto isWildcard() const
Definition: type.h:28
Definition: type.h:249
auto isEqual(const Type &other) const
Definition: type.h:24