Improve Static Properties
All checks were successful
CI / Build (push) Successful in 15s

This commit is contained in:
TheBrokenRail 2025-04-09 19:12:55 -04:00
parent 5a82cf22e7
commit ebee33733b
3 changed files with 9 additions and 4 deletions

View File

@ -14,3 +14,5 @@ static constexpr decltype(sizeof(T)) __real_sizeof() {
} }
template <typename T> template <typename T>
using __make_reference = T &; using __make_reference = T &;
template <typename T>
using __make_pointer = T *;

View File

@ -43,9 +43,12 @@ export class Property {
// A Single Static Property // A Single Static Property
export class StaticProperty extends Property { export class StaticProperty extends Property {
type(pointer: boolean) {
const parts = this.parts();
return `${INTERNAL}make_${pointer ? 'pointer' : 'reference'}<${parts.type.trim()}${parts.arrayInfo}>`;
}
// Reference // Reference
referenceDefinition(addSelf: boolean) { referenceDefinition(addSelf: boolean) {
const parts = this.parts(); return `${this.type(false)} ${addSelf ? this.prettyName() : this.name()}`;
return `${INTERNAL}make_reference<${parts.type.trim()}${parts.arrayInfo}> ${addSelf ? this.prettyName() : this.name()}`;
} }
} }

View File

@ -275,7 +275,7 @@ export class Struct {
// Static Properties // Static Properties
for (const property of this.#staticProperties) { for (const property of this.#staticProperties) {
out += `${property.referenceDefinition(true)} = *(std::remove_reference_t<decltype(${property.prettyName()})> *) ${toHex(property.offset)};\n`; out += `${property.referenceDefinition(true)} = *(${property.type(true)}) ${toHex(property.offset)};\n`;
} }
// Methods // Methods