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 += this.#generateProperties();
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`;
// Sanity Check Offsets
@ -235,11 +241,6 @@ export class Struct {
out += assertSize(this.#name, this.#size);
}
// Allocation Function
if (this.#size !== null) {
out += `${this.#name} *alloc_${this.#name}();\n`;
}
// Return
return out;
}
@ -272,13 +273,6 @@ export class Struct {
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 {functions: declarations, init};
}