2020-12-01 18:04:17 +00:00
|
|
|
// Copyright 2020 The Tint Authors.
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
// you may not use this file except in compliance with the License.
|
|
|
|
// You may obtain a copy of the License at
|
|
|
|
//
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
//
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
// limitations under the License.
|
|
|
|
|
2021-01-21 16:20:40 +00:00
|
|
|
#include "src/clone_context.h"
|
2020-12-01 18:04:17 +00:00
|
|
|
|
2021-01-26 16:57:10 +00:00
|
|
|
#include "src/program.h"
|
2020-12-15 12:32:18 +00:00
|
|
|
|
2020-12-01 18:04:17 +00:00
|
|
|
namespace tint {
|
|
|
|
|
2021-01-26 16:57:10 +00:00
|
|
|
CloneContext::CloneContext(Program* to, Program const* from)
|
2021-01-22 13:41:06 +00:00
|
|
|
: dst(to), src(from) {}
|
2020-12-01 18:04:17 +00:00
|
|
|
CloneContext::~CloneContext() = default;
|
|
|
|
|
2020-12-15 12:32:18 +00:00
|
|
|
Symbol CloneContext::Clone(const Symbol& s) const {
|
2021-01-22 13:41:06 +00:00
|
|
|
return dst->RegisterSymbol(src->SymbolToName(s));
|
2020-12-15 12:32:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CloneContext::Clone() {
|
|
|
|
src->Clone(this);
|
|
|
|
}
|
|
|
|
|
2020-12-01 18:04:17 +00:00
|
|
|
} // namespace tint
|