Skip to content

Commit 287b621

Browse files
authored
fix: remove duplicates from arrow function params (#213)
1 parent e8c2686 commit 287b621

File tree

2 files changed

+6
-11
lines changed

2 files changed

+6
-11
lines changed

libraries/analysis-javascript/lib/RootContext.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -66,19 +66,9 @@ export class RootContext extends FrameworkRootContext<t.Node> {
6666
protected _targetFiles: Set<string>;
6767
protected _analysisFiles: Set<string>;
6868

69-
// filePath -> id -> element
70-
protected _elementMap: Map<string, Map<string, Element>>;
71-
// filePath -> id -> relation
72-
protected _relationMap: Map<string, Map<string, Relation>>;
73-
// filePath -> id -> object
74-
protected _objectMap: Map<string, Map<string, DiscoveredObjectType>>;
75-
7669
protected _typeModel: TypeModel;
7770
protected _typePool: TypePool;
7871

79-
// Mapping: filePath -> target name -> Exports
80-
protected _exportMap: Map<string, Export[]>;
81-
8272
get targetFiles() {
8373
return this._targetFiles;
8474
}

libraries/search-javascript/lib/testcase/sampling/JavaScriptRandomSampler.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -750,7 +750,7 @@ export class JavaScriptRandomSampler extends JavaScriptTestCaseSampler {
750750
.getTypeModel()
751751
.getObjectDescription(typeId);
752752

753-
const parameters: string[] = [];
753+
let parameters: string[] = [];
754754

755755
for (const [index, name] of typeObject.parameterNames.entries()) {
756756
parameters[index] = name;
@@ -763,6 +763,11 @@ export class JavaScriptRandomSampler extends JavaScriptTestCaseSampler {
763763
}
764764
}
765765

766+
// filter duplicates
767+
parameters = parameters.filter(
768+
(item, index) => parameters.indexOf(item) === index
769+
);
770+
766771
if (typeObject.return.size === 0) {
767772
return new ArrowFunctionStatement(
768773
id,

0 commit comments

Comments
 (0)