Lines Matching refs:right
20 static inline void RepairTypeErrorsInOperands(Type **left, Type **right)
23 *left = *right;
25 if (IsTypeError(*right)) {
26 *right = *left;
130 Type *ETSChecker::HandleRelationOperationOnTypes(Type *left, Type *right, lexer::TokenType operationType)
133 right->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)) {
160 if (!right->IsETSBigIntType()) {
180 const ir::Expression *left, const ir::Expression *right)
194 right->Start());
204 auto [left, right, operationType, pos] = op;
219 FlagExpressionWithUnboxing(rightType, unboxedR, right);
221 if (!CheckBinaryPlusMultDivOperandsForUnionType(leftType, rightType, left, right)) {
265 auto [left, right, operationType, pos] = op;
285 if (!CheckBinaryPlusMultDivOperandsForUnionType(leftType, rightType, left, right)) {
293 FlagExpressionWithUnboxing(rightType, unboxedR, right);
315 auto [left, right, operationType, pos] = op;
332 FlagExpressionWithUnboxing(rightType, unboxedR, right);
374 auto [left, right, operationType, pos] = op;
391 FlagExpressionWithUnboxing(rightType, unboxedR, right);
399 FlagExpressionWithUnboxing(rightType, unboxedR, right);
413 checker::Type *ETSChecker::CheckBinaryOperatorLogical(ir::Expression *left, ir::Expression *right, ir::Expression *expr,
439 FlagExpressionWithUnboxing(rightType, unboxedR, right);
561 std::tuple<Type *, Type *> ETSChecker::CheckBinaryOperatorEqual(ir::Expression *left, ir::Expression *right,
580 return CheckBinaryOperatorEqualDynamic(left, right, pos);
604 FlagExpressionWithUnboxing(rightType, unboxedR, right);
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,
675 FlagExpressionWithUnboxing(rightType, unboxedR, right);
678 return {GlobalETSBooleanType(), CreateETSUnionType({MaybeBoxExpression(left), MaybeBoxExpression(right)})};
754 Type *ETSChecker::CheckBinaryOperatorNullishCoalescing(ir::Expression *left, ir::Expression *right,
763 auto *rightType = right->TsType();
773 right->SetBoxingUnboxingFlags(ir::BoxingUnboxingFlags::BOX_TO_ENUM);
776 rightType = MaybeBoxExpression(right);
784 if (right->IsNumberLiteral() && AdjustNumberLiteralType(right->AsNumberLiteral(), rightType, leftType)) {
830 ir::Expression *right;
849 ir::Expression *right = binaryParams.right;
857 tsType = checker->CheckBinaryOperatorLogical(left, right, binaryParams.expr, 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
983 right->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,
1054 auto rightType = right->Check(this);
1064 checker::Type *rightType = right->Check(this);
1065 if (right->IsTypeNode()) {
1066 rightType = right->AsTypeNode()->GetType(this);
1099 return CheckArithmeticOperations(expr, std::make_tuple(left, right, operationType, pos), isEqualOp,
1103 Type *ETSChecker::HandleArithmeticOperationOnTypes(Type *left, Type *right, lexer::TokenType operationType)
1106 right->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)
1126 right->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);