mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-10 05:57:51 +00:00
Add tint::Cloneable base class
The CloneContext was previously dealing with pointers to CastableBase, which has no guarantees that the object was actually cloneable. Add a Cloneable base class that CloneContext can use instead. Improves readability and produces cleaner compiler errors if you try to clone a non-cloneable object. Change-Id: I4352fc5dab3da434e4ab160a54c4c82d50e427b4 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/41722 Commit-Queue: Ben Clayton <bclayton@google.com> Reviewed-by: dan sinclair <dsinclair@chromium.org>
This commit is contained in:
committed by
Commit Bot service account
parent
f81df124f6
commit
52296de528
@@ -19,7 +19,7 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "src/castable.h"
|
||||
#include "src/clone_context.h"
|
||||
#include "src/source.h"
|
||||
|
||||
namespace tint {
|
||||
@@ -36,16 +36,10 @@ class Info;
|
||||
namespace ast {
|
||||
|
||||
/// AST base class node
|
||||
class Node : public Castable<Node> {
|
||||
class Node : public Castable<Node, Cloneable> {
|
||||
public:
|
||||
~Node() override;
|
||||
|
||||
/// Clones this node and all transitive child nodes using the `CloneContext`
|
||||
/// `ctx`.
|
||||
/// @param ctx the clone context
|
||||
/// @return the newly cloned node
|
||||
virtual Node* Clone(CloneContext* ctx) const = 0;
|
||||
|
||||
/// @returns the node source data
|
||||
const Source& source() const { return source_; }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user