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 15 #ifndef SRC_AST_TYPE_H_ 16 #define SRC_AST_TYPE_H_ 17 18 #include <string> 19 20 #include "src/ast/node.h" 21 #include "src/clone_context.h" 22 23 namespace tint { 24 25 // Forward declarations 26 class ProgramBuilder; 27 class SymbolTable; 28 29 namespace ast { 30 31 /// Base class for a type in the system 32 class Type : public Castable<Type, Node> { 33 public: 34 /// Move constructor 35 Type(Type&&); 36 ~Type() override; 37 38 /// @param symbols the program's symbol table 39 /// @returns the name for this type that closely resembles how it would be 40 /// declared in WGSL. 41 virtual std::string FriendlyName(const SymbolTable& symbols) const = 0; 42 43 protected: 44 /// Constructor 45 /// @param pid the identifier of the program that owns this node 46 /// @param src the source of this node 47 Type(ProgramID pid, const Source& src); 48 }; 49 50 } // namespace ast 51 } // namespace tint 52 53 #endif // SRC_AST_TYPE_H_ 54