Skip to content

Nested structs are not well supported #10

Open
@kopecs

Description

@kopecs

Describe the bug

Nested structs should have the same level of support as other fields, but are currently displayed just as nameless offsets, or result in a crash.

To Reproduce
See attached code.

Expected behavior
Structs should be displayed the same as all other fields, and valid code should not crash

Screenshots
If applicable, add screenshots to help explain your problem.

Code being executed

Struct containing a struct
struct X { int x; };

struct Y {
    int foo;
    struct X x;
};

int main() {
    struct Y* a = alloc(struct Y);
    a->foo = 1;
    a->x.x = 2;
    return 0;
}
Array of structs
struct X { int x; };

struct Y {
    int foo;
    struct X x;
};

int main() {
    struct Y[] a = alloc_array(struct Y, 10);
    a[0].foo = 3;
    a[0].x.x = 0;
    a[1].foo = 5;
    return 0;
}

Additional context
Not super high prio, but the crashing is not good.

Metadata

Metadata

Assignees

No one assigned

    Labels

    VM CoreChange in VM Core is neededbugSomething isn't working

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions