fix small bug with byte output

This commit is contained in:
zongor 2026-07-04 20:48:55 -07:00
parent 6fb3f2d6a6
commit ac1278de64
4 changed files with 9 additions and 6 deletions

View File

@ -459,7 +459,7 @@ variable_declaration(Symbol *def)
if(def) {
List_push(arena, def->args, variable, sizeof(Symbol));
} else {
emitter->emit_type(arena, code, variable, parser->depth);
emitter->emit_type(arena, code, variable, variable->scope);
parser->current_type = st;
}
} else {
@ -478,7 +478,7 @@ variable_declaration(Symbol *def)
if(match(TOKEN_EQ)) {
emitter->emit_set_value(arena, code);
expression();
emitter->emit_constant(arena, code, variable, parser->depth);
emitter->emit_constant(arena, code, variable, variable->scope);
}
consume(TOKEN_SEMICOLON);
@ -939,7 +939,7 @@ number(void)
case SYMBOL_BYTE:
case SYMBOL_U8:
case SYMBOL_I8:
emitter->emit_char(arena, code, parser->previous.start,
emitter->emit_byte(arena, code, parser->previous.start,
parser->previous.length);
break;
default:

View File

@ -25,6 +25,7 @@ It is short for "Undarsċieppan" The name comes from the Proto-West-Germanic wor
| Type | Description |
|------+-----------------------------------|
| =byte= | Character (architecture specific) |
| =char= | Character (architecture specific) |
| =u8= | exactly 8-bit unsigned int |
| =i8= | exactly 8-bit signed int |
| =u16= | exactly 16-bit unsigned int |
@ -45,7 +46,7 @@ The following is a list of global operators and their effect:
- //
- comment
- //* */
- /* */
- block comment
- !
- not

View File

@ -804,7 +804,7 @@ void
uxn_emit_byte(Arena *a, List *out, const char *str, i32 length)
{
u8 i = (u8)strtol(str, nil, 10);
sprintf(uxn_temp_strbuf, "#%04x ", i);
sprintf(uxn_temp_strbuf, "#%02x ", i);
StrBuf_append(a, out, uxn_temp_strbuf);
USED(length);
}

View File

@ -1,7 +1,9 @@
nat[6] fixed_size = [1, 2, 3, 4, 5, 0];
fixed_size[5] = 6;
if (!fixed_size[5]) {
fixed_size[5] = 6;
}
nat i = 0;
while (i < fixed_size.length) {