Spicy
integer.h
1 // Copyright (c) 2020-2021 by the Zeek Project. See LICENSE for details.
2 
3 #pragma once
4 
5 #include <utility>
6 #include <vector>
7 
8 #include <hilti/ast/type.h>
9 
10 namespace hilti {
11 namespace type {
12 
13 namespace detail {
14 
15 // CHECK: IntegerBase = TypeBase
18 public:
19  IntegerBase(Wildcard /*unused*/, Meta m = Meta()) : TypeBase(std::move(m)), _wildcard(true) {}
20  IntegerBase(int width, Meta m = Meta()) : TypeBase(std::move(m)), _width(width) {}
21  IntegerBase(Meta m = Meta()) : TypeBase(std::move(m)) {}
22 
23  auto width() const { return _width; }
24 
26  auto isWildcard() const { return _wildcard; }
28  auto _isResolved(ResolvedState* rstate) const { return true; }
30  auto properties() const { return node::Properties{{"width", _width}}; }
31 
32 private:
33  bool _wildcard = false;
34  int _width = 0;
35 };
36 
37 } // namespace detail
38 
41 public:
42  using detail::IntegerBase::IntegerBase;
43 
44  bool operator==(const SignedInteger& other) const { return width() == other.width(); }
45 
47  std::vector<Node> typeParameters() const;
48 
50  auto isEqual(const Type& other) const { return node::isEqual(this, other); }
51 };
52 
55 public:
56  using detail::IntegerBase::IntegerBase;
57 
58  bool operator==(const UnsignedInteger& other) const { return width() == other.width(); }
59 
61  std::vector<Node> typeParameters() const;
62 
64  auto isEqual(const Type& other) const { return node::isEqual(this, other); }
65 };
66 
67 } // namespace type
68 } // namespace hilti
auto isEqual(const Type &other) const
Definition: integer.h:64
auto isWildcard() const
Definition: integer.h:26
auto isEqual(const Type &other) const
Definition: integer.h:50
Definition: meta.h:18
Definition: integer.h:54
Definition: type.h:159
Definition: integer.h:40
auto properties() const
Definition: integer.h:30
std::map< std::string, node::detail::PropertyValue > Properties
Definition: node.h:99
Definition: type.h:198
Definition: type.h:33
Definition: type.h:269
Definition: integer.h:17
auto _isResolved(ResolvedState *rstate) const
Definition: integer.h:28