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(nodes(std::move(t)), std::move(m)) {}
17  Type_(Wildcard /*unused*/, Meta m = Meta()) : TypeBase(nodes(type::Any()), std::move(m)), _wildcard(true) {}
18 
19  const auto& typeValue() const { return 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 _isResolved(ResolvedState* rstate) const { return type::detail::isResolved(typeValue(), rstate); }
28  auto typeParameters() const { return children(); }
30  auto isWildcard() const { return _wildcard; }
32  auto properties() const { return node::Properties{}; }
33 
34 private:
35  bool _wildcard = false;
36 };
37 
38 } // namespace type
39 } // namespace hilti
const auto & children() const
Definition: node.h:470
auto _isResolved(ResolvedState *rstate) const
Definition: type.h:26
auto typeParameters() const
Definition: type.h:28
Definition: meta.h:18
auto properties() const
Definition: type.h:32
Definition: type.h:159
Definition: any.h:13
std::map< std::string, node::detail::PropertyValue > Properties
Definition: node.h:99
Definition: type.h:198
Definition: type.h:14
auto isWildcard() const
Definition: type.h:30
Definition: type.h:269
auto isEqual(const Type &other) const
Definition: type.h:24