Ben Clayton | 1737485 | 2021-04-30 19:58:49 +0000 | [diff] [blame] | 1 | // 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 | |
Ben Clayton | 8758f10 | 2021-06-09 14:32:14 +0000 | [diff] [blame] | 15 | #include "src/ast/type_decl.h" |
Ben Clayton | 1737485 | 2021-04-30 19:58:49 +0000 | [diff] [blame] | 16 | |
| 17 | #include "src/program_builder.h" |
| 18 | |
Ben Clayton | 8758f10 | 2021-06-09 14:32:14 +0000 | [diff] [blame] | 19 | TINT_INSTANTIATE_TYPEINFO(tint::ast::TypeDecl); |
Ben Clayton | 1737485 | 2021-04-30 19:58:49 +0000 | [diff] [blame] | 20 | |
| 21 | namespace tint { |
| 22 | namespace ast { |
| 23 | |
Ben Clayton | 8758f10 | 2021-06-09 14:32:14 +0000 | [diff] [blame] | 24 | TypeDecl::TypeDecl(ProgramID program_id, const Source& source, Symbol name) |
Ben Clayton | 1737485 | 2021-04-30 19:58:49 +0000 | [diff] [blame] | 25 | : Base(program_id, source), name_(name) { |
Ben Clayton | ffd28e2 | 2021-06-24 11:27:36 +0000 | [diff] [blame] | 26 | TINT_ASSERT_PROGRAM_IDS_EQUAL_IF_VALID(AST, name, program_id); |
Ben Clayton | 1737485 | 2021-04-30 19:58:49 +0000 | [diff] [blame] | 27 | } |
| 28 | |
Ben Clayton | 8758f10 | 2021-06-09 14:32:14 +0000 | [diff] [blame] | 29 | TypeDecl::TypeDecl(TypeDecl&&) = default; |
Ben Clayton | 1737485 | 2021-04-30 19:58:49 +0000 | [diff] [blame] | 30 | |
Ben Clayton | 8758f10 | 2021-06-09 14:32:14 +0000 | [diff] [blame] | 31 | TypeDecl::~TypeDecl() = default; |
Ben Clayton | 1737485 | 2021-04-30 19:58:49 +0000 | [diff] [blame] | 32 | |
Ben Clayton | 8758f10 | 2021-06-09 14:32:14 +0000 | [diff] [blame] | 33 | void TypeDecl::to_str(const sem::Info&, |
| 34 | std::ostream& out, |
| 35 | size_t indent) const { |
| 36 | make_indent(out, indent); |
| 37 | out << type_name(); |
Ben Clayton | 1737485 | 2021-04-30 19:58:49 +0000 | [diff] [blame] | 38 | } |
| 39 | |
| 40 | } // namespace ast |
| 41 | } // namespace tint |