AST cloning mechanism (#2699)

This is intended to be used for template instantiation, but for now takes no stance as to what it's cloning.

This is tested by parsing and cloning all of our test files, and checking that the result of converting each AST to proto is the same as the result of cloning and then converting each AST to proto.
This commit is contained in:
Richard Smith authored and GitHub committed 2023-03-21 12:36:05 -07:00
1 parent 18c350226f
commit 782bd87316
28 files changed
+1144 -118

No files matched your search

+4
View File
@@ -5,6 +5,7 @@
#include "explorer/ast/statement.h"
#include "common/check.h"
#include "explorer/ast/declaration.h"
#include "explorer/common/arena.h"
#include "llvm/Support/Casting.h"
@@ -170,4 +171,7 @@ auto AssignOperatorToString(AssignOperator op) -> std::string_view {
}
}
Return::Return(CloneContext& context, const Return& other)
: Statement(context, other), function_(context.Remap(other.function_)) {}
} // namespace Carbon