Lines Matching defs:method

67 ir::TSTypeParameterDeclaration *DefaultParameterLowering::CreateParameterDeclaraion(ir::MethodDefinition *method,
71 if (method->Function()->TypeParams() == nullptr || method->Function()->TypeParams()->Params().empty()) {
77 auto parentParams = method->Function()->TypeParams()->Params();
92 ir::FunctionSignature DefaultParameterLowering::CreateFunctionSignature(ir::MethodDefinition *method,
98 ir::TSTypeParameterDeclaration *typeParamDecl = CreateParameterDeclaraion(method, ctx);
100 method->Function()->ReturnTypeAnnotation() != nullptr
101 ? method->Function()->ReturnTypeAnnotation()->Clone(checker->Allocator(), nullptr)->AsTypeNode()
108 ir::MethodDefinition *method, public_lib::Context *ctx)
113 if (method->Function()->TypeParams() == nullptr || method->Function()->TypeParams()->Params().empty()) {
119 for (const auto &param : method->Function()->TypeParams()->Params()) {
134 ir::BlockStatement *DefaultParameterLowering::CreateFunctionBody(ir::MethodDefinition *method, public_lib::Context *ctx,
143 auto *const callee = checker->AllocNode<ir::Identifier>(method->Id()->Name(), checker->Allocator());
146 if (method->IsConstructor()) {
149 if (method->Parent()->IsClassDefinition() && (!method->Parent()->AsClassDefinition()->IsGlobal())) {
150 if (method->IsStatic()) {
151 id = checker->AllocNode<ir::Identifier>(method->Parent()->AsClassDefinition()->Ident()->Name(),
161 auto *paramInst = CreateTypeParameterInstantiation(method, ctx);
164 callExpression->SetRange(method->Range()); // NOTE: Used to locate the original node when an error occurs
166 if ((method->Function()->ReturnTypeAnnotation() != nullptr) ||
167 ((method->Function()->AsScriptFunction()->Flags() & ir::ScriptFunctionFlags::HAS_RETURN) != 0)) {
168 if ((method->Function()->ReturnTypeAnnotation() != nullptr) &&
169 method->Function()->ReturnTypeAnnotation()->IsTSThisType()) {
191 ir::MethodDefinition *method, public_lib::Context *ctx, ArenaVector<ir::Expression *> funcDefinitionArgs,
194 lexer::SourcePosition startLoc(method->Start().line, method->Start().index);
196 ir::FunctionSignature signature = CreateFunctionSignature(method, std::move(funcDefinitionArgs), ctx);
202 if (!(method->IsNative() || method->IsDeclare() || method->IsAbstract())) {
203 body = CreateFunctionBody(method, ctx, std::move(funcCallArgs));
208 body, std::move(signature), method->Function()->Flags(), {}, false, method->Function()->Language()});
209 funcNode->AddModifier(method->Function()->Modifiers());
212 id = method->Id()->Clone(checker->Allocator(), nullptr)->AsIdentifier();
217 void DefaultParameterLowering::CreateOverloadFunction(ir::MethodDefinition *method,
224 CreateFunctionExpression(method, ctx, std::move(funcDefinitionArgs), std::move(funcCallArgs));
227 method->Kind(), ident, funcExpression, method->Modifiers(), checker->Allocator(), false);
233 if (method->Parent()->IsTSInterfaceBody()) {
237 method->AddOverload(overloadMethod);
238 overloadMethod->SetStart(method->Start()); // NOTE: Used to locate the original node when an error occurs
239 overloadMethod->SetParent(method); // NOTE(aleksisch): It's incorrect and don't exist in class body
251 void DefaultParameterLowering::ProcessGlobalFunctionDefinition(ir::MethodDefinition *method, public_lib::Context *ctx)
254 auto params = method->Function()->Params();
257 // i.e. each new overload method has less actual paramaters than previous one and more
258 // default parameters values used to call original method.
273 // create function/method definition with less mandatory args than overloaded one
276 // optional is moved out we need to create new overload method with the rest of
277 // arguments (as new method args) and move the optional one(s) to the explicit
278 // call to the original method
314 // NOTE: we don't need Initializer here, as overload-method will have strict list of parameters
327 // prepare args list for overloade method definition
334 CreateOverloadFunction(method, std::move(funcCallArgs), std::move(funcDefinitionArgs), ctx);