Lines Matching refs:expr
34 checker::Type *TSAnalyzer::Check([[maybe_unused]] ir::PrefixAssertionExpression *expr) const in Check()
80 checker::Type *TSAnalyzer::Check([[maybe_unused]] ir::MetaProperty *expr) const in Check()
92 checker::Type *TSAnalyzer::Check([[maybe_unused]] ir::Property *expr) const in Check()
102 checker::Type *TSAnalyzer::Check([[maybe_unused]] ir::SpreadElement *expr) const in Check()
107 checker::Type *TSAnalyzer::Check([[maybe_unused]] ir::TemplateElement *expr) const in Check()
228 checker::Type *TSAnalyzer::Check([[maybe_unused]] ir::ETSScript *expr) const in Check()
233 checker::Type *TSAnalyzer::Check([[maybe_unused]] ir::ETSClassLiteral *expr) const in Check()
248 checker::Type *TSAnalyzer::Check([[maybe_unused]] ir::ETSLaunchExpression *expr) const in Check()
253 checker::Type *TSAnalyzer::Check([[maybe_unused]] ir::ETSNewArrayInstanceExpression *expr) const in Check()
258 checker::Type *TSAnalyzer::Check([[maybe_unused]] ir::ETSNewClassInstanceExpression *expr) const in Check()
263 checker::Type *TSAnalyzer::Check([[maybe_unused]] ir::ETSNewMultiDimArrayInstanceExpression *expr) … in Check()
273 checker::Type *TSAnalyzer::Check([[maybe_unused]] ir::ETSParameterExpression *expr) const in Check()
376 checker::Type *TSAnalyzer::Check(ir::ArrayExpression *expr) const in Check()
384 for (auto *it : expr->Elements()) { in Check()
440 checker::Type *TSAnalyzer::Check(ir::ArrowFunctionExpression *expr) const in Check()
445 if (expr->Function()->Parent()->Parent() != nullptr && in Check()
446 expr->Function()->Parent()->Parent()->IsVariableDeclarator() && in Check()
447 expr->Function()->Parent()->Parent()->AsVariableDeclarator()->Id()->IsIdentifier()) { in Check()
448 …funcVar = expr->Function()->Parent()->Parent()->AsVariableDeclarator()->Id()->AsIdentifier()->Vari… in Check()
451 checker::ScopeContext scopeCtx(checker, expr->Function()->Scope()); in Check()
454 checker->CheckFunctionParameterDeclarations(expr->Function()->Params(), signatureInfo); in Check()
457 expr->Function()); in Check()
464 signature->SetReturnType(checker->HandleFunctionReturn(expr->Function())); in Check()
466 if (!expr->Function()->Body()->IsExpression()) { in Check()
467 expr->Function()->Body()->Check(checker); in Check()
473 checker::Type *TSAnalyzer::Check(ir::AssignmentExpression *expr) const in Check()
476 if (expr->Left()->IsArrayPattern()) { in Check()
479 … checker::ArrayDestructuringContext(checker, expr->Left(), true, true, nullptr, expr->Right()); in Check()
484 if (expr->Left()->IsObjectPattern()) { in Check()
487 … checker::ObjectDestructuringContext(checker, expr->Left(), true, true, nullptr, expr->Right()); in Check()
492 if (expr->Left()->IsIdentifier() && expr->Left()->AsIdentifier()->Variable() != nullptr && in Check()
493 expr->Left()->AsIdentifier()->Variable()->Declaration()->IsConstDecl()) { in Check()
495 … {"Cannot assign to ", expr->Left()->AsIdentifier()->Name(), " because it is a constant."}, in Check()
496 expr->Left()->Start()); in Check()
499 auto *leftType = expr->Left()->Check(checker); in Check()
502 …checker->ThrowTypeError("Cannot assign to this property because it is readonly.", expr->Left()->St… in Check()
505 if (expr->OperatorType() == lexer::TokenType::PUNCTUATOR_SUBSTITUTION) { in Check()
506 checker->ElaborateElementwise(leftType, expr->Right(), expr->Left()->Start()); in Check()
507 return checker->CheckTypeCached(expr->Right()); in Check()
510 auto *rightType = expr->Right()->Check(checker); in Check()
512 switch (expr->OperatorType()) { in Check()
524 … return checker->CheckBinaryOperator(leftType, rightType, expr->Left(), expr->Right(), expr, in Check()
525 expr->OperatorType()); in Check()
528 … return checker->CheckPlusOperator(leftType, rightType, expr->Left(), expr->Right(), expr, in Check()
529 expr->OperatorType()); in Check()
532 … checker->CheckAssignmentOperator(expr->OperatorType(), expr->Left(), leftType, rightType); in Check()
544 checker::Type *TSAnalyzer::Check([[maybe_unused]] ir::AwaitExpression *expr) const in Check()
551 checker::Type *TSAnalyzer::Check(ir::BinaryExpression *expr) const in Check()
554 auto *leftType = expr->Left()->Check(checker); in Check()
555 auto *rightType = expr->Right()->Check(checker); in Check()
557 switch (expr->OperatorType()) { in Check()
569 … return checker->CheckBinaryOperator(leftType, rightType, expr->Left(), expr->Right(), expr, in Check()
570 expr->OperatorType()); in Check()
573 … return checker->CheckPlusOperator(leftType, rightType, expr->Left(), expr->Right(), expr, in Check()
574 expr->OperatorType()); in Check()
578 … return checker->CheckCompareOperator(leftType, rightType, expr->Left(), expr->Right(), expr, in Check()
579 expr->OperatorType()); in Check()
590 checker->ThrowBinaryLikeError(expr->OperatorType(), leftType, rightType, expr->Start()); in Check()
593 return checker->CheckInstanceofExpression(leftType, rightType, expr->Right(), expr); in Check()
596 … return checker->CheckInExpression(leftType, rightType, expr->Left(), expr->Right(), expr); in Check()
599 return checker->CheckAndOperator(leftType, rightType, expr->Left()); in Check()
602 return checker->CheckOrOperator(leftType, rightType, expr->Left()); in Check()
609 … checker->CheckAssignmentOperator(expr->OperatorType(), expr->Left(), leftType, rightType); in Check()
627 checker::Type *TSAnalyzer::Check(ir::CallExpression *expr) const in Check()
630 checker::Type *calleeType = expr->callee_->Check(checker); in Check()
635 …checker->ResolveCallOrNewExpression(calleeObj->CallSignatures(), expr->Arguments(), expr->Start()); in Check()
638 checker->ThrowTypeError("This expression is not callable.", expr->Start()); in Check()
642 checker::Type *TSAnalyzer::Check(ir::ChainExpression *expr) const in Check()
645 return expr->expression_->Check(checker); in Check()
648 checker::Type *TSAnalyzer::Check([[maybe_unused]] ir::ClassExpression *expr) const in Check()
653 checker::Type *TSAnalyzer::Check(ir::ConditionalExpression *expr) const in Check()
656 checker::Type *testType = expr->Test()->Check(checker); in Check()
658 checker->CheckTruthinessOfType(testType, expr->Test()->Start()); in Check()
659 …checker->CheckTestingKnownTruthyCallableOrAwaitableType(expr->Test(), testType, expr->consequent_); in Check()
661 checker::Type *consequentType = expr->consequent_->Check(checker); in Check()
662 checker::Type *alternateType = expr->alternate_->Check(checker); in Check()
667 checker::Type *TSAnalyzer::Check([[maybe_unused]] ir::DirectEvalExpression *expr) const in Check()
672 checker::Type *TSAnalyzer::Check(ir::FunctionExpression *expr) const in Check()
677 if (expr->Function()->Parent()->Parent() != nullptr && in Check()
678 expr->Function()->Parent()->Parent()->IsVariableDeclarator() && in Check()
679 expr->Function()->Parent()->Parent()->AsVariableDeclarator()->Id()->IsIdentifier()) { in Check()
680 …funcVar = expr->Function()->Parent()->Parent()->AsVariableDeclarator()->Id()->AsIdentifier()->Vari… in Check()
683 checker::ScopeContext scopeCtx(checker, expr->Function()->Scope()); in Check()
686 checker->CheckFunctionParameterDeclarations(expr->Function()->Params(), signatureInfo); in Check()
689 expr->Function()); in Check()
696 signature->SetReturnType(checker->HandleFunctionReturn(expr->Function())); in Check()
698 expr->Function()->Body()->Check(checker); in Check()
703 checker::Type *TSAnalyzer::Check(ir::Identifier *expr) const in Check()
706 if (expr->Variable() == nullptr) { in Check()
707 if (expr->Name().Is("undefined")) { in Check()
711 checker->ThrowTypeError({"Cannot find name ", expr->Name()}, expr->Start()); in Check()
714 const varbinder::Decl *decl = expr->Variable()->Declaration(); in Check()
717 …checker->ThrowTypeError({expr->Name(), " only refers to a type, but is being used as a value here.… in Check()
718 expr->Start()); in Check()
721 expr->SetTsType(checker->GetTypeOfVariable(expr->Variable())); in Check()
722 return expr->TsType(); in Check()
725 checker::Type *TSAnalyzer::Check([[maybe_unused]] ir::ImportExpression *expr) const in Check()
730 checker::Type *TSAnalyzer::Check(ir::MemberExpression *expr) const in Check()
733 …checker::Type *baseType = checker->CheckNonNullType(expr->Object()->Check(checker), expr->Object()… in Check()
735 if (expr->IsComputed()) { in Check()
736 checker::Type *indexType = expr->Property()->Check(checker); in Check()
744 …checker->ThrowTypeError({"Type ", indexType, " cannot be used as index type"}, expr->Property()->S… in Check()
749 expr->Start()); in Check()
754 expr->Start()); in Check()
757 switch (expr->Property()->Type()) { in Check()
760 … {"Property ", expr->Property()->AsIdentifier()->Name(), " does not exist on this type."}, in Check()
761 expr->Property()->Start()); in Check()
765 … {"Property ", expr->Property()->AsNumberLiteral()->Str(), " does not exist on this type."}, in Check()
766 expr->Property()->Start()); in Check()
770 … {"Property ", expr->Property()->AsStringLiteral()->Str(), " does not exist on this type."}, in Check()
771 expr->Property()->Start()); in Check()
779 …varbinder::Variable *prop = checker->GetPropertyOfType(baseType, expr->Property()->AsIdentifier()-… in Check()
803 …checker->ThrowTypeError({"Property ", expr->Property()->AsIdentifier()->Name(), " does not exist o… in Check()
804 expr->Property()->Start()); in Check()
808 checker::Type *TSAnalyzer::Check(ir::NewExpression *expr) const in Check()
811 checker::Type *calleeType = expr->callee_->Check(checker); in Check()
815 …er->ResolveCallOrNewExpression(calleeObj->ConstructSignatures(), expr->Arguments(), expr->Start()); in Check()
818 checker->ThrowTypeError("This expression is not callable.", expr->Start()); in Check()
870 checker::Type *TSAnalyzer::Check(ir::ObjectExpression *expr) const in Check()
883 for (auto *it : expr->Properties()) { in Check()
987 checker::Type *TSAnalyzer::Check([[maybe_unused]] ir::OmittedExpression *expr) const in Check()
993 checker::Type *TSAnalyzer::Check([[maybe_unused]] ir::OpaqueTypeNode *expr) const in Check()
995 return expr->TsType(); in Check()
998 checker::Type *TSAnalyzer::Check([[maybe_unused]] ir::SequenceExpression *expr) const in Check()
1005 checker::Type *TSAnalyzer::Check([[maybe_unused]] ir::SuperExpression *expr) const in Check()
1012 checker::Type *TSAnalyzer::Check([[maybe_unused]] ir::TaggedTemplateExpression *expr) const in Check()
1019 checker::Type *TSAnalyzer::Check([[maybe_unused]] ir::TemplateLiteral *expr) const in Check()
1026 checker::Type *TSAnalyzer::Check([[maybe_unused]] ir::ThisExpression *expr) const in Check()
1034 ir::UnaryExpression *expr) const in CheckDeleteKeyword()
1036 checker::Type *propType = expr->argument_->Check(checker); in CheckDeleteKeyword()
1037 if (!expr->Argument()->IsMemberExpression()) { in CheckDeleteKeyword()
1039 expr->Argument()->Start()); in CheckDeleteKeyword()
1043 expr->Argument()->Start()); in CheckDeleteKeyword()
1046 …checker->ThrowTypeError("The operand of a delete operator must be a optional.", expr->Argument()->… in CheckDeleteKeyword()
1051 …alyzer::CheckLiteral([[maybe_unused]] checker::TSChecker *checker, ir::UnaryExpression *expr) const in CheckLiteral()
1053 if (!expr->Argument()->IsLiteral()) { in CheckLiteral()
1057 const ir::Literal *lit = expr->Argument()->AsLiteral(); in CheckLiteral()
1060 if (expr->OperatorType() == lexer::TokenType::PUNCTUATOR_PLUS) { in CheckLiteral()
1063 if (expr->OperatorType() == lexer::TokenType::PUNCTUATOR_MINUS) { in CheckLiteral()
1066 … } else if (lit->IsBigIntLiteral() && expr->OperatorType() == lexer::TokenType::PUNCTUATOR_MINUS) { in CheckLiteral()
1073 checker::Type *TSAnalyzer::Check(ir::UnaryExpression *expr) const in Check()
1076 checker::Type *operandType = expr->argument_->Check(checker); in Check()
1078 if (expr->operator_ == lexer::TokenType::KEYW_TYPEOF) { in Check()
1082 if (expr->operator_ == lexer::TokenType::KEYW_DELETE) { in Check()
1083 return CheckDeleteKeyword(checker, expr); in Check()
1086 auto *res = CheckLiteral(checker, expr); in Check()
1091 switch (expr->operator_) { in Check()
1095 checker->CheckNonNullType(operandType, expr->Start()); in Check()
1098 if (expr->operator_ == lexer::TokenType::PUNCTUATOR_PLUS) { in Check()
1101 expr->Start()); in Check()
1110 checker->CheckTruthinessOfType(operandType, expr->Start()); in Check()
1130 checker::Type *TSAnalyzer::Check(ir::UpdateExpression *expr) const in Check()
1133 checker::Type *operandType = expr->argument_->Check(checker); in Check()
1134 checker->CheckNonNullType(operandType, expr->Start()); in Check()
1138 expr->Start()); in Check()
1142 …expr->argument_, "The operand of an increment or decrement operator must be a variable or a proper… in Check()
1148 checker::Type *TSAnalyzer::Check([[maybe_unused]] ir::YieldExpression *expr) const in Check()
1155 checker::Type *TSAnalyzer::Check(ir::BigIntLiteral *expr) const in Check()
1158 auto search = checker->BigintLiteralMap().find(expr->Str()); in Check()
1163 …auto *newBigintLiteralType = checker->Allocator()->New<checker::BigintLiteralType>(expr->Str(), fa… in Check()
1164 checker->BigintLiteralMap().insert({expr->Str(), newBigintLiteralType}); in Check()
1168 checker::Type *TSAnalyzer::Check(ir::BooleanLiteral *expr) const in Check()
1171 return expr->Value() ? checker->GlobalTrueType() : checker->GlobalFalseType(); in Check()
1174 checker::Type *TSAnalyzer::Check([[maybe_unused]] ir::CharLiteral *expr) const in Check()
1179 checker::Type *TSAnalyzer::Check([[maybe_unused]] ir::NullLiteral *expr) const in Check()
1185 checker::Type *TSAnalyzer::Check(ir::NumberLiteral *expr) const in Check()
1188 auto search = checker->NumberLiteralMap().find(expr->Number().GetDouble()); in Check()
1193 …auto *newNumLiteralType = checker->Allocator()->New<checker::NumberLiteralType>(expr->Number().Get… in Check()
1194 checker->NumberLiteralMap().insert({expr->Number().GetDouble(), newNumLiteralType}); in Check()
1198 checker::Type *TSAnalyzer::Check([[maybe_unused]] ir::RegExpLiteral *expr) const in Check()
1205 checker::Type *TSAnalyzer::Check(ir::StringLiteral *expr) const in Check()
1208 auto search = checker->StringLiteralMap().find(expr->Str()); in Check()
1213 auto *newStrLiteralType = checker->Allocator()->New<checker::StringLiteralType>(expr->Str()); in Check()
1214 checker->StringLiteralMap().insert({expr->Str(), newStrLiteralType}); in Check()
1219 checker::Type *TSAnalyzer::Check(ir::UndefinedLiteral *expr) const in Check()
1221 (void)expr; in Check()
1658 checker::Type *TSAnalyzer::Check(ir::TSAsExpression *expr) const in Check()
1661 if (expr->IsConst()) { in Check()
1663 checker::Type *exprType = expr->Expr()->Check(checker); in Check()
1665 if (!IsValidConstAssertionArgument(checker, expr->Expr())) { in Check()
1669 expr->Expr()->Start()); in Check()
1677 expr->TypeAnnotation()->Check(checker); in Check()
1678 checker::Type *exprType = checker->GetBaseTypeOfLiteralType(expr->Expr()->Check(checker)); in Check()
1679 checker::Type *targetType = expr->TypeAnnotation()->GetType(checker); in Check()
1686 expr->Start()); in Check()
1701 checker::Type *TSAnalyzer::Check([[maybe_unused]] ir::TSClassImplements *expr) const in Check()
1726 const ir::Identifier *expr) in EvaluateIdentifier() argument
1728 if (expr->Name() == "NaN") { in EvaluateIdentifier()
1731 if (expr->Name() == "Infinity") { in EvaluateIdentifier()
1735 varbinder::Variable *enumMember = expr->AsIdentifier()->Variable(); in EvaluateIdentifier()
1738 checker->ThrowTypeError({"Cannot find name ", expr->AsIdentifier()->Name()}, in EvaluateIdentifier()
1828 … const ir::BinaryExpression *expr) const in EvaluateBinaryExpression()
1830 …varbinder::EnumMemberResult left = EvaluateEnumMember(checker, enumVar, expr->AsBinaryExpression()… in EvaluateBinaryExpression()
1831 …varbinder::EnumMemberResult right = EvaluateEnumMember(checker, enumVar, expr->AsBinaryExpression(… in EvaluateBinaryExpression()
1833 GetOperationResulForDouble(expr->AsBinaryExpression()->OperatorType(), left, right); in EvaluateBinaryExpression()
1837 expr->AsBinaryExpression()->OperatorType() == lexer::TokenType::PUNCTUATOR_PLUS) { in EvaluateBinaryExpression()
1850 … const ir::UnaryExpression *expr) const in EvaluateUnaryExpression()
1852 varbinder::EnumMemberResult value = EvaluateEnumMember(checker, enumVar, expr->Argument()); in EvaluateUnaryExpression()
1857 switch (expr->OperatorType()) { in EvaluateUnaryExpression()
1877 const ir::AstNode *expr) const in EvaluateEnumMember()
1879 switch (expr->Type()) { in EvaluateEnumMember()
1881 return EvaluateUnaryExpression(checker, enumVar, expr->AsUnaryExpression()); in EvaluateEnumMember()
1884 return EvaluateBinaryExpression(checker, enumVar, expr->AsBinaryExpression()); in EvaluateEnumMember()
1887 return expr->AsNumberLiteral()->Number().GetDouble(); in EvaluateEnumMember()
1890 return expr->AsStringLiteral()->Str(); in EvaluateEnumMember()
1893 return EvaluateIdentifier(checker, enumVar, expr->AsIdentifier()); in EvaluateEnumMember()
1896 return EvaluateEnumMember(checker, enumVar, expr->AsMemberExpression()); in EvaluateEnumMember()
2059 checker::Type *TSAnalyzer::Check([[maybe_unused]] ir::TSExternalModuleReference *expr) const in Check()
2118 checker::Type *TSAnalyzer::Check(ir::TSInterfaceBody *expr) const in Check()
2121 for (auto *it : expr->Body()) { in Check()
2202 checker::Type *TSAnalyzer::Check([[maybe_unused]] ir::TSInterfaceHeritage *expr) const in Check()
2246 checker::Type *TSAnalyzer::Check([[maybe_unused]] ir::TSNonNullExpression *expr) const in Check()
2266 checker::Type *TSAnalyzer::Check([[maybe_unused]] ir::TSParameterProperty *expr) const in Check()
2278 checker::Type *TSAnalyzer::Check(ir::TSQualifiedName *expr) const in Check()
2281 …checker::Type *baseType = checker->CheckNonNullType(expr->Left()->Check(checker), expr->Left()->St… in Check()
2282 varbinder::Variable *prop = checker->GetPropertyOfType(baseType, expr->Right()->Name()); in Check()
2296 checker->ThrowTypeError({"Property ", expr->Right()->Name(), " does not exist on this type."}, in Check()
2297 expr->Right()->Start()); in Check()
2329 checker::Type *TSAnalyzer::Check([[maybe_unused]] ir::TSTypeAssertion *expr) const in Check()
2353 checker::Type *TSAnalyzer::Check([[maybe_unused]] ir::TSTypeParameter *expr) const in Check()
2358 checker::Type *TSAnalyzer::Check([[maybe_unused]] ir::TSTypeParameterDeclaration *expr) const in Check()
2363 checker::Type *TSAnalyzer::Check([[maybe_unused]] ir::TSTypeParameterInstantiation *expr) const in Check()