diff --git a/src/method.ts b/src/method.ts index e616972..a668df2 100644 --- a/src/method.ts +++ b/src/method.ts @@ -31,7 +31,7 @@ export class Method { } // Generate Variable Definition - generateDefinition() { - return `${this.getType()} ${this.getName()};\n`; + generateDefinition(nameSuffix?: string) { + return `${this.getType()} ${this.getName()}${nameSuffix !== undefined ? nameSuffix : ''};\n`; } } \ No newline at end of file diff --git a/src/vtable.ts b/src/vtable.ts index 728e993..aaecf71 100644 --- a/src/vtable.ts +++ b/src/vtable.ts @@ -117,7 +117,7 @@ export class VTable implements Property { if (info) { const type = `${info.getType()} *`; out += `extern ${type}${info.getName()}_vtable_addr;\n`; - out += `extern ${info.generateDefinition()}`; + out += `extern ${info.generateDefinition('_non_virtual')}`; } } } @@ -152,7 +152,7 @@ export class VTable implements Property { const type = `${info.getType()} *`; init += `${INDENT}${info.getName()}_vtable_addr = (${type}) ${vtableAddress};\n`; declarations += `${type}${info.getName()}_vtable_addr;\n`; - init += `${INDENT}${info.getName()} = *${info.getName()}_vtable_addr;\n`; + init += `${INDENT}${info.getName()}_non_virtual = *${info.getName()}_vtable_addr;\n`; declarations += info.generateDefinition(); } }