• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
21 namespace panda::es2panda::binder {
22 class LoopScope;
23 }  // namespace panda::es2panda::binder
24 
25 namespace panda::es2panda::compiler {
26 class PandaGen;
27 }  // namespace panda::es2panda::compiler
28 
29 namespace panda::es2panda::checker {
30 class Checker;
31 class Type;
32 }  // namespace panda::es2panda::checker
33 
34 namespace panda::es2panda::ir {
35 class LoopStatement : public Statement {
36 public:
Scope()37     binder::LoopScope *Scope() const
38     {
39         return scope_;
40     }
41 
Iterate(const NodeTraverser & cb)42     void Iterate([[maybe_unused]] const NodeTraverser &cb) const override
43     {
44         UNREACHABLE();
45     }
46 
Dump(AstDumper * dumper)47     void Dump([[maybe_unused]] AstDumper *dumper) const override
48     {
49         UNREACHABLE();
50     }
51 
Compile(compiler::PandaGen * pg)52     void Compile([[maybe_unused]] compiler::PandaGen *pg) const override
53     {
54         UNREACHABLE();
55     }
56 
Check(checker::Checker * checker)57     checker::Type *Check([[maybe_unused]] checker::Checker *checker) const override
58     {
59         UNREACHABLE();
60         return nullptr;
61     }
62 
63 protected:
LoopStatement(AstNodeType type,binder::LoopScope * scope)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