Dan Sinclair | 6e58189 | 2020-03-02 15:47:43 -0500 | [diff] [blame] | 1 | // Copyright 2020 The Tint Authors. |
| 2 | // |
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | // you may not use this file except in compliance with the License. |
| 5 | // You may obtain a copy of the License at |
| 6 | // |
| 7 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | // |
| 9 | // Unless required by applicable law or agreed to in writing, software |
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
| 14 | |
Ben Clayton | 30848b6 | 2021-11-09 09:35:00 +0000 | [diff] [blame] | 15 | #ifndef SRC_AST_FLOAT_LITERAL_EXPRESSION_H_ |
| 16 | #define SRC_AST_FLOAT_LITERAL_EXPRESSION_H_ |
Dan Sinclair | 6e58189 | 2020-03-02 15:47:43 -0500 | [diff] [blame] | 17 | |
| 18 | #include <string> |
| 19 | |
Ben Clayton | 30848b6 | 2021-11-09 09:35:00 +0000 | [diff] [blame] | 20 | #include "src/ast/literal_expression.h" |
Dan Sinclair | 6e58189 | 2020-03-02 15:47:43 -0500 | [diff] [blame] | 21 | |
| 22 | namespace tint { |
| 23 | namespace ast { |
| 24 | |
| 25 | /// A float literal |
Ben Clayton | 5c9a80b | 2021-11-10 19:23:07 +0000 | [diff] [blame] | 26 | class FloatLiteralExpression |
| 27 | : public Castable<FloatLiteralExpression, LiteralExpression> { |
Dan Sinclair | 6e58189 | 2020-03-02 15:47:43 -0500 | [diff] [blame] | 28 | public: |
| 29 | /// Constructor |
Ben Clayton | 4f3ff57 | 2021-10-15 17:33:10 +0000 | [diff] [blame] | 30 | /// @param pid the identifier of the program that owns this node |
| 31 | /// @param src the source of this node |
Dan Sinclair | 6e58189 | 2020-03-02 15:47:43 -0500 | [diff] [blame] | 32 | /// @param value the float literals value |
Ben Clayton | 5c9a80b | 2021-11-10 19:23:07 +0000 | [diff] [blame] | 33 | FloatLiteralExpression(ProgramID pid, const Source& src, float value); |
| 34 | ~FloatLiteralExpression() override; |
Dan Sinclair | 6e58189 | 2020-03-02 15:47:43 -0500 | [diff] [blame] | 35 | |
Ben Clayton | ed2b978 | 2020-12-01 18:04:17 +0000 | [diff] [blame] | 36 | /// Clones this node and all transitive child nodes using the `CloneContext` |
| 37 | /// `ctx`. |
Ben Clayton | ed2b978 | 2020-12-01 18:04:17 +0000 | [diff] [blame] | 38 | /// @param ctx the clone context |
| 39 | /// @return the newly cloned node |
Ben Clayton | 5c9a80b | 2021-11-10 19:23:07 +0000 | [diff] [blame] | 40 | const FloatLiteralExpression* Clone(CloneContext* ctx) const override; |
Ben Clayton | ed2b978 | 2020-12-01 18:04:17 +0000 | [diff] [blame] | 41 | |
Ben Clayton | 4f3ff57 | 2021-10-15 17:33:10 +0000 | [diff] [blame] | 42 | /// The float literal value |
Ben Clayton | 8648120 | 2021-10-19 18:38:54 +0000 | [diff] [blame] | 43 | const float value; |
Dan Sinclair | 6e58189 | 2020-03-02 15:47:43 -0500 | [diff] [blame] | 44 | }; |
| 45 | |
| 46 | } // namespace ast |
| 47 | } // namespace tint |
| 48 | |
Ben Clayton | 30848b6 | 2021-11-09 09:35:00 +0000 | [diff] [blame] | 49 | #endif // SRC_AST_FLOAT_LITERAL_EXPRESSION_H_ |