AST FunctionType node.
| 98 | |
| 99 | /// AST FunctionType node. |
| 100 | class FunctionType { |
| 101 | public: |
| 102 | /// Constructors. |
| 103 | FunctionType() noexcept = default; |
| 104 | FunctionType(Span<const ValType> P, Span<const ValType> R) noexcept |
| 105 | : ParamTypes(P.begin(), P.end()), ReturnTypes(R.begin(), R.end()) {} |
| 106 | FunctionType(Span<const ValType> P, Span<const ValType> R, |
| 107 | Symbol<Executable::Wrapper> S) noexcept |
| 108 | : ParamTypes(P.begin(), P.end()), ReturnTypes(R.begin(), R.end()), |
| 109 | WrapSymbol(std::move(S)) {} |
| 110 | |
| 111 | /// `==` and `!=` operator overloadings. |
| 112 | friend bool operator==(const FunctionType &LHS, |
| 113 | const FunctionType &RHS) noexcept { |
| 114 | return LHS.ParamTypes == RHS.ParamTypes && |
| 115 | LHS.ReturnTypes == RHS.ReturnTypes; |
| 116 | } |
| 117 | |
| 118 | friend bool operator!=(const FunctionType &LHS, |
| 119 | const FunctionType &RHS) noexcept { |
| 120 | return !(LHS == RHS); |
| 121 | } |
| 122 | |
| 123 | /// Getter for param types. |
| 124 | const std::vector<ValType> &getParamTypes() const noexcept { |
| 125 | return ParamTypes; |
| 126 | } |
| 127 | std::vector<ValType> &getParamTypes() noexcept { return ParamTypes; } |
| 128 | |
| 129 | /// Getter for return types. |
| 130 | const std::vector<ValType> &getReturnTypes() const noexcept { |
| 131 | return ReturnTypes; |
| 132 | } |
| 133 | std::vector<ValType> &getReturnTypes() noexcept { return ReturnTypes; } |
| 134 | |
| 135 | /// Getter and setter for symbol. |
| 136 | const auto &getSymbol() const noexcept { return WrapSymbol; } |
| 137 | void setSymbol(Symbol<Executable::Wrapper> S) noexcept { |
| 138 | WrapSymbol = std::move(S); |
| 139 | } |
| 140 | |
| 141 | private: |
| 142 | /// \name Data of FunctionType. |
| 143 | /// @{ |
| 144 | std::vector<ValType> ParamTypes; |
| 145 | std::vector<ValType> ReturnTypes; |
| 146 | Symbol<Executable::Wrapper> WrapSymbol; |
| 147 | /// @} |
| 148 | }; |
| 149 | |
| 150 | /// AST FieldType node for GC proposal. |
| 151 | class FieldType { |
no outgoing calls