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#ifndef ES2PANDA_IR_STATEMENT_LOOPSTATEMENT_H
17#define ES2PANDA_IR_STATEMENT_LOOPSTATEMENT_H
18
19#include <ir/statement.h>
20
21namespace panda::es2panda::binder {
22class LoopScope;
23}  // namespace panda::es2panda::binder
24
25namespace panda::es2panda::compiler {
26class PandaGen;
27}  // namespace panda::es2panda::compiler
28
29namespace panda::es2panda::checker {
30class Checker;
31class Type;
32}  // namespace panda::es2panda::checker
33
34namespace panda::es2panda::ir {
35class LoopStatement : public Statement {
36public:
37    binder::LoopScope *Scope() const
38    {
39        return scope_;
40    }
41
42    void Iterate([[maybe_unused]] const NodeTraverser &cb) const override
43    {
44        UNREACHABLE();
45    }
46
47    void Dump([[maybe_unused]] AstDumper *dumper) const override
48    {
49        UNREACHABLE();
50    }
51
52    void Compile([[maybe_unused]] compiler::PandaGen *pg) const override
53    {
54        UNREACHABLE();
55    }
56
57    checker::Type *Check([[maybe_unused]] checker::Checker *checker) const override
58    {
59        UNREACHABLE();
60        return nullptr;
61    }
62
63protected:
64    explicit LoopStatement(AstNodeType type, binder::LoopScope *scope) : Statement(type), scope_(scope) {}
65
66    Statement *UpdateChildStatement(const NodeUpdater &cb, const binder::Binder *binder, Statement *statement) const;
67
68    binder::LoopScope *scope_;
69};
70}  // namespace panda::es2panda::ir
71
72#endif
73