Skip to content

Commit 0b263d6

Browse files
committed
New string_t
1 parent f6cfb29 commit 0b263d6

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/lpython/semantics/python_ast_to_asr.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -891,7 +891,7 @@ class CommonVisitor : public AST::BaseVisitor<StructType> {
891891
} else if (var_annotation == "str") {
892892
type = ASRUtils::TYPE(ASR::make_String_t(al, loc, 1,
893893
ASRUtils::EXPR(ASR::make_IntegerConstant_t(al, loc, -2,
894-
ASRUtils::TYPE(ASR::make_Integer_t(al, loc, 4)))),
894+
ASRUtils::TYPE(ASR::make_Integer_t(al, loc, 8)))),
895895
false, false, ASR::string_physical_typeType::PointerString));
896896
type = ASRUtils::make_Array_t_util(al, loc, type, dims.p, dims.size(), abi, is_argument);
897897
} else if (var_annotation == "bool" || var_annotation == "i1") {
@@ -1952,7 +1952,7 @@ class CommonVisitor : public AST::BaseVisitor<StructType> {
19521952
AST::ConstantStr_t *n = AST::down_cast<AST::ConstantStr_t>(&annotation);
19531953
ASR::symbol_t *sym = current_scope->resolve_symbol(n->m_value);
19541954
if ( sym == nullptr || !ASR::is_a<ASR::Struct_t>(*sym) ) {
1955-
throw SemanticError("Only StructType implemented for con"
1955+
throw SemanticError("Only StructType implemented for constant"
19561956
" str annotation", loc);
19571957
}
19581958
//TODO: Change the returned type from Class to StructType
@@ -8158,7 +8158,7 @@ we will have to use something else.
81588158
ASR::expr_t* a_len = ASRUtils::EXPR(ASR::make_IntegerConstant_t(al,
81598159
loc, s_var.size(), ASRUtils::TYPE(ASR::make_Integer_t(al, loc, 8))));
81608160
ASR::ttype_t *str_type = ASRUtils::TYPE(ASR::make_String_t(al, loc,
8161-
1, a_len, false, false, ASR::string_physical_typeType::PointerString));
8161+
-1, a_len, false, false, ASR::string_physical_typeType::PointerString));
81628162
tmp = ASR::make_StringConstant_t(al, loc, s2c(al, s_var), str_type);
81638163
}
81648164

@@ -8589,10 +8589,8 @@ we will have to use something else.
85898589
}
85908590
}
85918591
}
8592-
ASR::expr_t* a_len = ASRUtils::EXPR(ASR::make_IntegerConstant_t(al, x.base.base.loc,
8593-
0, ASRUtils::TYPE(ASR::make_Integer_t(al, x.base.base.loc, 8))));
85948592
ASR::ttype_t *type = ASRUtils::TYPE(ASR::make_String_t(
8595-
al, x.base.base.loc, -1, a_len, false, false, ASR::string_physical_typeType::PointerString));
8593+
al, x.base.base.loc, 1, nullptr, false, false, ASR::string_physical_typeType::CString));
85968594
ASR::expr_t* string_format = ASRUtils::EXPR(ASRUtils::make_StringFormat_t_util(al, x.base.base.loc,
85978595
nullptr, args_expr.p, args_expr.size(), ASR::string_format_kindType::FormatPythonFormat,
85988596
type, nullptr));

0 commit comments

Comments
 (0)