blob: 5f2a600b6c1355705300893a7f0715f30196b598 [file] [log] [blame]
Ben Claytondcdf66e2022-06-17 12:48:51 +00001// Copyright 2022 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#include "src/tint/ast/override.h"
16
Ben Clayton783b1692022-08-02 17:03:35 +000017#include <utility>
18
Ben Claytondcdf66e2022-06-17 12:48:51 +000019#include "src/tint/program_builder.h"
20
21TINT_INSTANTIATE_TYPEINFO(tint::ast::Override);
22
23namespace tint::ast {
24
25Override::Override(ProgramID pid,
Ben Clayton4a92a3c2022-07-18 20:50:02 +000026 NodeID nid,
Ben Claytondcdf66e2022-06-17 12:48:51 +000027 const Source& src,
28 const Symbol& sym,
29 const ast::Type* ty,
dan sinclair6e77b472022-10-20 13:38:28 +000030 const Expression* init,
Ben Clayton783b1692022-08-02 17:03:35 +000031 utils::VectorRef<const Attribute*> attrs)
dan sinclair6e77b472022-10-20 13:38:28 +000032 : Base(pid, nid, src, sym, ty, init, std::move(attrs)) {}
Ben Claytondcdf66e2022-06-17 12:48:51 +000033
34Override::Override(Override&&) = default;
35
36Override::~Override() = default;
37
Ben Claytone48ef8e2022-06-26 10:52:50 +000038const char* Override::Kind() const {
39 return "override";
40}
41
Ben Claytondcdf66e2022-06-17 12:48:51 +000042const Override* Override::Clone(CloneContext* ctx) const {
43 auto src = ctx->Clone(source);
44 auto sym = ctx->Clone(symbol);
45 auto* ty = ctx->Clone(type);
dan sinclair6e77b472022-10-20 13:38:28 +000046 auto* init = ctx->Clone(initializer);
Ben Claytondcdf66e2022-06-17 12:48:51 +000047 auto attrs = ctx->Clone(attributes);
dan sinclair6e77b472022-10-20 13:38:28 +000048 return ctx->dst->create<Override>(src, sym, ty, init, std::move(attrs));
Ben Claytondcdf66e2022-06-17 12:48:51 +000049}
50
Ben Claytondcdf66e2022-06-17 12:48:51 +000051} // namespace tint::ast