blob: 7f59c378e9c2db0885666a6d16e1e8082d9458c6 [file] [log] [blame]
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001// Copyright 2021 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
15#ifndef SRC_TINT_AST_PHONY_EXPRESSION_H_
16#define SRC_TINT_AST_PHONY_EXPRESSION_H_
17
18#include "src/tint/ast/expression.h"
19
dan sinclair34323ac2022-04-07 18:39:35 +000020namespace tint::ast {
Ryan Harrisondbc13af2022-02-21 15:19:07 +000021
22/// Represents the `_` of a phony assignment `_ = <expr>`
23/// @see https://www.w3.org/TR/WGSL/#phony-assignment-section
Ben Clayton41f8d2a2022-03-07 18:37:46 +000024class PhonyExpression final : public Castable<PhonyExpression, Expression> {
dan sinclair41e4d9a2022-05-01 14:40:55 +000025 public:
26 /// Constructor
27 /// @param pid the identifier of the program that owns this node
Ben Clayton4a92a3c2022-07-18 20:50:02 +000028 /// @param nid the unique node identifier
dan sinclair41e4d9a2022-05-01 14:40:55 +000029 /// @param src the source of this node
Ben Clayton4a92a3c2022-07-18 20:50:02 +000030 PhonyExpression(ProgramID pid, NodeID nid, const Source& src);
Ben Clayton9a56b252023-03-15 14:09:40 +000031
32 /// Destructor
dan sinclair41e4d9a2022-05-01 14:40:55 +000033 ~PhonyExpression() override;
Ryan Harrisondbc13af2022-02-21 15:19:07 +000034
dan sinclair41e4d9a2022-05-01 14:40:55 +000035 /// Clones this node and all transitive child nodes using the `CloneContext`
36 /// `ctx`.
37 /// @param ctx the clone context
38 /// @return the newly cloned node
39 const PhonyExpression* Clone(CloneContext* ctx) const override;
Ryan Harrisondbc13af2022-02-21 15:19:07 +000040};
41
dan sinclair34323ac2022-04-07 18:39:35 +000042} // namespace tint::ast
Ryan Harrisondbc13af2022-02-21 15:19:07 +000043
44#endif // SRC_TINT_AST_PHONY_EXPRESSION_H_