Lines Matching defs:scriptFunc
106 void DoBodyTypeChecking(ETSChecker *checker, ir::MethodDefinition *node, ir::ScriptFunction *scriptFunc)
108 if (scriptFunc->HasBody() && (node->IsNative() || node->IsAbstract() || node->IsDeclare())) {
109 checker->LogTypeError("Native, Abstract and Declare methods cannot have body.", scriptFunc->Body()->Start());
112 if (!scriptFunc->IsAsyncFunc() && scriptFunc->HasBody() &&
113 (!scriptFunc->IsExternal() || scriptFunc->IsExternalOverload())) {
114 checker::ScopeContext scopeCtx(checker, scriptFunc->Scope());
129 CheckExtensionMethod(checker, scriptFunc, node);
132 scriptFunc->Body()->Check(checker);
134 if (scriptFunc->ReturnTypeAnnotation() == nullptr) {
135 if (scriptFunc->IsAsyncImplFunc()) {
136 ComposeAsyncImplFuncReturnType(checker, scriptFunc);
139 for (auto &returnStatement : scriptFunc->ReturnStatements()) {
140 returnStatement->SetReturnType(checker, scriptFunc->Signature()->ReturnType());
148 void ComposeAsyncImplFuncReturnType(ETSChecker *checker, ir::ScriptFunction *scriptFunc)
156 promiseType->TypeArguments().emplace_back(scriptFunc->Signature()->ReturnType());
169 scriptFunc->Signature()->SetReturnType(returnType->TsType());
175 auto *scriptFunc = node->Function();
181 if (scriptFunc->Signature()->HasSignatureFlag(SignatureFlags::NEED_RETURN_TYPE)) {
184 scriptFunc->Signature()->RemoveSignatureFlag(SignatureFlags::NEED_RETURN_TYPE);
196 void CheckPredefinedMethodReturnType(ETSChecker *checker, ir::ScriptFunction *scriptFunc)
198 auto const &position = scriptFunc->Start();
200 if (scriptFunc->IsSetter() && (scriptFunc->Signature()->ReturnType() != checker->GlobalVoidType())) {
204 if (scriptFunc->IsGetter() && (scriptFunc->Signature()->ReturnType() == checker->GlobalVoidType())) {
208 auto const name = scriptFunc->Id()->Name();
212 if (scriptFunc->Signature()->ReturnType() == checker->GlobalVoidType()) {
216 if (scriptFunc->Signature()->ReturnType() != checker->GlobalVoidType()) {
220 CheckIteratorMethodReturnType(checker, scriptFunc, position, methodName);
242 void CheckIteratorMethodReturnType(ETSChecker *checker, ir::ScriptFunction *scriptFunc,
245 const auto *returnType = scriptFunc->Signature()->ReturnType();
267 {"The return type of '", scriptFunc->Id()->Name(), "' must be a type that implements Iterator interface."},