Include a fix for #176

This commit is contained in:
dcodeIO 2018-07-19 00:01:00 +02:00
parent a1b75b69b7
commit 96411c7398

View File

@ -6575,12 +6575,13 @@ export class Compiler extends DiagnosticEmitter {
var expr: ExpressionRef; var expr: ExpressionRef;
// traverse to the first matching constructor // traverse to the top-most visible constructor
var currentClassInstance: Class | null = classInstance; var currentClassInstance: Class | null = classInstance;
var constructorInstance = classInstance.constructorInstance; var constructorInstance: Function | null = null;
while (!constructorInstance && (currentClassInstance = classInstance.base)) { do {
constructorInstance = currentClassInstance.constructorInstance; constructorInstance = currentClassInstance.constructorInstance;
} if (constructorInstance) break; // TODO: check visibility
} while (currentClassInstance = currentClassInstance.base);
// if a constructor is present, call it with a zero `this` // if a constructor is present, call it with a zero `this`
if (constructorInstance) { if (constructorInstance) {