• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**
2  * Copyright (c) 2025 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_COMPILER_LOWERING_CONVERT_MEMBEREXPRESSION_H
17 #define ES2PANDA_COMPILER_LOWERING_CONVERT_MEMBEREXPRESSION_H
18 
19 #include "compiler/lowering/phase.h"
20 
21 namespace ark::es2panda::compiler {
22 
23 // NOTE(mshimenkov): To be removed after delivering 'primitive types refactoring' patch
24 //
25 // The purpose of this phase is to convert all primitive type cast method calls into 'as' expressions
26 // Example:
27 // let d: double = 3.14
28 // let i: int = d.toInt()
29 //
30 // After phase:
31 // let d: double = 3.14
32 // let i: int = d as int
33 //
34 class ConvertPrimitiveCastMethodCall : public PhaseForDeclarations {
35 public:
36     std::string_view Name() const override;
37     bool PerformForModule(public_lib::Context *ctx, parser::Program *program) override;
38 };
39 
40 }  // namespace ark::es2panda::compiler
41 
42 #endif  // ES2PANDA_COMPILER_LOWERING_CONVERT_MEMBEREXPRESSION_H
43