ps5: fix lsp errors

This commit is contained in:
2026-03-31 11:56:38 +02:00
parent 9fb4aa0f75
commit bdd3d3b6aa

View File

@@ -31,8 +31,8 @@ void generate_program(void)
// For each function in global_symbols, generate it using generate_function ()
bool found = false;
symbol_t *entry;
for (int i = 0; i < global_symbols->n_children; i++) {
symbol_t *sym = global_symbols->children[i];
for (int i = 0; i < global_symbols->n_symbols; i++) {
symbol_t *sym = global_symbols->symbols[i];
if (sym->type == SYMBOL_FUNCTION) {
if (!found) {
entry = sym;
@@ -89,17 +89,17 @@ static void generate_global_variables(void)
// As an example, to set aside 16 bytes and label it .myBytes, write:
// DIRECTIVE(".myBytes: .zero 16")
for (int i = 0; i < global_symbols->n_children; i++) {
symbol_t *sym = global_symbols->children[i];
for (int i = 0; i < global_symbols->n_symbols; i++) {
symbol_t *sym = global_symbols->symbols[i];
switch (sym->type) {
case SYMBOL_GLOBAL_VAR:
DIRECTIVE(".%s:\t.zero 8", sym.name);
DIRECTIVE(".%s:\t.zero 8", sym->name);
break;
case SYMBOL_GLOBAL_ARRAY:
node_t num = sym->node->children[1];
node_t *num = sym->node->children[1];
assert(num->type == NUMBER_LITERAL);
int len = num->data.number_literal * 8;
DIRECTIVE(".%s:\t.zero %d", sym.name, len);
DIRECTIVE(".%s:\t.zero %d", sym->name, len);
break;
case SYMBOL_FUNCTION:
break;
@@ -127,7 +127,7 @@ static void generate_function(symbol_t* function)
symbol_table_t *symtable = function->function_symtable;
for (int i = 0; i < symtable->n_symbols; i++) {
symbol_t *sym = symtable->children[i];
symbol_t *sym = symtable->symbols[i];
switch (sym->type) {
case SYMBOL_PARAMETER:
if (i < NUM_REGISTER_PARAMS) {
@@ -215,7 +215,7 @@ static void generate_statement(node_t* node)
node_t *child = node->children[i];
switch (child->type) {
case BLOCK:
node_t list = child->children[0];
node_t *list = child->children[0];
for (int j = 0; j < list->n_children; j++)
generate_statement(list->children[j]);
break;