Lines Matching refs:allocator

82 static util::StringView CreateCalleeName(ArenaAllocator *allocator)
84 auto name = util::UString(util::StringView("lambda$invoke$"), allocator);
97 auto *allocator = ctx->allocator;
100 auto *newScope = allocator->New<varbinder::LocalScope>(allocator, enclosingScope);
101 auto newTypeParams = ArenaVector<checker::ETSTypeParameter *>(allocator->Adapter());
102 auto newTypeParamNodes = ArenaVector<ir::TSTypeParameter *>(allocator->Adapter());
108 auto *newTypeParamId = allocator->New<ir::Identifier>(oldTypeParamNode->Name()->Name(), allocator);
110 util::NodeAllocator::ForceSetParent<ir::TSTypeParameter>(allocator, newTypeParamId, nullptr, nullptr);
111 auto *newTypeParam = allocator->New<checker::ETSTypeParameter>();
114 auto *newTypeParamDecl = allocator->New<varbinder::TypeParameterDecl>(newTypeParamId->Name());
117 allocator->New<varbinder::LocalVariable>(newTypeParamDecl, varbinder::VariableFlags::TYPE_PARAMETER);
134 newTypeParamNodes[ix]->SetConstraint(allocator->New<ir::OpaqueTypeNode>(newConstraint));
140 newTypeParamNodes[ix]->SetDefaultType(allocator->New<ir::OpaqueTypeNode>(newDefault));
146 allocator, std::move(newTypeParamNodes), oldIrTypeParams->RequiredParams());
156 auto allocator = ctx->allocator;
159 auto resParams = ArenaVector<ir::Expression *>(allocator->Adapter());
160 auto varMap = ArenaMap<varbinder::Variable *, varbinder::Variable *>(allocator->Adapter());
168 allocator, capturedVar->Name(), allocator->New<ir::OpaqueTypeNode>(newType), allocator);
169 auto param = util::NodeAllocator::ForceSetParent<ir::ETSParameterExpression>(allocator, newId, nullptr);
189 auto *newParam = oldParam->AsETSParameterExpression()->Clone(allocator, nullptr);
250 auto *allocator = ctx->allocator;
260 auto *calleeNameId = allocator->New<ir::Identifier>(cmInfo->calleeName, allocator);
264 auto *calleeNameClone = calleeNameId->Clone(allocator, nullptr);
265 auto *funcExpr = util::NodeAllocator::ForceSetParent<ir::FunctionExpression>(allocator, func);
267 allocator, ir::MethodDefinitionKind::METHOD, calleeNameClone, funcExpr, modifierFlags, allocator, false);
273 varBinder->NewVarDecl<varbinder::FunctionDecl>(func->Start(), allocator, cmInfo->calleeName, func);
308 auto *allocator = ctx->allocator;
309 auto *funcScope = cmInfo->body == nullptr ? allocator->New<varbinder::FunctionScope>(allocator, paramScope)
311 ? allocator->New<varbinder::FunctionScope>(allocator, paramScope)
329 auto *allocator = ctx->allocator;
344 auto paramScope = allocator->New<varbinder::FunctionParamScope>(allocator, scopeForMethod);
355 auto returnTypeAnnotation = allocator->New<ir::OpaqueTypeNode>(returnType);
363 allocator, allocator,
396 auto *allocator = ctx->allocator;
400 ? (util::UString {checker::ETSChecker::GetAsyncImplName(info->name), allocator}).View()
503 auto *allocator = ctx->allocator;
507 ? (util::UString {checker::ETSChecker::GetAsyncImplName(info->name), allocator}).View()
542 auto *allocator = ctx->allocator;
545 auto props = ArenaVector<ir::AstNode *>(allocator->Adapter());
567 auto *allocator = ctx->allocator;
571 auto params = ArenaVector<ir::Expression *>(allocator->Adapter());
572 auto makeParam = [checker, allocator, substitution, &params](util::StringView name, checker::Type *type) {
575 allocator, name, allocator->New<ir::OpaqueTypeNode>(substitutedType), allocator);
576 auto *param = util::NodeAllocator::ForceSetParent<ir::ETSParameterExpression>(allocator, id, nullptr);
587 auto bodyStmts = ArenaVector<ir::Statement *>(allocator->Adapter());
599 auto *body = util::NodeAllocator::ForceSetParent<ir::BlockStatement>(allocator, allocator, std::move(bodyStmts));
601 auto *constructorId = allocator->New<ir::Identifier>("constructor", allocator);
602 auto *constructorIdClone = constructorId->Clone(allocator, nullptr);
605 allocator, allocator,
610 auto *funcExpr = util::NodeAllocator::ForceSetParent<ir::FunctionExpression>(allocator, func);
613 allocator, ir::MethodDefinitionKind::CONSTRUCTOR, constructorIdClone, funcExpr, ir::ModifierFlags::NONE,
614 allocator, false);
623 auto *allocator = ctx->allocator;
627 auto callArguments = ArenaVector<ir::Expression *>(allocator->Adapter());
637 : allocator->New<ir::Identifier>(argName, allocator);
645 calleeReceiver = lciInfo->callee->Parent()->AsClassDefinition()->Ident()->Clone(allocator, nullptr);
649 allocator, calleeReceiver, lciInfo->callee->Key()->Clone(allocator, nullptr)->AsExpression(),
655 auto typeArgs = ArenaVector<ir::TypeNode *>(allocator->Adapter());
657 typeArgs.push_back(allocator->New<ir::OpaqueTypeNode>(tp->Name()->AsIdentifier()->Variable()->TsType()));
660 util::NodeAllocator::ForceSetParent<ir::TSTypeParameterInstantiation>(allocator, std::move(typeArgs));
672 auto *allocator = ctx->allocator;
677 auto params = ArenaVector<ir::Expression *>(allocator->Adapter());
681 allocator, lparam->Name(), allocator->New<ir::OpaqueTypeNode>(type), allocator);
682 auto *param = util::NodeAllocator::ForceSetParent<ir::ETSParameterExpression>(allocator, id, nullptr);
688 auto bodyStmts = ArenaVector<ir::Statement *>(allocator->Adapter());
690 auto *callStmt = util::NodeAllocator::ForceSetParent<ir::ExpressionStatement>(allocator, call);
694 allocator, allocator->New<ir::UndefinedLiteral>());
699 auto *returnStmt = util::NodeAllocator::ForceSetParent<ir::ReturnStatement>(allocator, returnExpr);
703 auto body = util::NodeAllocator::ForceSetParent<ir::BlockStatement>(allocator, allocator, std::move(bodyStmts));
704 auto *returnType2 = allocator->New<ir::OpaqueTypeNode>(
708 allocator, allocator,
712 auto *invokeId = allocator->New<ir::Identifier>(methodName, allocator);
715 auto *funcExpr = util::NodeAllocator::ForceSetParent<ir::FunctionExpression>(allocator, func);
717 auto *invokeIdClone = invokeId->Clone(allocator, nullptr);
719 allocator, ir::MethodDefinitionKind::METHOD, invokeIdClone, funcExpr, ir::ModifierFlags::NONE, allocator,
750 auto *allocator = ctx->allocator;
762 auto lambdaClassName = util::UString {std::string_view {"LambdaObject-"}, allocator};
767 ArenaVector<checker::Type *> funcInterfaces(allocator->Adapter());
813 auto *allocator = ctx->allocator;
817 auto args = ArenaVector<ir::Expression *>(allocator->Adapter());
822 auto *id = allocator->New<ir::Identifier>(captured->Name(), allocator);
832 allocator, allocator->New<ir::OpaqueTypeNode>(constructedType), std::move(args), nullptr);
852 auto *allocator = ctx->allocator;
858 info.name = CreateCalleeName(allocator);
859 auto capturedVars = FindCaptured(allocator, lambda);
861 info.callReceiver = CheckIfNeedThis(lambda) ? allocator->New<ir::ThisExpression>() : nullptr;
927 auto *allocator = ctx->allocator;
933 ArenaVector<ir::Expression *> params {allocator->Adapter()};
936 allocator,
937 allocator->New<ir::Identifier>(p->Name(), allocator->New<ir::OpaqueTypeNode>(p->TsType()), allocator),
941 allocator, allocator,
945 allocator->New<ir::OpaqueTypeNode>(signature->ReturnType())},
948 ArenaVector<ir::Statement *> bodyStmts {allocator->Adapter()};
949 ArenaVector<ir::Expression *> callArgs {allocator->Adapter()};
952 callArgs.push_back(p->AsETSParameterExpression()->Ident()->Clone(allocator, nullptr));
954 auto *callExpr = util::NodeAllocator::ForceSetParent<ir::CallExpression>(allocator, funcRef, std::move(callArgs),
958 stmt = util::NodeAllocator::ForceSetParent<ir::ExpressionStatement>(allocator, callExpr);
960 stmt = util::NodeAllocator::ForceSetParent<ir::ReturnStatement>(allocator, callExpr);
963 func->SetBody(util::NodeAllocator::ForceSetParent<ir::BlockStatement>(allocator, allocator, std::move(bodyStmts)));
965 auto *lambda = util::NodeAllocator::ForceSetParent<ir::ArrowFunctionExpression>(allocator, func);
986 auto *allocator = ctx->allocator;
1017 info.name = CreateCalleeName(allocator);
1018 auto emptySet = ArenaSet<varbinder::Variable *>(allocator->Adapter());
1028 ArenaVector<checker::Signature *> signatures(allocator->Adapter());
1062 auto *allocator = ctx->allocator;
1077 auto *invoke0Id = allocator->New<ir::Identifier>(checker::FUNCTIONAL_INTERFACE_INVOKE_METHOD_NAME, allocator);
1082 allocator, oldCallee, invoke0Id, ir::MemberExpressionKind::PROPERTY_ACCESS, false, false);