Fix partial function prototypes not sharing their instances

This also made it necessary to extend the internal per-function instances map by one level for the respective class instance key so functions on differnt class instances with the same own type arguments don't collide.
This commit is contained in:
dcodeIO
2018-12-01 19:46:10 +01:00
parent 0e33806cf6
commit 4c35dd6f7c
4 changed files with 29 additions and 17 deletions

View File

@@ -551,13 +551,15 @@ export class Compiler extends DiagnosticEmitter {
// skip prototype and export instances
case ElementKind.FUNCTION_PROTOTYPE: {
for (let instance of (<FunctionPrototype>element).instances.values()) {
let instanceName = name;
if (instance.is(CommonFlags.GENERIC)) {
let fullName = instance.internalName;
instanceName += fullName.substring(fullName.lastIndexOf("<"));
for (let instances of (<FunctionPrototype>element).instances.values()) {
for (let instance of instances.values()) {
let instanceName = name;
if (instance.is(CommonFlags.GENERIC)) {
let fullName = instance.internalName;
instanceName += fullName.substring(fullName.lastIndexOf("<"));
}
this.makeModuleExport(instanceName, instance, prefix);
}
this.makeModuleExport(instanceName, instance, prefix);
}
break;
}