Skip to content

Commit

Permalink
fix inherited structures
Browse files Browse the repository at this point in the history
  • Loading branch information
MESYETI committed Dec 8, 2024
1 parent 79cf9d5 commit afa5a17
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion source/app.d
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import callisto.backends.rm86;
import callisto.backends.arm64;
import callisto.backends.x86_64;

const static string appVersion = "Beta 0.12.3";
const static string appVersion = "Beta 0.12.4";

const static string usage = "
Callisto Compiler
Expand Down
10 changes: 9 additions & 1 deletion source/compiler.d
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,8 @@ class CompilerBackend {
foreach (ref member ; GetType(node.inheritsFrom).structure) {
members ~= member.name;
}

offset = GetType(node.inheritsFrom).size;
}

foreach (ref member ; node.members) {
Expand All @@ -162,7 +164,7 @@ class CompilerBackend {
memberType.ptr = member.type.ptr;

auto newMember = StructEntry(
memberType, member.name, member.array, member.size, offset
memberType, member.name, member.array, memberType.Size(), offset
);
entries ~= newMember;
members ~= member.name;
Expand All @@ -177,6 +179,12 @@ class CompilerBackend {

NewConst(format("%s.sizeOf", node.name), offset);
types ~= Type(node.name, offset, true, entries);

if (node.name == "Vector") {
foreach (ref entry ; entries) {
writeln(entry);
}
}
}

void CompileEnum(EnumNode node) {
Expand Down

0 comments on commit afa5a17

Please sign in to comment.