• 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 #include "ETSAnalyzer.h"
17 
18 namespace ark::es2panda::checker {
19 
20 // from as folder
Check(ir::NamedType * node) const21 checker::Type *ETSAnalyzer::Check([[maybe_unused]] ir::NamedType *node) const
22 {
23     ES2PANDA_UNREACHABLE();
24 }
25 
Check(ir::PrefixAssertionExpression * expr) const26 checker::Type *ETSAnalyzer::Check([[maybe_unused]] ir::PrefixAssertionExpression *expr) const
27 {
28     ES2PANDA_UNREACHABLE();
29 }
30 
Check(ir::Decorator * st) const31 checker::Type *ETSAnalyzer::Check([[maybe_unused]] ir::Decorator *st) const
32 {
33     ES2PANDA_UNREACHABLE();
34 }
35 
Check(ir::MetaProperty * expr) const36 checker::Type *ETSAnalyzer::Check([[maybe_unused]] ir::MetaProperty *expr) const
37 {
38     ES2PANDA_UNREACHABLE();
39 }
40 
Check(ir::ScriptFunction * node) const41 checker::Type *ETSAnalyzer::Check([[maybe_unused]] ir::ScriptFunction *node) const
42 {
43     ES2PANDA_UNREACHABLE();
44 }
45 
Check(ir::TSIndexSignature * node) const46 checker::Type *ETSAnalyzer::Check([[maybe_unused]] ir::TSIndexSignature *node) const
47 {
48     ES2PANDA_UNREACHABLE();
49 }
50 
Check(ir::TSMethodSignature * node) const51 checker::Type *ETSAnalyzer::Check([[maybe_unused]] ir::TSMethodSignature *node) const
52 {
53     ES2PANDA_UNREACHABLE();
54 }
55 
Check(ir::TSPropertySignature * node) const56 checker::Type *ETSAnalyzer::Check([[maybe_unused]] ir::TSPropertySignature *node) const
57 {
58     ES2PANDA_UNREACHABLE();
59 }
60 
Check(ir::TSSignatureDeclaration * node) const61 checker::Type *ETSAnalyzer::Check([[maybe_unused]] ir::TSSignatureDeclaration *node) const
62 {
63     ES2PANDA_UNREACHABLE();
64 }
65 // from ets folder
Check(ir::ETSModule * node) const66 checker::Type *ETSAnalyzer::Check([[maybe_unused]] ir::ETSModule *node) const
67 {
68     ES2PANDA_UNREACHABLE();
69 }
70 
Check(ir::ETSImportDeclaration * node) const71 checker::Type *ETSAnalyzer::Check([[maybe_unused]] ir::ETSImportDeclaration *node) const
72 {
73     ES2PANDA_UNREACHABLE();
74 }
75 
Check(ir::ETSTuple * node) const76 checker::Type *ETSAnalyzer::Check([[maybe_unused]] ir::ETSTuple *node) const
77 {
78     ES2PANDA_UNREACHABLE();
79 }
80 
Check(ir::ETSUnionType * node) const81 checker::Type *ETSAnalyzer::Check([[maybe_unused]] ir::ETSUnionType *node) const
82 {
83     ES2PANDA_UNREACHABLE();
84 }
85 
Check(ir::ETSWildcardType * node) const86 checker::Type *ETSAnalyzer::Check([[maybe_unused]] ir::ETSWildcardType *node) const
87 {
88     ES2PANDA_UNREACHABLE();
89 }
90 
Check(ir::ChainExpression * expr) const91 checker::Type *ETSAnalyzer::Check([[maybe_unused]] ir::ChainExpression *expr) const
92 {
93     ES2PANDA_UNREACHABLE();  // eliminated in OptionalLowering
94 }
95 
Check(ir::ClassExpression * expr) const96 checker::Type *ETSAnalyzer::Check([[maybe_unused]] ir::ClassExpression *expr) const
97 {
98     ES2PANDA_UNREACHABLE();
99 }
100 
Check(ir::ETSReExportDeclaration * expr) const101 checker::Type *ETSAnalyzer::Check([[maybe_unused]] ir::ETSReExportDeclaration *expr) const
102 {
103     ES2PANDA_UNREACHABLE();
104 }
105 
Check(ir::DirectEvalExpression * expr) const106 checker::Type *ETSAnalyzer::Check([[maybe_unused]] ir::DirectEvalExpression *expr) const
107 {
108     ES2PANDA_UNREACHABLE();
109 }
110 
Check(ir::FunctionExpression * expr) const111 checker::Type *ETSAnalyzer::Check([[maybe_unused]] ir::FunctionExpression *expr) const
112 {
113     ES2PANDA_UNREACHABLE();
114 }
115 
Check(ir::ImportExpression * expr) const116 checker::Type *ETSAnalyzer::Check([[maybe_unused]] ir::ImportExpression *expr) const
117 {
118     ES2PANDA_UNREACHABLE();
119 }
120 
Check(ir::NewExpression * expr) const121 checker::Type *ETSAnalyzer::Check([[maybe_unused]] ir::NewExpression *expr) const
122 {
123     ES2PANDA_UNREACHABLE();
124 }
125 
Check(ir::OmittedExpression * expr) const126 checker::Type *ETSAnalyzer::Check([[maybe_unused]] ir::OmittedExpression *expr) const
127 {
128     ES2PANDA_UNREACHABLE();
129 }
130 
Check(ir::TaggedTemplateExpression * expr) const131 checker::Type *ETSAnalyzer::Check([[maybe_unused]] ir::TaggedTemplateExpression *expr) const
132 {
133     ES2PANDA_UNREACHABLE();
134 }
135 
Check(ir::YieldExpression * expr) const136 checker::Type *ETSAnalyzer::Check([[maybe_unused]] ir::YieldExpression *expr) const
137 {
138     ES2PANDA_UNREACHABLE();
139 }
140 
Check(ir::RegExpLiteral * expr) const141 checker::Type *ETSAnalyzer::Check([[maybe_unused]] ir::RegExpLiteral *expr) const
142 {
143     ES2PANDA_UNREACHABLE();
144 }
145 
Check(ir::UndefinedLiteral * expr) const146 checker::Type *ETSAnalyzer::Check([[maybe_unused]] ir::UndefinedLiteral *expr) const
147 {
148     ES2PANDA_UNREACHABLE();
149 }
150 
151 // compile methods for MODULE-related nodes in alphabetical order
Check(ir::ExportAllDeclaration * st) const152 checker::Type *ETSAnalyzer::Check([[maybe_unused]] ir::ExportAllDeclaration *st) const
153 {
154     ES2PANDA_UNREACHABLE();
155 }
156 
Check(ir::ExportDefaultDeclaration * st) const157 checker::Type *ETSAnalyzer::Check([[maybe_unused]] ir::ExportDefaultDeclaration *st) const
158 {
159     ES2PANDA_UNREACHABLE();
160 }
161 
Check(ir::ExportNamedDeclaration * st) const162 checker::Type *ETSAnalyzer::Check([[maybe_unused]] ir::ExportNamedDeclaration *st) const
163 {
164     ES2PANDA_UNREACHABLE();
165 }
166 
Check(ir::ExportSpecifier * st) const167 checker::Type *ETSAnalyzer::Check([[maybe_unused]] ir::ExportSpecifier *st) const
168 {
169     ES2PANDA_UNREACHABLE();
170 }
171 
Check(ir::ImportDefaultSpecifier * st) const172 checker::Type *ETSAnalyzer::Check([[maybe_unused]] ir::ImportDefaultSpecifier *st) const
173 {
174     ES2PANDA_UNREACHABLE();
175 }
176 
Check(ir::ImportSpecifier * st) const177 checker::Type *ETSAnalyzer::Check([[maybe_unused]] ir::ImportSpecifier *st) const
178 {
179     ES2PANDA_UNREACHABLE();
180 }
181 
Check(ir::DebuggerStatement * st) const182 checker::Type *ETSAnalyzer::Check([[maybe_unused]] ir::DebuggerStatement *st) const
183 {
184     ES2PANDA_UNREACHABLE();
185 }
186 
Check(ir::ForInStatement * st) const187 checker::Type *ETSAnalyzer::Check(ir::ForInStatement *st) const
188 {
189     ES2PANDA_ASSERT(GetETSChecker()->IsAnyError());
190     return ReturnTypeForStatement(st);
191 }
192 
Check(ir::FunctionDeclaration * st) const193 checker::Type *ETSAnalyzer::Check([[maybe_unused]] ir::FunctionDeclaration *st) const
194 {
195     ES2PANDA_UNREACHABLE();
196 }
197 
Check(ir::SwitchCaseStatement * st) const198 checker::Type *ETSAnalyzer::Check([[maybe_unused]] ir::SwitchCaseStatement *st) const
199 {
200     ES2PANDA_UNREACHABLE();
201 }
202 
203 // from ts folder
Check(ir::TSAnyKeyword * node) const204 checker::Type *ETSAnalyzer::Check([[maybe_unused]] ir::TSAnyKeyword *node) const
205 {
206     ES2PANDA_UNREACHABLE();
207 }
208 
Check(ir::TSBigintKeyword * node) const209 checker::Type *ETSAnalyzer::Check([[maybe_unused]] ir::TSBigintKeyword *node) const
210 {
211     ES2PANDA_UNREACHABLE();
212 }
213 
Check(ir::TSBooleanKeyword * node) const214 checker::Type *ETSAnalyzer::Check([[maybe_unused]] ir::TSBooleanKeyword *node) const
215 {
216     ES2PANDA_UNREACHABLE();
217 }
218 
Check(ir::TSClassImplements * expr) const219 checker::Type *ETSAnalyzer::Check([[maybe_unused]] ir::TSClassImplements *expr) const
220 {
221     ES2PANDA_UNREACHABLE();
222 }
223 
Check(ir::TSConditionalType * node) const224 checker::Type *ETSAnalyzer::Check([[maybe_unused]] ir::TSConditionalType *node) const
225 {
226     ES2PANDA_UNREACHABLE();
227 }
228 
Check(ir::TSConstructorType * node) const229 checker::Type *ETSAnalyzer::Check([[maybe_unused]] ir::TSConstructorType *node) const
230 {
231     ES2PANDA_UNREACHABLE();
232 }
233 
Check(ir::TSEnumMember * st) const234 checker::Type *ETSAnalyzer::Check([[maybe_unused]] ir::TSEnumMember *st) const
235 {
236     ES2PANDA_UNREACHABLE();
237 }
238 
Check(ir::TSExternalModuleReference * expr) const239 checker::Type *ETSAnalyzer::Check([[maybe_unused]] ir::TSExternalModuleReference *expr) const
240 {
241     ES2PANDA_UNREACHABLE();
242 }
243 
Check(ir::TSFunctionType * node) const244 checker::Type *ETSAnalyzer::Check([[maybe_unused]] ir::TSFunctionType *node) const
245 {
246     ES2PANDA_UNREACHABLE();
247 }
248 
Check(ir::TSImportEqualsDeclaration * st) const249 checker::Type *ETSAnalyzer::Check([[maybe_unused]] ir::TSImportEqualsDeclaration *st) const
250 {
251     ES2PANDA_UNREACHABLE();
252 }
253 
Check(ir::TSImportType * node) const254 checker::Type *ETSAnalyzer::Check([[maybe_unused]] ir::TSImportType *node) const
255 {
256     ES2PANDA_UNREACHABLE();
257 }
258 
Check(ir::TSIndexedAccessType * node) const259 checker::Type *ETSAnalyzer::Check([[maybe_unused]] ir::TSIndexedAccessType *node) const
260 {
261     ES2PANDA_UNREACHABLE();
262 }
263 
Check(ir::TSInferType * node) const264 checker::Type *ETSAnalyzer::Check([[maybe_unused]] ir::TSInferType *node) const
265 {
266     ES2PANDA_UNREACHABLE();
267 }
268 
Check(ir::TSInterfaceBody * expr) const269 checker::Type *ETSAnalyzer::Check([[maybe_unused]] ir::TSInterfaceBody *expr) const
270 {
271     ES2PANDA_UNREACHABLE();
272 }
273 
Check(ir::TSInterfaceHeritage * expr) const274 checker::Type *ETSAnalyzer::Check([[maybe_unused]] ir::TSInterfaceHeritage *expr) const
275 {
276     ES2PANDA_UNREACHABLE();
277 }
278 
Check(ir::TSIntersectionType * node) const279 checker::Type *ETSAnalyzer::Check([[maybe_unused]] ir::TSIntersectionType *node) const
280 {
281     ES2PANDA_UNREACHABLE();
282 }
283 
Check(ir::TSLiteralType * node) const284 checker::Type *ETSAnalyzer::Check([[maybe_unused]] ir::TSLiteralType *node) const
285 {
286     ES2PANDA_UNREACHABLE();
287 }
288 
Check(ir::TSMappedType * node) const289 checker::Type *ETSAnalyzer::Check([[maybe_unused]] ir::TSMappedType *node) const
290 {
291     ES2PANDA_UNREACHABLE();
292 }
293 
Check(ir::TSModuleBlock * st) const294 checker::Type *ETSAnalyzer::Check([[maybe_unused]] ir::TSModuleBlock *st) const
295 {
296     ES2PANDA_UNREACHABLE();
297 }
298 
Check(ir::TSModuleDeclaration * st) const299 checker::Type *ETSAnalyzer::Check([[maybe_unused]] ir::TSModuleDeclaration *st) const
300 {
301     ES2PANDA_UNREACHABLE();
302 }
303 
Check(ir::TSNamedTupleMember * node) const304 checker::Type *ETSAnalyzer::Check([[maybe_unused]] ir::TSNamedTupleMember *node) const
305 {
306     ES2PANDA_UNREACHABLE();
307 }
308 
Check(ir::TSNeverKeyword * node) const309 checker::Type *ETSAnalyzer::Check([[maybe_unused]] ir::TSNeverKeyword *node) const
310 {
311     ES2PANDA_UNREACHABLE();
312 }
313 
Check(ir::TSNullKeyword * node) const314 checker::Type *ETSAnalyzer::Check([[maybe_unused]] ir::TSNullKeyword *node) const
315 {
316     ES2PANDA_UNREACHABLE();
317 }
318 
Check(ir::TSNumberKeyword * node) const319 checker::Type *ETSAnalyzer::Check([[maybe_unused]] ir::TSNumberKeyword *node) const
320 {
321     ES2PANDA_UNREACHABLE();
322 }
323 
Check(ir::TSObjectKeyword * node) const324 checker::Type *ETSAnalyzer::Check([[maybe_unused]] ir::TSObjectKeyword *node) const
325 {
326     ES2PANDA_UNREACHABLE();
327 }
328 
Check(ir::TSParameterProperty * expr) const329 checker::Type *ETSAnalyzer::Check([[maybe_unused]] ir::TSParameterProperty *expr) const
330 {
331     ES2PANDA_UNREACHABLE();
332 }
333 
Check(ir::TSParenthesizedType * node) const334 checker::Type *ETSAnalyzer::Check([[maybe_unused]] ir::TSParenthesizedType *node) const
335 {
336     ES2PANDA_UNREACHABLE();
337 }
338 
Check(ir::TSStringKeyword * node) const339 checker::Type *ETSAnalyzer::Check([[maybe_unused]] ir::TSStringKeyword *node) const
340 {
341     ES2PANDA_UNREACHABLE();
342 }
343 
Check(ir::TSThisType * node) const344 checker::Type *ETSAnalyzer::Check([[maybe_unused]] ir::TSThisType *node) const
345 {
346     ES2PANDA_ASSERT(GetETSChecker()->IsAnyError());
347     return GetChecker()->AsETSChecker()->InvalidateType(node);
348 }
349 
Check(ir::TSTupleType * node) const350 checker::Type *ETSAnalyzer::Check([[maybe_unused]] ir::TSTupleType *node) const
351 {
352     ES2PANDA_UNREACHABLE();
353 }
354 
Check(ir::TSTypeAssertion * expr) const355 checker::Type *ETSAnalyzer::Check([[maybe_unused]] ir::TSTypeAssertion *expr) const
356 {
357     ES2PANDA_UNREACHABLE();
358 }
359 
Check(ir::TSTypeLiteral * node) const360 checker::Type *ETSAnalyzer::Check([[maybe_unused]] ir::TSTypeLiteral *node) const
361 {
362     ES2PANDA_UNREACHABLE();
363 }
364 
Check(ir::TSTypeOperator * node) const365 checker::Type *ETSAnalyzer::Check([[maybe_unused]] ir::TSTypeOperator *node) const
366 {
367     ES2PANDA_UNREACHABLE();
368 }
369 
Check(ir::TSTypeParameter * expr) const370 checker::Type *ETSAnalyzer::Check([[maybe_unused]] ir::TSTypeParameter *expr) const
371 {
372     ES2PANDA_UNREACHABLE();
373 }
374 
Check(ir::TSTypeParameterDeclaration * expr) const375 checker::Type *ETSAnalyzer::Check([[maybe_unused]] ir::TSTypeParameterDeclaration *expr) const
376 {
377     ES2PANDA_UNREACHABLE();
378 }
379 
Check(ir::TSTypeParameterInstantiation * expr) const380 checker::Type *ETSAnalyzer::Check([[maybe_unused]] ir::TSTypeParameterInstantiation *expr) const
381 {
382     ES2PANDA_UNREACHABLE();
383 }
384 
Check(ir::TSTypePredicate * node) const385 checker::Type *ETSAnalyzer::Check([[maybe_unused]] ir::TSTypePredicate *node) const
386 {
387     ES2PANDA_UNREACHABLE();
388 }
389 
Check(ir::TSTypeQuery * node) const390 checker::Type *ETSAnalyzer::Check([[maybe_unused]] ir::TSTypeQuery *node) const
391 {
392     ES2PANDA_UNREACHABLE();
393 }
394 
Check(ir::TSTypeReference * node) const395 checker::Type *ETSAnalyzer::Check([[maybe_unused]] ir::TSTypeReference *node) const
396 {
397     ES2PANDA_UNREACHABLE();
398 }
399 
Check(ir::TSUndefinedKeyword * node) const400 checker::Type *ETSAnalyzer::Check([[maybe_unused]] ir::TSUndefinedKeyword *node) const
401 {
402     ES2PANDA_UNREACHABLE();
403 }
404 
Check(ir::TSUnionType * node) const405 checker::Type *ETSAnalyzer::Check([[maybe_unused]] ir::TSUnionType *node) const
406 {
407     ES2PANDA_UNREACHABLE();
408 }
409 
Check(ir::TSUnknownKeyword * node) const410 checker::Type *ETSAnalyzer::Check([[maybe_unused]] ir::TSUnknownKeyword *node) const
411 {
412     ES2PANDA_UNREACHABLE();
413 }
414 
Check(ir::TSVoidKeyword * node) const415 checker::Type *ETSAnalyzer::Check([[maybe_unused]] ir::TSVoidKeyword *node) const
416 {
417     ES2PANDA_UNREACHABLE();
418 }
419 
Check(ir::DummyNode * expr) const420 checker::Type *ETSAnalyzer::Check([[maybe_unused]] ir::DummyNode *expr) const
421 {
422     ES2PANDA_UNREACHABLE();
423 }
424 }  // namespace ark::es2panda::checker
425