mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-06-18 10:02:23 -07:00
support unsigned -> unsigned int; support as-style casts in expressions; pack int alias in pdb-produced rdis
This commit is contained in:
+1
-1
@@ -2222,7 +2222,7 @@ e_push_irtree_and_type_from_expr(Arena *arena, E_IRTreeAndType *root_parent, E_I
|
||||
{
|
||||
E_IRTreeAndType direct_irtree = e_push_irtree_and_type_from_expr(arena, parent, &e_default_identifier_resolution_rule, disallow_autohooks, 1, expr->first);
|
||||
result = direct_irtree;
|
||||
E_TypeKey direct_type_key = result.type_key;
|
||||
E_TypeKey direct_type_key = e_type_key_unwrap(result.type_key, E_TypeUnwrapFlag_AllDecorative);
|
||||
E_TypeKind direct_type_kind = e_type_kind_from_key(direct_type_key);
|
||||
if(e_type_kind_is_signed(direct_type_kind))
|
||||
{
|
||||
|
||||
+50
-3
@@ -859,10 +859,19 @@ e_push_parse_from_string_tokens__prec(Arena *arena, String8 text, E_TokenArray t
|
||||
e_msgf(arena, &result.msgs, E_MsgKind_MalformedInput, token.range, "Missing `)`.");
|
||||
}
|
||||
|
||||
// rjf: require type
|
||||
if(type_parse.expr == &e_expr_nil)
|
||||
{
|
||||
e_msgf(arena, &result.msgs, E_MsgKind_MalformedInput, token.range, "Expected type in `cast(...)`.");
|
||||
}
|
||||
|
||||
// rjf: fill prefix unary info
|
||||
prefix_unary_kind = E_ExprKind_Cast;
|
||||
prefix_unary_precedence = 2;
|
||||
prefix_unary_cast_expr = type_parse.expr;
|
||||
else
|
||||
{
|
||||
prefix_unary_kind = E_ExprKind_Cast;
|
||||
prefix_unary_precedence = 2;
|
||||
prefix_unary_cast_expr = type_parse.expr;
|
||||
}
|
||||
end_cast_parse:;
|
||||
}
|
||||
|
||||
@@ -1303,6 +1312,33 @@ e_push_parse_from_string_tokens__prec(Arena *arena, String8 text, E_TokenArray t
|
||||
}
|
||||
}
|
||||
|
||||
// rjf: "as" style casts
|
||||
if(token.kind == E_TokenKind_Identifier &&
|
||||
str8_match(token_string, str8_lit("as"), 0))
|
||||
{
|
||||
it += 1;
|
||||
|
||||
// rjf: parse type expression
|
||||
E_Parse type_parse = e_push_parse_from_string_tokens__prec(arena, text, e_token_array_make_first_opl(it, it_opl), e_max_precedence, 1);
|
||||
e_msg_list_concat_in_place(&result.msgs, &type_parse.msgs);
|
||||
it = type_parse.last_token;
|
||||
|
||||
// rjf: require type
|
||||
if(type_parse.expr == &e_expr_nil)
|
||||
{
|
||||
e_msgf(arena, &result.msgs, E_MsgKind_MalformedInput, token.range, "Expected type following `as`.");
|
||||
}
|
||||
|
||||
// rjf: build cast expr
|
||||
else
|
||||
{
|
||||
E_Expr *rhs = atom;
|
||||
atom = e_push_expr(arena, E_ExprKind_Cast, token.range);
|
||||
e_expr_push_child(atom, type_parse.expr);
|
||||
e_expr_push_child(atom, rhs);
|
||||
}
|
||||
}
|
||||
|
||||
// rjf: quit if this doesn't look like any patterns of postfix unary we know
|
||||
if(!is_postfix_unary)
|
||||
{
|
||||
@@ -1310,6 +1346,17 @@ e_push_parse_from_string_tokens__prec(Arena *arena, String8 text, E_TokenArray t
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////
|
||||
//- rjf: no atom, just single `unsigned` prefix unary? -> unsigned int type expr
|
||||
//
|
||||
if(atom == &e_expr_nil &&
|
||||
first_prefix_unary != 0 &&
|
||||
first_prefix_unary->kind == E_ExprKind_Unsigned)
|
||||
{
|
||||
atom = e_push_expr(arena, E_ExprKind_LeafIdentifier, first_prefix_unary->cast_type_expr->range);
|
||||
atom->string = str8_lit("int");
|
||||
}
|
||||
|
||||
////////////////////////////
|
||||
//- rjf: upgrade `atom` w/ previously parsed prefix unaries
|
||||
//
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
//
|
||||
//- urgent fixes
|
||||
// [ ] hardware breakpoints regression (global eval in ctrl)
|
||||
// [ ] native filesystem dialog, resizing raddbg window -> crash!
|
||||
//
|
||||
//- memory view
|
||||
// [ ] have smaller visible range than entire memory
|
||||
|
||||
@@ -3781,6 +3781,7 @@ p2r_convert(Arena *arena, ASYNC_Root *async_root, P2R_ConvertParams *in)
|
||||
{ "__uint8" , RDI_TypeKind_U8 , CV_BasicType_UINT8 },
|
||||
{ "__int16" , RDI_TypeKind_S16 , CV_BasicType_INT16 },
|
||||
{ "__uint16" , RDI_TypeKind_U16 , CV_BasicType_UINT16 },
|
||||
{ "int" , RDI_TypeKind_S32 , CV_BasicType_INT32 },
|
||||
{ "int32" , RDI_TypeKind_S32 , CV_BasicType_INT32 },
|
||||
{ "uint32" , RDI_TypeKind_U32 , CV_BasicType_UINT32 },
|
||||
{ "__int64" , RDI_TypeKind_S64 , CV_BasicType_INT64 },
|
||||
|
||||
Reference in New Issue
Block a user