• Home
  • Raw
  • Download

Lines Matching refs:scriptFunc

190 …DoBodyTypeChecking(ETSChecker *checker, ir::MethodDefinition *node, ir::ScriptFunction *scriptFunc)  in DoBodyTypeChecking()  argument
192 if (scriptFunc->HasBody() && (node->IsNative() || node->IsAbstract() || node->IsDeclare())) { in DoBodyTypeChecking()
193 …rowTypeError("Native, Abstract and Declare methods cannot have body.", scriptFunc->Body()->Start()… in DoBodyTypeChecking()
196 if (scriptFunc->IsAsyncFunc()) { in DoBodyTypeChecking()
197 … auto *retType = static_cast<checker::ETSObjectType *>(scriptFunc->Signature()->ReturnType()); in DoBodyTypeChecking()
199 … checker->ThrowTypeError("Return type of async function must be 'Promise'.", scriptFunc->Start()); in DoBodyTypeChecking()
201 } else if (scriptFunc->HasBody() && !scriptFunc->IsExternal()) { in DoBodyTypeChecking()
202 checker::ScopeContext scopeCtx(checker, scriptFunc->Scope()); in DoBodyTypeChecking()
217 CheckExtensionMethod(checker, scriptFunc, node); in DoBodyTypeChecking()
220 scriptFunc->Body()->Check(checker); in DoBodyTypeChecking()
223 … if (scriptFunc->Signature()->HasSignatureFlag(checker::SignatureFlags::INFERRED_RETURN_TYPE) && in DoBodyTypeChecking()
224 scriptFunc->ReturnTypeAnnotation() == nullptr && scriptFunc->Body() != nullptr && in DoBodyTypeChecking()
225 scriptFunc->Body()->IsStatement()) { in DoBodyTypeChecking()
226scriptFunc->Body()->AsStatement()->SetReturnType(checker, scriptFunc->Signature()->ReturnType()); in DoBodyTypeChecking()
233 void CheckGetterSetterTypeConstrains(ETSChecker *checker, ir::ScriptFunction *scriptFunc) in CheckGetterSetterTypeConstrains() argument
235 …if (scriptFunc->IsSetter() && (scriptFunc->Signature()->ReturnType() != checker->GlobalBuiltinVoid… in CheckGetterSetterTypeConstrains()
236 checker->ThrowTypeError("Setter must have void return type", scriptFunc->Start()); in CheckGetterSetterTypeConstrains()
239 …if (scriptFunc->IsGetter() && (scriptFunc->Signature()->ReturnType() == checker->GlobalBuiltinVoid… in CheckGetterSetterTypeConstrains()
240 checker->ThrowTypeError("Getter must return a value", scriptFunc->Start()); in CheckGetterSetterTypeConstrains()
243 auto const name = scriptFunc->Id()->Name(); in CheckGetterSetterTypeConstrains()
245 if (scriptFunc->Signature()->ReturnType() == checker->GlobalBuiltinVoidType()) { in CheckGetterSetterTypeConstrains()
248 scriptFunc->Start()); in CheckGetterSetterTypeConstrains()
251 if (scriptFunc->Signature()->ReturnType() != checker->GlobalBuiltinVoidType()) { in CheckGetterSetterTypeConstrains()
254 scriptFunc->Start()); in CheckGetterSetterTypeConstrains()
262 auto *scriptFunc = node->Function(); in Check() local
263 if (scriptFunc->IsProxy()) { in Check()
268 if (!scriptFunc->HasBody() && !(node->IsAbstract() || node->IsNative() || node->IsDeclare() || in Check()
270 … checker->ThrowTypeError("Only abstract or native methods can't have body.", scriptFunc->Start()); in Check()
273 if (scriptFunc->ReturnTypeAnnotation() == nullptr && in Check()
275 …hrowTypeError("Native and Declare methods should have explicit return type.", scriptFunc->Start()); in Check()
284 if (node->IsNative() && scriptFunc->ReturnTypeAnnotation() == nullptr) { in Check()
285 … checker->ThrowTypeError("'Native' method should have explicit return type", scriptFunc->Start()); in Check()
288 if (node->IsNative() && (scriptFunc->IsGetter() || scriptFunc->IsSetter())) { in Check()
289 checker->ThrowTypeError("'Native' modifier is invalid for Accessors", scriptFunc->Start()); in Check()
292 DoBodyTypeChecking(checker, node, scriptFunc); in Check()
293 CheckGetterSetterTypeConstrains(checker, scriptFunc); in Check()
301 if (scriptFunc->IsRethrowing()) { in Check()
302 checker->CheckRethrowingFunction(scriptFunc); in Check()