Lines Matching refs:left

20 static inline void RepairTypeErrorsInOperands(Type **left, Type **right)
22 if (IsTypeError(*left)) {
23 *left = *right;
26 *right = *left;
130 Type *ETSChecker::HandleRelationOperationOnTypes(Type *left, Type *right, lexer::TokenType operationType)
132 ASSERT(left->HasTypeFlag(TypeFlag::CONSTANT | TypeFlag::ETS_CONVERTIBLE_TO_NUMERIC) &&
135 if (left->IsDoubleType() || right->IsDoubleType()) {
136 return PerformRelationOperationOnTypes<DoubleType>(left, right, operationType);
139 if (left->IsFloatType() || right->IsFloatType()) {
140 return PerformRelationOperationOnTypes<FloatType>(left, right, operationType);
143 if (left->IsLongType() || right->IsLongType()) {
144 return PerformRelationOperationOnTypes<LongType>(left, right, operationType);
147 return PerformRelationOperationOnTypes<IntType>(left, right, operationType);
150 bool ETSChecker::CheckBinaryOperatorForBigInt(Type *left, Type *right, lexer::TokenType op)
152 if ((left == nullptr) || (right == nullptr)) {
156 if (!left->IsETSBigIntType()) {
180 const ir::Expression *left, const ir::Expression *right)
185 LogTypeError("Bad operand type: multiple types left in the normalized union type (" + ss.str() +
187 left->Start());
192 LogTypeError("Bad operand type: multiple types left in the normalized union type (" + ss.str() +
204 auto [left, right, operationType, pos] = op;
218 FlagExpressionWithUnboxing(leftType, unboxedL, left);
221 if (!CheckBinaryPlusMultDivOperandsForUnionType(leftType, rightType, left, right)) {
265 auto [left, right, operationType, pos] = op;
285 if (!CheckBinaryPlusMultDivOperandsForUnionType(leftType, rightType, left, right)) {
292 FlagExpressionWithUnboxing(leftType, unboxedL, left);
315 auto [left, right, operationType, pos] = op;
331 FlagExpressionWithUnboxing(leftType, unboxedL, left);
374 auto [left, right, operationType, pos] = op;
390 FlagExpressionWithUnboxing(leftType, unboxedL, left);
398 FlagExpressionWithUnboxing(leftType, unboxedL, left);
413 checker::Type *ETSChecker::CheckBinaryOperatorLogical(ir::Expression *left, ir::Expression *right, ir::Expression *expr,
435 FlagExpressionWithUnboxing(leftType, unboxedL, left);
497 std::tuple<Type *, Type *> ETSChecker::CheckBinaryOperatorStrictEqual(ir::Expression *left,
514 Relation()->SetNode(left);
561 std::tuple<Type *, Type *> ETSChecker::CheckBinaryOperatorEqual(ir::Expression *left, ir::Expression *right,
580 return CheckBinaryOperatorEqualDynamic(left, right, pos);
584 Relation()->SetNode(left);
603 FlagExpressionWithUnboxing(leftType, unboxedL, left);
619 std::tuple<Type *, Type *> ETSChecker::CheckBinaryOperatorEqualDynamic(ir::Expression *left, ir::Expression *right,
624 auto *const dynExp = left->TsType()->IsETSDynamicType() ? left : right;
625 auto *const otherExp = dynExp == left ? right : left;
651 std::tuple<Type *, Type *> ETSChecker::CheckBinaryOperatorLessGreater(ir::Expression *left, ir::Expression *right,
674 FlagExpressionWithUnboxing(leftType, unboxedL, left);
678 return {GlobalETSBooleanType(), CreateETSUnionType({MaybeBoxExpression(left), MaybeBoxExpression(right)})};
754 Type *ETSChecker::CheckBinaryOperatorNullishCoalescing(ir::Expression *left, ir::Expression *right,
757 auto *leftType = left->TsType();
766 left->SetBoxingUnboxingFlags(ir::BoxingUnboxingFlags::BOX_TO_ENUM);
783 // If possible and required update number literal type to the proper value (identical to left-side type)
829 ir::Expression *left;
848 ir::Expression *left = binaryParams.left;
857 tsType = checker->CheckBinaryOperatorLogical(left, right, binaryParams.expr, pos, leftType, rightType,
863 return checker->CheckBinaryOperatorStrictEqual(left, binaryParams.operationType, pos, leftType, rightType);
868 checker->CheckBinaryOperatorEqual(left, right, binaryParams.operationType, pos, leftType, rightType,
879 return checker->CheckBinaryOperatorLessGreater(left, right, binaryParams.operationType, pos,
887 tsType = checker->CheckBinaryOperatorNullishCoalescing(left, right, pos);
971 bool CheckRelationalOperatorsBetweenEnums(ir::Expression *left, ir::Expression *right, lexer::TokenType op)
978 if (((IsStringEnum(left) && IsStringEnum(right)) ||
979 (IsIntEnum(left) && IsIntEnum(right)))) { // NOTE(psiket) In case of int enums it has been already checked in
982 left->AddAstNodeFlags(ir::AstNodeFlags::GENERATE_VALUE_OF);
1023 auto [left, right, operationType, pos] = op;
1037 auto tsType = check(this, std::make_tuple(left, right, operationType, pos), isEqualOp,
1042 return CheckBinaryOperatorHelper(this, {left, right, expr, operationType, pos, isEqualOp},
1046 std::tuple<Type *, Type *> ETSChecker::CheckBinaryOperator(ir::Expression *left, ir::Expression *right,
1050 checker::Type *leftType = left->Check(this);
1053 LogTypeError("Unexpected type error in binary expression", left->Start());
1099 return CheckArithmeticOperations(expr, std::make_tuple(left, right, operationType, pos), isEqualOp,
1103 Type *ETSChecker::HandleArithmeticOperationOnTypes(Type *left, Type *right, lexer::TokenType operationType)
1105 ASSERT(left->HasTypeFlag(TypeFlag::CONSTANT | TypeFlag::ETS_CONVERTIBLE_TO_NUMERIC) &&
1108 if (left->IsDoubleType() || right->IsDoubleType()) {
1109 return PerformArithmeticOperationOnTypes<DoubleType>(left, right, operationType);
1112 if (left->IsFloatType() || right->IsFloatType()) {
1113 return PerformArithmeticOperationOnTypes<FloatType>(left, right, operationType);
1116 if (left->IsLongType() || right->IsLongType()) {
1117 return PerformArithmeticOperationOnTypes<LongType>(left, right, operationType);
1120 return PerformArithmeticOperationOnTypes<IntType>(left, right, operationType);
1123 Type *ETSChecker::HandleBitwiseOperationOnTypes(Type *left, Type *right, lexer::TokenType operationType)
1125 ASSERT(left->HasTypeFlag(TypeFlag::CONSTANT | TypeFlag::ETS_CONVERTIBLE_TO_NUMERIC) &&
1128 if (left->IsDoubleType() || right->IsDoubleType()) {
1129 return HandleBitWiseArithmetic<DoubleType, LongType>(left, right, operationType);
1132 if (left->IsFloatType() || right->IsFloatType()) {
1133 return HandleBitWiseArithmetic<FloatType, IntType>(left, right, operationType);
1136 if (left->IsLongType() || right->IsLongType()) {
1137 return HandleBitWiseArithmetic<LongType>(left, right, operationType);
1140 return HandleBitWiseArithmetic<IntType>(left, right, operationType);