diff --git a/src/scope.ts b/src/scope.ts index 059f7178..bee086f5 100644 --- a/src/scope.ts +++ b/src/scope.ts @@ -535,23 +535,6 @@ export class Scope { } } - // shadow copy - copy(scope: Scope) { - scope.kind = this.kind; - scope.name = this.name; - scope.children = this.children; - scope.parent = this.parent; - scope.namedTypeMap = this.namedTypeMap; - scope.debugFilePath = this.debugFilePath; - scope.tempVarArray = this.tempVarArray; - scope.variableArray = this.variableArray; - scope.statementArray = this.statementArray; - scope.localIndex = this.localIndex; - scope.mangledName = this.mangledName; - scope.modifiers = this.modifiers; - if (this.genericOwner) scope.setGenericOwner(this.genericOwner); - } - // process generic specialization specialize(scope: Scope) { scope.kind = this.kind; @@ -587,13 +570,6 @@ export class ClosureEnvironment extends Scope { } } - copy(scope: ClosureEnvironment) { - super.copy(scope); - scope.kind = this.kind; - scope.hasFreeVar = this.hasFreeVar; - scope.contextVariable = this.contextVariable; - } - specialize(scope: ClosureEnvironment) { super.specialize(scope); scope.kind = this.kind; @@ -752,17 +728,6 @@ export class FunctionScope extends ClosureEnvironment { return this._className !== ''; } - copy(funcScope: FunctionScope) { - super.copy(funcScope); - funcScope.kind = this.kind; - funcScope.parameterArray = this.parameterArray; - funcScope.functionType = this.functionType; - funcScope._className = this._className; - funcScope.realParamCtxType = this.realParamCtxType; - funcScope.oriFuncName = this.oriFuncName; - funcScope.debugLocations = this.debugLocations; - } - specialize(funcScope: FunctionScope) { super.specialize(funcScope); funcScope.kind = this.kind; @@ -815,13 +780,6 @@ export class ClassScope extends Scope { return this._classType; } - copy(classScope: ClassScope) { - super.copy(classScope); - classScope.kind = this.kind; - classScope.name = this.name; - classScope._classType = this._classType; - } - specialize(classScope: ClassScope) { super.specialize(classScope); classScope.kind = this.kind; diff --git a/src/variable.ts b/src/variable.ts index 9b2147b8..52edd0b6 100644 --- a/src/variable.ts +++ b/src/variable.ts @@ -254,16 +254,6 @@ export class VariableScanner { if (variableType instanceof TSEnum) { variableType = variableType.memberType; } - /* Sometimes the variable's type is inferred as a TSFunction with - isDeclare == true, we need to treat it as non declare function - here to keep the same calling convention for closure */ - if ( - variableType instanceof TSFunction && - variableType.isDeclare - ) { - variableType = variableType.clone(); - (variableType as TSFunction).isDeclare = false; - } const variable = new Variable( variableName,