blob: 1765d533a59665fadfeff660f59d1345b43a94c7 [file] [log] [blame]
Dan Sinclair6e581892020-03-02 15:47:43 -05001// 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 Clayton30848b62021-11-09 09:35:00 +000015#ifndef SRC_AST_FLOAT_LITERAL_EXPRESSION_H_
16#define SRC_AST_FLOAT_LITERAL_EXPRESSION_H_
Dan Sinclair6e581892020-03-02 15:47:43 -050017
18#include <string>
19
Ben Clayton30848b62021-11-09 09:35:00 +000020#include "src/ast/literal_expression.h"
Dan Sinclair6e581892020-03-02 15:47:43 -050021
22namespace tint {
23namespace ast {
24
25/// A float literal
Ben Clayton5c9a80b2021-11-10 19:23:07 +000026class FloatLiteralExpression
27 : public Castable<FloatLiteralExpression, LiteralExpression> {
Dan Sinclair6e581892020-03-02 15:47:43 -050028 public:
29 /// Constructor
Ben Clayton4f3ff572021-10-15 17:33:10 +000030 /// @param pid the identifier of the program that owns this node
31 /// @param src the source of this node
Dan Sinclair6e581892020-03-02 15:47:43 -050032 /// @param value the float literals value
Ben Clayton5c9a80b2021-11-10 19:23:07 +000033 FloatLiteralExpression(ProgramID pid, const Source& src, float value);
34 ~FloatLiteralExpression() override;
Dan Sinclair6e581892020-03-02 15:47:43 -050035
Ben Claytoned2b9782020-12-01 18:04:17 +000036 /// Clones this node and all transitive child nodes using the `CloneContext`
37 /// `ctx`.
Ben Claytoned2b9782020-12-01 18:04:17 +000038 /// @param ctx the clone context
39 /// @return the newly cloned node
Ben Clayton5c9a80b2021-11-10 19:23:07 +000040 const FloatLiteralExpression* Clone(CloneContext* ctx) const override;
Ben Claytoned2b9782020-12-01 18:04:17 +000041
Ben Clayton4f3ff572021-10-15 17:33:10 +000042 /// The float literal value
Ben Clayton86481202021-10-19 18:38:54 +000043 const float value;
Dan Sinclair6e581892020-03-02 15:47:43 -050044};
45
46} // namespace ast
47} // namespace tint
48
Ben Clayton30848b62021-11-09 09:35:00 +000049#endif // SRC_AST_FLOAT_LITERAL_EXPRESSION_H_