• Home
  • Raw
  • Download

Lines Matching +full:parserprogram +full:-

2  * Copyright (c) 2021 - 2024 Huawei Device Co., Ltd.
7 * http://www.apache.org/licenses/LICENSE-2.0
33 …auto *const paramIdent = checker->AllocNode<ir::Identifier>(name, typeAnnotation, checker->Allocat… in MakeFunctionParam()
34 auto *const param = checker->AllocNode<ir::ETSParameterExpression>(paramIdent, nullptr); in MakeFunctionParam()
42 …auto *const refIdent = checker->AllocNode<ir::Identifier>(paramExpr->Ident()->Name(), checker->All… in MakeParamRefIdent()
43 refIdent->SetVariable(paramExpr->Ident()->Variable()); in MakeParamRefIdent()
49 auto *const ident = checker->AllocNode<ir::Identifier>(name, checker->Allocator()); in MakeTypeReference()
50 auto *const referencePart = checker->AllocNode<ir::ETSTypeReferencePart>(ident); in MakeTypeReference()
51 return checker->AllocNode<ir::ETSTypeReference>(referencePart); in MakeTypeReference()
57 auto *const functionExpr = checker->AllocNode<ir::FunctionExpression>(function); in MakeMethodDef()
58 auto *const identClone = ident->Clone(checker->Allocator(), nullptr); in MakeMethodDef()
60 auto *const methodDef = checker->AllocNode<ir::MethodDefinition>( in MakeMethodDef()
61 …ir::MethodDefinitionKind::METHOD, identClone, functionExpr, function->Modifiers(), checker->Alloca… in MakeMethodDef()
62 methodDef->SetParent(enumClass); in MakeMethodDef()
63 enumClass->Body().push_back(methodDef); in MakeMethodDef()
74 if (functionInfo.enumDecl->IsDeclare()) { in MakeFunction()
77 … bodyBlock = checker_->AllocNode<ir::BlockStatement>(Allocator(), std::move(functionInfo.body)); in MakeFunction()
79 // clang-format off in MakeFunction()
80 auto *const function = checker_->AllocNode<ir::ScriptFunction>( in MakeFunction()
85 // clang-format on in MakeFunction()
93 util::UString className(util::StringView("#"), checker->Allocator()); in GetEnumClassName()
94 className.Append(enumDecl->Key()->Name()); in GetEnumClassName()
105 ArenaVector<ir::Expression *> elements(Allocator()->Adapter()); in MakeArray()
106 elements.reserve(enumDecl->Members().size()); in MakeArray()
107 for (const auto *const member : enumDecl->Members()) { in MakeArray()
108 elements.push_back(elementMaker(member->AsTSEnumMember())); in MakeArray()
110 …auto *const arrayExpr = checker_->AllocNode<ir::ArrayExpression>(std::move(elements), Allocator()); in MakeArray()
111 auto *const arrayIdent = checker_->AllocNode<ir::Identifier>(name, Allocator()); in MakeArray()
112 auto *const arrayClassProp = checker_->AllocNode<ir::ClassProperty>( in MakeArray()
115 arrayClassProp->SetParent(enumClass); in MakeArray()
116 enumClass->Body().push_back(arrayClassProp); in MakeArray()
124 …auto *const stringTypeAnnotation = MakeTypeReference(checker_, "String"); // NOTE String -> Built… in CreateEnumNamesArray()
125 auto *const arrayTypeAnnotation = checker_->AllocNode<ir::TSArrayType>(stringTypeAnnotation); in CreateEnumNamesArray()
127 // clang-format off in CreateEnumNamesArray()
131 … checker_->AllocNode<ir::StringLiteral>(member->Key()->AsIdentifier()->Name()); in CreateEnumNamesArray()
134 // clang-format on in CreateEnumNamesArray()
139 …auto *ident = Allocator()->New<ir::Identifier>(GetEnumClassName(checker_, enumDecl).View(), Alloca… in CreateClass()
141 … bool localDeclaration = (enumDecl->Parent() != nullptr && enumDecl->Parent()->IsBlockStatement()); in CreateClass()
142 auto *classDef = checker_->AllocNode<ir::ClassDefinition>( in CreateClass()
146 …enumDecl->IsDeclare() ? ir::ModifierFlags::DECLARE : ir::ModifierFlags::NONE, Language(Language::I… in CreateClass()
148 auto *classDecl = checker_->AllocNode<ir::ClassDeclaration>(classDef, Allocator()); in CreateClass()
151 enumDecl->Parent()->AsBlockStatement()->Statements().push_back(classDecl); in CreateClass()
152 classDecl->SetParent(enumDecl->Parent()); in CreateClass()
154 program_->Ast()->Statements().push_back(classDecl); in CreateClass()
155 classDecl->SetParent(program_->Ast()); in CreateClass()
158 classDef->SetOrigEnumDecl(enumDecl); in CreateClass()
159 enumDecl->SetBoxedClass(classDef); in CreateClass()
162 if (!enumDecl->IsDeclare()) { in CreateClass()
172 ArenaVector<ir::Expression *> params(Allocator()->Adapter()); in CreateCCtorForEnumClass()
173 auto *id = checker_->AllocNode<ir::Identifier>(compiler::Signatures::CCTOR, Allocator()); in CreateCCtorForEnumClass()
175 ArenaVector<ir::Statement *> statements(Allocator()->Adapter()); in CreateCCtorForEnumClass()
177 auto *body = checker_->AllocNode<ir::BlockStatement>(Allocator(), std::move(statements)); in CreateCCtorForEnumClass()
178 auto *func = checker_->AllocNode<ir::ScriptFunction>( in CreateCCtorForEnumClass()
184 func->SetIdent(id); in CreateCCtorForEnumClass()
185 id->SetParent(func); in CreateCCtorForEnumClass()
187 auto *funcExpr = checker_->AllocNode<ir::FunctionExpression>(func); in CreateCCtorForEnumClass()
189 auto *const identClone = id->Clone(Allocator(), nullptr); in CreateCCtorForEnumClass()
190 auto *const methodDef = checker_->AllocNode<ir::MethodDefinition>( in CreateCCtorForEnumClass()
193 methodDef->SetParent(enumClass); in CreateCCtorForEnumClass()
194 enumClass->Body().push_back(methodDef); in CreateCCtorForEnumClass()
199 auto *const fieldIdent = Allocator()->New<ir::Identifier>("ordinal", Allocator()); in CreateOrdinalField()
200 auto *const intTypeAnnotation = Allocator()->New<ir::ETSPrimitiveType>(ir::PrimitiveType::INT); in CreateOrdinalField()
201 auto *field = checker_->AllocNode<ir::ClassProperty>(fieldIdent, nullptr, intTypeAnnotation, in CreateOrdinalField()
204 enumClass->Body().push_back(field); in CreateOrdinalField()
205 field->SetParent(enumClass); in CreateOrdinalField()
211 ArenaVector<ir::Expression *> params(Allocator()->Adapter()); in CreateFunctionForCtorOfEnumClass()
213 … auto *const intTypeAnnotation = checker_->AllocNode<ir::ETSPrimitiveType>(ir::PrimitiveType::INT); in CreateFunctionForCtorOfEnumClass()
217 auto *id = checker_->AllocNode<ir::Identifier>("constructor", Allocator()); in CreateFunctionForCtorOfEnumClass()
218 ArenaVector<ir::Statement *> statements(Allocator()->Adapter()); in CreateFunctionForCtorOfEnumClass()
220 auto *body = checker_->AllocNode<ir::BlockStatement>(Allocator(), std::move(statements)); in CreateFunctionForCtorOfEnumClass()
223 …scriptFlags |= enumClass->IsDeclare() ? ir::ScriptFunctionFlags::EXTERNAL : ir::ScriptFunctionFlag… in CreateFunctionForCtorOfEnumClass()
225 auto *func = checker_->AllocNode<ir::ScriptFunction>( in CreateFunctionForCtorOfEnumClass()
228 … scriptFlags, // CC-OFF(G.FMT.02) project code style in CreateFunctionForCtorOfEnumClass()
229 … ir::ModifierFlags::CONSTRUCTOR, // CC-OFF(G.FMT.02) project code style in CreateFunctionForCtorOfEnumClass()
230 … Language(Language::Id::ETS)}); // CC-OFF(G.FMT.02) project code style in CreateFunctionForCtorOfEnumClass()
232 func->SetIdent(id); in CreateFunctionForCtorOfEnumClass()
234 auto *thisExpr = Allocator()->New<ir::ThisExpression>(); in CreateFunctionForCtorOfEnumClass()
235 auto *fieldIdentifier = Allocator()->New<ir::Identifier>("ordinal", Allocator()); in CreateFunctionForCtorOfEnumClass()
236 auto *leftHandSide = checker_->AllocNode<ir::MemberExpression>( in CreateFunctionForCtorOfEnumClass()
238 auto *rightHandSide = checker_->AllocNode<ir::Identifier>("ordinal", Allocator()); in CreateFunctionForCtorOfEnumClass()
239 rightHandSide->SetVariable(inputOrdinalParam->Ident()->Variable()); in CreateFunctionForCtorOfEnumClass()
240 auto *initializer = checker_->AllocNode<ir::AssignmentExpression>(leftHandSide, rightHandSide, in CreateFunctionForCtorOfEnumClass()
242 auto initStatement = checker_->AllocNode<ir::ExpressionStatement>(initializer); in CreateFunctionForCtorOfEnumClass()
243 initStatement->SetParent(body); in CreateFunctionForCtorOfEnumClass()
244 body->Statements().push_back(initStatement); in CreateFunctionForCtorOfEnumClass()
252 auto *funcExpr = checker_->AllocNode<ir::FunctionExpression>(func); in CreateCtorForEnumClass()
254 auto *const identClone = func->Id()->Clone(Allocator(), nullptr); in CreateCtorForEnumClass()
255 auto *const methodDef = checker_->AllocNode<ir::MethodDefinition>( in CreateCtorForEnumClass()
257 methodDef->SetParent(enumClass); in CreateCtorForEnumClass()
258 enumClass->Body().push_back(methodDef); in CreateCtorForEnumClass()
264 auto *const enumClass = enumClassDecl->Definition(); in CreateEnumIntClassFromEnumDeclaration()
283 enumDecl->Key()->Name()); in CreateEnumIntClassFromEnumDeclaration()
290 if (enumDecl->Parent() != nullptr && enumDecl->Parent()->IsBlockStatement()) { in CreateEnumIntClassFromEnumDeclaration()
291 …x = varbinder::LexicalScope<varbinder::Scope>::Enter(varbinder_, NearestScope(enumDecl->Parent())); in CreateEnumIntClassFromEnumDeclaration()
294 …auto localCtx = varbinder::LexicalScope<varbinder::Scope>::Enter(varbinder_, program_->GlobalScope… in CreateEnumIntClassFromEnumDeclaration()
296 auto *ident = enumClass->Ident(); in CreateEnumIntClassFromEnumDeclaration()
297 …auto *var = varbinder_->GetScope()->FindLocal(ident->Name(), varbinder::ResolveBindingOptions::BIN… in CreateEnumIntClassFromEnumDeclaration()
298 ident->SetVariable(var); in CreateEnumIntClassFromEnumDeclaration()
305 auto *const enumClass = enumClassDecl->Definition(); in CreateEnumStringClassFromEnumDeclaration()
321 enumDecl->Key()->Name()); in CreateEnumStringClassFromEnumDeclaration()
328 if (enumDecl->Parent() != nullptr && enumDecl->Parent()->IsBlockStatement()) { in CreateEnumStringClassFromEnumDeclaration()
329 …x = varbinder::LexicalScope<varbinder::Scope>::Enter(varbinder_, NearestScope(enumDecl->Parent())); in CreateEnumStringClassFromEnumDeclaration()
332 …auto localCtx = varbinder::LexicalScope<varbinder::Scope>::Enter(varbinder_, program_->GlobalScope… in CreateEnumStringClassFromEnumDeclaration()
334 auto *ident = enumClass->Ident(); in CreateEnumStringClassFromEnumDeclaration()
335 …auto *var = varbinder_->GetScope()->FindLocal(ident->Name(), varbinder::ResolveBindingOptions::BIN… in CreateEnumStringClassFromEnumDeclaration()
336 ident->SetVariable(var); in CreateEnumStringClassFromEnumDeclaration()
343 if (program->Extension() != ScriptExtension::ETS) { in Perform()
347 for (auto &[_, extPrograms] : program->ExternalSources()) { in Perform()
354 checker_ = ctx->checker->AsETSChecker(); in Perform()
355 varbinder_ = ctx->parserProgram->VarBinder()->AsETSBinder(); in Perform()
357 program->Ast()->IterateRecursively([this, &isPerformedSuccess](ir::AstNode *ast) -> void { in Perform()
358 if (ast->IsTSEnumDeclaration()) { in Perform()
359 auto *enumDecl = ast->AsTSEnumDeclaration(); in Perform()
361 if (auto *const itemInit = enumDecl->Members().front()->AsTSEnumMember()->Init(); in Perform()
362 itemInit->IsNumberLiteral()) { in Perform()
364 } else if (itemInit->IsStringLiteral()) { in Perform()
367 checker_->LogTypeError("Invalid enumeration value type.", enumDecl->Start()); in Perform()
378 auto *const intType = checker_->AllocNode<ir::ETSPrimitiveType>(ir::PrimitiveType::INT); in CreateEnumValuesArray()
379 auto *const arrayTypeAnnotation = checker_->AllocNode<ir::TSArrayType>(intType); in CreateEnumValuesArray()
380 // clang-format off in CreateEnumValuesArray()
383 auto *const enumValueLiteral = checker_->AllocNode<ir::NumberLiteral>( in CreateEnumValuesArray()
384 lexer::Number(member->AsTSEnumMember() in CreateEnumValuesArray()
385 ->Init() in CreateEnumValuesArray()
386 ->AsNumberLiteral() in CreateEnumValuesArray()
387 ->Number() in CreateEnumValuesArray()
391 // clang-format on in CreateEnumValuesArray()
397 …auto *const stringTypeAnnotation = MakeTypeReference(checker_, "String"); // NOTE String -> Built… in CreateEnumStringValuesArray()
398 auto *const arrayTypeAnnotation = checker_->AllocNode<ir::TSArrayType>(stringTypeAnnotation); in CreateEnumStringValuesArray()
400 // clang-format off in CreateEnumStringValuesArray()
403 auto *const init = member->AsTSEnumMember()->Init(); in CreateEnumStringValuesArray()
406 if (init->IsStringLiteral()) { in CreateEnumStringValuesArray()
407 stringValue = init->AsStringLiteral()->Str(); in CreateEnumStringValuesArray()
410 … init->AsNumberLiteral()->Number().GetValue<checker::ETSIntEnumType::ValueType>()); in CreateEnumStringValuesArray()
414 … auto *const enumValueStringLiteral = checker_->AllocNode<ir::StringLiteral>(stringValue); in CreateEnumStringValuesArray()
417 // clang-format on in CreateEnumStringValuesArray()
423 auto *const enumTypeAnnotation = MakeTypeReference(checker_, enumDecl->Key()->Name()); in CreateEnumItemsArray()
424 auto *const arrayTypeAnnotation = checker_->AllocNode<ir::TSArrayType>(enumTypeAnnotation); in CreateEnumItemsArray()
425 // clang-format off in CreateEnumItemsArray()
429 … checker_->AllocNode<ir::Identifier>(enumDecl->Key()->Name(), Allocator()); in CreateEnumItemsArray()
431 auto *const enumMemberIdent = checker_->AllocNode<ir::Identifier>( in CreateEnumItemsArray()
432 member->AsTSEnumMember()->Key()->AsIdentifier()->Name(), Allocator()); in CreateEnumItemsArray()
433 auto *const enumMemberExpr = checker_->AllocNode<ir::MemberExpression>( in CreateEnumItemsArray()
437 // clang-format on in CreateEnumItemsArray()
445 auto *const arrayTypeAnnotation = checker_->AllocNode<ir::TSArrayType>(enumTypeAnnotation); in CreateBoxedEnumItemsArray()
446 // clang-format off in CreateBoxedEnumItemsArray()
450 … checker_->AllocNode<ir::Identifier>(enumDecl->Key()->Name(), Allocator()); in CreateBoxedEnumItemsArray()
452 auto *const enumMemberIdent = checker_->AllocNode<ir::Identifier>( in CreateBoxedEnumItemsArray()
453 member->AsTSEnumMember()->Key()->AsIdentifier()->Name(), Allocator()); in CreateBoxedEnumItemsArray()
454 auto *const enumMemberExpr = checker_->AllocNode<ir::MemberExpression>( in CreateBoxedEnumItemsArray()
457 … auto intType = checker_->AllocNode<ir::ETSPrimitiveType>(ir::PrimitiveType::INT); in CreateBoxedEnumItemsArray()
458 … auto asExpression = checker_->AllocNode<ir::TSAsExpression>(enumMemberExpr, intType, false); in CreateBoxedEnumItemsArray()
460 ArenaVector<ir::Expression *> newExprArgs(Allocator()->Adapter()); in CreateBoxedEnumItemsArray()
465 … auto *const newExpression = checker_->AllocNode<ir::ETSNewClassInstanceExpression>( in CreateBoxedEnumItemsArray()
469 // clang-format on in CreateBoxedEnumItemsArray()
478 … auto *const enumClassIdentifierClone = enumClassIdentifier->Clone(checker->Allocator(), nullptr); in CreateStaticAccessMemberExpression()
479 auto *const arrayIdentifierClone = arrayIdentifier->Clone(checker->Allocator(), nullptr); in CreateStaticAccessMemberExpression()
481 return checker->AllocNode<ir::MemberExpression>(enumClassIdentifierClone, arrayIdentifierClone, in CreateStaticAccessMemberExpression()
489 auto *const lengthIdent = checker->AllocNode<ir::Identifier>("length", checker->Allocator()); in CreateIfTest()
492 auto *const valuesArrayLengthExpr = checker->AllocNode<ir::MemberExpression>( in CreateIfTest()
495 … auto *const expr = checker->AllocNode<ir::BinaryExpression>(paramRefIdent, valuesArrayLengthExpr, in CreateIfTest()
497 paramRefIdent->SetParent(expr); in CreateIfTest()
507 auto *const arrayAccessExpr = checker->AllocNode<ir::MemberExpression>( in CreateReturnEnumStatement()
509 auto *const returnStatement = checker->AllocNode<ir::ReturnStatement>(arrayAccessExpr); in CreateReturnEnumStatement()
517 auto *const message = checker->AllocNode<ir::StringLiteral>(messageString.View()); in CreateThrowStatement()
519 …checker->AllocNode<ir::BinaryExpression>(message, paramRefIdent, lexer::TokenType::PUNCTUATOR_PLUS… in CreateThrowStatement()
521 paramRefIdent->SetParent(newExprArg); in CreateThrowStatement()
522 ArenaVector<ir::Expression *> newExprArgs(checker->Allocator()->Adapter()); in CreateThrowStatement()
527 …checker->AllocNode<ir::ETSNewClassInstanceExpression>(exceptionReference, std::move(newExprArgs), … in CreateThrowStatement()
528 return checker->AllocNode<ir::ThrowStatement>(newExpr); in CreateThrowStatement()
536 auto intType = checker->AllocNode<ir::ETSPrimitiveType>(ir::PrimitiveType::INT); in CreateReturnWitAsStatement()
537 auto asExpression = checker->AllocNode<ir::TSAsExpression>(paramRefIdent, intType, false); in CreateReturnWitAsStatement()
538 paramRefIdent->SetParent(asExpression); in CreateReturnWitAsStatement()
542 auto *const arrayAccessExpr = checker->AllocNode<ir::MemberExpression>( in CreateReturnWitAsStatement()
545 return checker->AllocNode<ir::ReturnStatement>(arrayAccessExpr); in CreateReturnWitAsStatement()
555 … auto *const intTypeAnnotation = checker_->AllocNode<ir::ETSPrimitiveType>(ir::PrimitiveType::INT); in CreateEnumFromIntMethod()
557 …auto *const inArraySizeExpr = CreateIfTest(checker_, enumClass->Ident(), arrayIdent, inputOrdinalP… in CreateEnumFromIntMethod()
559 CreateReturnEnumStatement(checker_, enumClass->Ident(), arrayIdent, inputOrdinalParameter); in CreateEnumFromIntMethod()
560 …auto *const ifOrdinalExistsStmt = checker_->AllocNode<ir::IfStatement>(inArraySizeExpr, returnEnum… in CreateEnumFromIntMethod()
563 .Append(enumDecl->Key()->Name()) in CreateEnumFromIntMethod()
568 ArenaVector<ir::Expression *> params(Allocator()->Adapter()); in CreateEnumFromIntMethod()
571 ArenaVector<ir::Statement *> body(Allocator()->Adapter()); in CreateEnumFromIntMethod()
578 function->AddFlag(ir::ScriptFunctionFlags::THROWS); in CreateEnumFromIntMethod()
579 auto *const ident = checker_->AllocNode<ir::Identifier>(methodName, Allocator()); in CreateEnumFromIntMethod()
581 function->SetIdent(ident); in CreateEnumFromIntMethod()
590 auto *const enumTypeAnnotation = MakeTypeReference(checker_, enumDecl->Key()->Name()); in CreateEnumToStringMethod()
593 … CreateReturnWitAsStatement(checker_, enumClass->Ident(), stringValuesArrayIdent, inputEnumIdent); in CreateEnumToStringMethod()
595 ArenaVector<ir::Statement *> body(Allocator()->Adapter()); in CreateEnumToStringMethod()
598 ArenaVector<ir::Expression *> params(Allocator()->Adapter()); in CreateEnumToStringMethod()
600 …auto *const stringTypeAnnotation = MakeTypeReference(checker_, "String"); // NOTE String -> Built… in CreateEnumToStringMethod()
605 … checker_->AllocNode<ir::Identifier>(checker::ETSEnumType::TO_STRING_METHOD_NAME, Allocator()); in CreateEnumToStringMethod()
607 function->SetIdent(functionIdent); in CreateEnumToStringMethod()
615 auto *const enumTypeAnnotation = MakeTypeReference(checker_, enumDecl->Key()->Name()); in CreateEnumValueOfMethod()
617 …auto *const returnStmt = CreateReturnWitAsStatement(checker_, enumClass->Ident(), valuesArrayIdent… in CreateEnumValueOfMethod()
619 ArenaVector<ir::Statement *> body(Allocator()->Adapter()); in CreateEnumValueOfMethod()
622 ArenaVector<ir::Expression *> params(Allocator()->Adapter()); in CreateEnumValueOfMethod()
624 … auto *const intTypeAnnotation = checker_->AllocNode<ir::ETSPrimitiveType>(ir::PrimitiveType::INT); in CreateEnumValueOfMethod()
628 … checker_->AllocNode<ir::Identifier>(checker::ETSEnumType::VALUE_OF_METHOD_NAME, Allocator()); in CreateEnumValueOfMethod()
629 function->SetIdent(functionIdent); in CreateEnumValueOfMethod()
638 auto *const enumTypeAnnotation = MakeTypeReference(checker_, enumDecl->Key()->Name()); in CreateEnumGetNameMethod()
640 …auto *const returnStmt = CreateReturnWitAsStatement(checker_, enumClass->Ident(), namesArrayIdent,… in CreateEnumGetNameMethod()
642 ArenaVector<ir::Statement *> body(Allocator()->Adapter()); in CreateEnumGetNameMethod()
645 ArenaVector<ir::Expression *> params(Allocator()->Adapter()); in CreateEnumGetNameMethod()
647 …auto *const stringTypeAnnotation = MakeTypeReference(checker_, "String"); // NOTE String -> Built… in CreateEnumGetNameMethod()
652 … checker_->AllocNode<ir::Identifier>(checker::ETSEnumType::GET_NAME_METHOD_NAME, Allocator()); in CreateEnumGetNameMethod()
654 function->SetIdent(functionIdent); in CreateEnumGetNameMethod()
664 auto *const init = checker->AllocNode<ir::NumberLiteral>("0"); in CreateForLoopInitVariableDeclaration()
666 … checker->AllocNode<ir::VariableDeclarator>(ir::VariableDeclaratorFlag::LET, loopIdentifier, init); in CreateForLoopInitVariableDeclaration()
667 loopIdentifier->SetParent(decl); in CreateForLoopInitVariableDeclaration()
668 ArenaVector<ir::VariableDeclarator *> decls(checker->Allocator()->Adapter()); in CreateForLoopInitVariableDeclaration()
670 auto *const declaration = checker->AllocNode<ir::VariableDeclaration>( in CreateForLoopInitVariableDeclaration()
671 … ir::VariableDeclaration::VariableDeclarationKind::LET, checker->Allocator(), std::move(decls)); in CreateForLoopInitVariableDeclaration()
672 decl->SetParent(declaration); in CreateForLoopInitVariableDeclaration()
680 auto *const lengthIdent = checker->AllocNode<ir::Identifier>("length", checker->Allocator()); in CreateForLoopTest()
683 auto *const arrayLengthExpr = checker->AllocNode<ir::MemberExpression>( in CreateForLoopTest()
685 auto *const forLoopIdentClone = loopIdentifier->Clone(checker->Allocator(), nullptr); in CreateForLoopTest()
686 …auto *const binaryExpr = checker->AllocNode<ir::BinaryExpression>(forLoopIdentClone, arrayLengthEx… in CreateForLoopTest()
693 auto *const forLoopIdentClone = loopIdentifier->Clone(checker->Allocator(), nullptr); in CreateForLoopUpdate()
695 …checker->AllocNode<ir::UpdateExpression>(forLoopIdentClone, lexer::TokenType::PUNCTUATOR_PLUS_PLUS… in CreateForLoopUpdate()
703 auto *const forLoopIdentClone1 = loopIdentifier->Clone(checker->Allocator(), nullptr); in CreateIf()
704 auto *const namesArrayElementExpr = checker->AllocNode<ir::MemberExpression>( in CreateIf()
708 …auto *const namesEqualExpr = checker->AllocNode<ir::BinaryExpression>(paramRefIdent, namesArrayEle… in CreateIf()
710 paramRefIdent->SetParent(namesEqualExpr); in CreateIf()
711 auto *const forLoopIdentClone2 = loopIdentifier->Clone(checker->Allocator(), nullptr); in CreateIf()
712 auto *const enumTypeAnnotation = MakeTypeReference(checker, enumDecl->Key()->Name()); in CreateIf()
713 …auto asExpression = checker->AllocNode<ir::TSAsExpression>(forLoopIdentClone2, enumTypeAnnotation,… in CreateIf()
715 auto *const returnStmt = checker->AllocNode<ir::ReturnStatement>(asExpression); in CreateIf()
716 return checker->AllocNode<ir::IfStatement>(namesEqualExpr, returnStmt, nullptr); in CreateIf()
725 auto *const forLoopIIdent = checker_->AllocNode<ir::Identifier>("i", checker_->Allocator()); in CreateEnumGetValueOfMethod()
727 …auto *const forLoopTest = CreateForLoopTest(checker_, enumClass->Ident(), namesArrayIdent, forLoop… in CreateEnumGetValueOfMethod()
729 …auto *const stringTypeAnnotation = MakeTypeReference(checker_, "String"); // NOTE String -> Built… in CreateEnumGetValueOfMethod()
732 …CreateIf(checker_, enumDecl, CreateStaticAccessMemberExpression(checker_, enumClass->Ident(), name… in CreateEnumGetValueOfMethod()
736 …checker_->AllocNode<ir::ForUpdateStatement>(forLoopInitVarDecl, forLoopTest, forLoopUpdate, ifStmt… in CreateEnumGetValueOfMethod()
739 messageString.Append(enumDecl->Key()->Name()); in CreateEnumGetValueOfMethod()
744 ArenaVector<ir::Statement *> body(Allocator()->Adapter()); in CreateEnumGetValueOfMethod()
748 ArenaVector<ir::Expression *> params(Allocator()->Adapter()); in CreateEnumGetValueOfMethod()
750 auto *const enumTypeAnnotation = MakeTypeReference(checker_, enumDecl->Key()->Name()); in CreateEnumGetValueOfMethod()
754 function->AddFlag(ir::ScriptFunctionFlags::THROWS); in CreateEnumGetValueOfMethod()
756 … checker_->AllocNode<ir::Identifier>(checker::ETSEnumType::GET_VALUE_OF_METHOD_NAME, Allocator()); in CreateEnumGetValueOfMethod()
758 function->SetIdent(functionIdent); in CreateEnumGetValueOfMethod()
766 …auto *const propertyAccessExpr = CreateStaticAccessMemberExpression(checker_, enumClass->Ident(), … in CreateEnumValuesMethod()
767 auto *const returnStmt = checker_->AllocNode<ir::ReturnStatement>(propertyAccessExpr); in CreateEnumValuesMethod()
768 ArenaVector<ir::Statement *> body(Allocator()->Adapter()); in CreateEnumValuesMethod()
771 ArenaVector<ir::Expression *> params(Allocator()->Adapter()); in CreateEnumValuesMethod()
773 checker_->AllocNode<ir::TSArrayType>(MakeTypeReference(checker_, enumDecl->Key()->Name())); in CreateEnumValuesMethod()
778 checker_->AllocNode<ir::Identifier>(checker::ETSEnumType::VALUES_METHOD_NAME, Allocator()); in CreateEnumValuesMethod()
779 function->SetIdent(functionIdent); in CreateEnumValuesMethod()
789 ArenaVector<ir::Statement *> body(Allocator()->Adapter()); in CreateUnboxingMethod()
791 auto *thisExpr = Allocator()->New<ir::ThisExpression>(); in CreateUnboxingMethod()
792 auto *fieldIdentifier = Allocator()->New<ir::Identifier>("ordinal", Allocator()); in CreateUnboxingMethod()
793 auto *arrayIndexExpr = checker_->AllocNode<ir::MemberExpression>( in CreateUnboxingMethod()
796 …auto *const propertyAccessExpr = CreateStaticAccessMemberExpression(checker_, enumClass->Ident(), … in CreateUnboxingMethod()
797 auto *const arrayAccessExpr = checker_->AllocNode<ir::MemberExpression>( in CreateUnboxingMethod()
800 auto *const returnStmt = checker_->AllocNode<ir::ReturnStatement>(arrayAccessExpr); in CreateUnboxingMethod()
803 ArenaVector<ir::Expression *> params(Allocator()->Adapter()); in CreateUnboxingMethod()
805 auto *const returnTypeAnnotation = MakeTypeReference(checker_, enumDecl->Key()->Name()); in CreateUnboxingMethod()
811 checker_->AllocNode<ir::Identifier>(checker::ETSEnumType::UNBOX_METHOD_NAME, Allocator()); in CreateUnboxingMethod()
812 function->SetIdent(functionIdent); in CreateUnboxingMethod()
819 return checker_->Allocator(); in Allocator()