Skip to content

Commit 9d5b472

Browse files
ubaidskcertik
authored andcommitted
ASR: Support unsigned int unary add
1 parent 18392f4 commit 9d5b472

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/lpython/semantics/python_ast_to_asr.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3523,6 +3523,12 @@ class CommonVisitor : public AST::BaseVisitor<Struct> {
35233523
ASRUtils::expr_value(operand))->m_n;
35243524
tmp = ASR::make_IntegerConstant_t(al, x.base.base.loc, op_value, operand_type);
35253525
}
3526+
} else if (ASRUtils::is_unsigned_integer(*operand_type)) {
3527+
if (ASRUtils::expr_value(operand) != nullptr) {
3528+
int64_t op_value = ASR::down_cast<ASR::UnsignedIntegerConstant_t>(
3529+
ASRUtils::expr_value(operand))->m_n;
3530+
tmp = ASR::make_UnsignedIntegerConstant_t(al, x.base.base.loc, op_value, operand_type);
3531+
}
35263532
} else if (ASRUtils::is_real(*operand_type)) {
35273533
if (ASRUtils::expr_value(operand) != nullptr) {
35283534
double op_value = ASR::down_cast<ASR::RealConstant_t>(

0 commit comments

Comments
 (0)