1/**
2 * Copyright (c) 2021 Huawei Device Co., Ltd.
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
16#include "tsPrivateIdentifier.h"
17
18#include <ir/astDump.h>
19
20namespace panda::es2panda::ir {
21
22void TSPrivateIdentifier::Iterate(const NodeTraverser &cb) const
23{
24    cb(key_);
25
26    if (value_) {
27        cb(value_);
28    }
29
30    if (typeAnnotation_) {
31        cb(typeAnnotation_);
32    }
33}
34
35void TSPrivateIdentifier::Dump(ir::AstDumper *dumper) const
36{
37    dumper->Add({{"type", "TSPrivateIdentifier"},
38                 {"key", key_},
39                 {"value", AstDumper::Optional(value_)},
40                 {"typeAnnotation", AstDumper::Optional(typeAnnotation_)}});
41}
42
43void TSPrivateIdentifier::Compile([[maybe_unused]] compiler::PandaGen *pg) const {}
44
45checker::Type *TSPrivateIdentifier::Check([[maybe_unused]] checker::Checker *checker) const
46{
47    return nullptr;
48}
49
50void TSPrivateIdentifier::UpdateSelf(const NodeUpdater &cb, [[maybe_unused]] binder::Binder *binder)
51{
52    key_ = std::get<ir::AstNode *>(cb(key_))->AsExpression();
53
54    if (value_) {
55        value_ = std::get<ir::AstNode *>(cb(value_))->AsExpression();
56    }
57
58    if (typeAnnotation_) {
59        typeAnnotation_ = std::get<ir::AstNode *>(cb(typeAnnotation_))->AsExpression();
60    }
61}
62
63}  // namespace panda::es2panda::ir
64