From 96411c7398ad82d085005bfda9e7d20729f72bd8 Mon Sep 17 00:00:00 2001 From: dcodeIO Date: Thu, 19 Jul 2018 00:01:00 +0200 Subject: [PATCH] Include a fix for #176 --- src/compiler.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/compiler.ts b/src/compiler.ts index 8b01df00..52748a37 100644 --- a/src/compiler.ts +++ b/src/compiler.ts @@ -6575,12 +6575,13 @@ export class Compiler extends DiagnosticEmitter { var expr: ExpressionRef; - // traverse to the first matching constructor + // traverse to the top-most visible constructor var currentClassInstance: Class | null = classInstance; - var constructorInstance = classInstance.constructorInstance; - while (!constructorInstance && (currentClassInstance = classInstance.base)) { + var constructorInstance: Function | null = null; + do { 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 (constructorInstance) {