Remove alloc_*() Functions
This commit is contained in:
parent
eca52455c3
commit
603010e3cc
@ -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};
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user