Skip to content

Commit

Permalink
fix: remove duplicates from arrow function params
Browse files Browse the repository at this point in the history
  • Loading branch information
dstallenberg committed Dec 11, 2023
1 parent 5b5f655 commit cf83adb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
10 changes: 0 additions & 10 deletions libraries/analysis-javascript/lib/RootContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,19 +66,9 @@ export class RootContext extends FrameworkRootContext<t.Node> {
protected _targetFiles: Set<string>;
protected _analysisFiles: Set<string>;

// filePath -> id -> element
protected _elementMap: Map<string, Map<string, Element>>;
// filePath -> id -> relation
protected _relationMap: Map<string, Map<string, Relation>>;
// filePath -> id -> object
protected _objectMap: Map<string, Map<string, DiscoveredObjectType>>;

protected _typeModel: TypeModel;
protected _typePool: TypePool;

// Mapping: filePath -> target name -> Exports
protected _exportMap: Map<string, Export[]>;

get targetFiles() {
return this._targetFiles;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -750,7 +750,7 @@ export class JavaScriptRandomSampler extends JavaScriptTestCaseSampler {
.getTypeModel()
.getObjectDescription(typeId);

const parameters: string[] = [];
let parameters: string[] = [];

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

// filter duplicates
parameters = parameters.filter(
(item, index) => parameters.indexOf(item) === index
);

if (typeObject.return.size === 0) {
return new ArrowFunctionStatement(
id,
Expand Down

0 comments on commit cf83adb

Please sign in to comment.