Skip to content

Commit

Permalink
remove unused code (#126)
Browse files Browse the repository at this point in the history
Signed-off-by: Su Yihan <[email protected]>
  • Loading branch information
yviansu authored Dec 22, 2023
1 parent 3e3e1a9 commit ba93dc3
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 52 deletions.
42 changes: 0 additions & 42 deletions src/scope.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
10 changes: 0 additions & 10 deletions src/variable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit ba93dc3

Please sign in to comment.