Remove alloc_*() Functions

This commit is contained in:
TheBrokenRail 2024-05-17 00:36:06 -04:00
parent eca52455c3
commit 603010e3cc

View File

@ -220,6 +220,12 @@ export class Struct {
out += `struct ${this.#name} {\n`; out += `struct ${this.#name} {\n`;
out += this.#generateProperties(); out += this.#generateProperties();
out += this.#generateMethods(); out += this.#generateMethods();
if (this.#size === null) {
// Prevent Manually Copying/Allocating Structure With Undefined
out += `${INDENT}${this.#name}() = delete;\n`;
out += `${INDENT}${this.#name}(const ${this.#name} &) = delete;\n`;
out += `${INDENT}${this.#name} &operator=(const ${this.#name} &) = delete;\n`;
}
out += `};\n`; out += `};\n`;
// Sanity Check Offsets // Sanity Check Offsets
@ -235,11 +241,6 @@ export class Struct {
out += assertSize(this.#name, this.#size); out += assertSize(this.#name, this.#size);
} }
// Allocation Function
if (this.#size !== null) {
out += `${this.#name} *alloc_${this.#name}();\n`;
}
// Return // Return
return out; return out;
} }
@ -272,13 +273,6 @@ export class Struct {
init += vtable.init; init += vtable.init;
} }
// Allocation Function
if (this.#size !== null) {
declarations += `${this.#name} *alloc_${this.#name}() {\n`;
declarations += `${INDENT}return new ${this.#name};\n`;
declarations += '}\n';
}
// Return // Return
return {functions: declarations, init}; return {functions: declarations, init};
} }