Spicy
result.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/unknown.h>
9 
10 namespace hilti {
11 namespace type {
12 
15 public:
16  Result(Wildcard /*unused*/, Meta m = Meta()) : TypeBase({type::unknown}, std::move(m)), _wildcard(true) {}
17  Result(Type ct, Meta m = Meta()) : TypeBase({std::move(ct)}, std::move(m)) {}
18 
19  const Type& dereferencedType() const { return childs()[0].as<Type>(); }
20 
21  bool operator==(const Result& other) const { return dereferencedType() == other.dereferencedType(); }
22 
24  auto isEqual(const Type& other) const { return node::isEqual(this, other); }
26  auto _isResolved(ResolvedState* rstate) const { return type::detail::isResolved(dereferencedType(), rstate); }
28  auto typeParameters() const { return childs(); }
30  auto isWildcard() const { return _wildcard; }
31 
33  auto properties() const { return node::Properties{}; }
34 
35 private:
36  bool _wildcard = false;
37 };
38 
39 } // namespace type
40 } // namespace hilti
auto isWildcard() const
Definition: result.h:30
auto _isResolved(ResolvedState *rstate) const
Definition: result.h:26
auto typeParameters() const
Definition: result.h:28
auto isEqual(const Type &other) const
Definition: result.h:24
Definition: meta.h:18
Definition: type.h:159
auto properties() const
Definition: result.h:33
std::map< std::string, node::detail::PropertyValue > Properties
Definition: node.h:99
Definition: type.h:198
Definition: type.h:33
Definition: type.h:269
const auto & childs() const
Definition: node.h:470
Definition: result.h:14