Lines Matching refs:func
48 Type *TSChecker::HandleFunctionReturn(ir::ScriptFunction *func)
50 if (func->ReturnTypeAnnotation() != nullptr) {
51 func->ReturnTypeAnnotation()->Check(this);
52 Type *returnType = func->ReturnTypeAnnotation()->GetType(this);
54 if (func->IsArrow() && func->Body()->IsExpression()) {
55 ElaborateElementwise(returnType, func->Body()->AsExpression(), func->Body()->Start());
60 func->ReturnTypeAnnotation()->Start());
65 func, func->ReturnTypeAnnotation()->Start(),
72 if (func->Declare()) {
76 if (func->IsArrow() && func->Body()->IsExpression()) {
77 return func->Body()->Check(this);
81 CollectTypesFromReturnStatements(func->Body(), &returnTypes);
88 ThrowReturnTypeCircularityError(func);
93 ThrowReturnTypeCircularityError(func);
100 void TSChecker::ThrowReturnTypeCircularityError(ir::ScriptFunction *func)
102 if (func->ReturnTypeAnnotation() != nullptr) {
103 ThrowTypeError("Return type annotation circularly reference itself", func->ReturnTypeAnnotation()->Start());
106 if (func->Id() != nullptr) {
107 ThrowTypeError({func->Id()->AsIdentifier()->Name(),
110 func->Id()->Start());
116 func->Start());
529 void TSChecker::ValidateSubsequentNode(const ir::Statement *const subsequentNode, const ir::ScriptFunction *const func)
533 func->Id()->Start());
537 if (subsequentFunc->Id()->Name() != func->Id()->Name()) {
539 func->Id()->Start());
542 if (subsequentFunc->Declare() != func->Declare()) {
543 ThrowTypeError("Overload signatures must all be ambient or non-ambient.", func->Id()->Start());
574 ir::ScriptFunction *func = *it;
575 ASSERT(func->IsOverload() && (*it)->Parent()->Parent()->IsBlockStatement());
576 ir::Statement *subsequentNode = FindSubsequentFunctionNode((*it)->Parent()->Parent()->AsBlockStatement(), func);
578 ValidateSubsequentNode(subsequentNode, func);
580 ScopeContext scopeCtx(this, func->Scope());
583 CheckFunctionParameterDeclarations(func->Params(), overloadSignatureInfo);
587 if (func->ReturnTypeAnnotation() != nullptr) {
588 func->ReturnTypeAnnotation()->Check(this);
589 returnType = func->ReturnTypeAnnotation()->GetType(this);
592 Signature *overloadSignature = Allocator()->New<checker::Signature>(overloadSignatureInfo, returnType, func);
663 void TSChecker::CheckAllCodePathsInNonVoidFunctionReturnOrThrow(ir::ScriptFunction *func,
666 if (!SearchForReturnOrThrow(func->Body())) {