mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-06-20 02:52:23 -07:00
fix ternary operators in eval; fix incorrect oplist concatentation path
This commit is contained in:
+5
-5
@@ -149,12 +149,12 @@ e_oplist_concat_in_place(E_OpList *dst, E_OpList *to_push)
|
||||
{
|
||||
if(to_push->first && dst->first)
|
||||
{
|
||||
to_push->last->next = dst->first;
|
||||
to_push->last = dst->last;
|
||||
to_push->op_count += to_push->op_count;
|
||||
to_push->encoded_size += to_push->encoded_size;
|
||||
dst->last->next = to_push->first;
|
||||
dst->last = to_push->last;
|
||||
dst->op_count += to_push->op_count;
|
||||
dst->encoded_size += to_push->encoded_size;
|
||||
}
|
||||
else if(dst->first)
|
||||
else if(!dst->first)
|
||||
{
|
||||
MemoryCopyStruct(dst, to_push);
|
||||
}
|
||||
|
||||
@@ -1800,6 +1800,8 @@ e_parse_expr_from_text_tokens__prec(Arena *arena, String8 text, E_TokenArray *to
|
||||
{
|
||||
if(token.kind == E_TokenKind_Symbol && str8_match(token_string, str8_lit("?"), 0) && 13 <= max_precedence)
|
||||
{
|
||||
it += 1;
|
||||
|
||||
// rjf: parse middle expression
|
||||
E_TokenArray middle_expr_tokens = e_token_array_make_first_opl(it, it_opl);
|
||||
E_Parse middle_expr_parse = e_parse_expr_from_text_tokens__prec(arena, text, &middle_expr_tokens, e_max_precedence);
|
||||
@@ -1845,6 +1847,9 @@ e_parse_expr_from_text_tokens__prec(Arena *arena, String8 text, E_TokenArray *to
|
||||
}
|
||||
|
||||
// rjf: build ternary
|
||||
if(atom != &e_expr_nil &&
|
||||
middle_expr_parse.expr != &e_expr_nil &&
|
||||
rhs_expr_parse.expr != &e_expr_nil)
|
||||
{
|
||||
E_Expr *lhs = atom;
|
||||
E_Expr *mhs = middle_expr_parse.expr;
|
||||
|
||||
Reference in New Issue
Block a user