Skip to content

Commit 71dfa19

Browse files
committed
feat-fix(dep-qry): fix collection of arguments - #1496
1 parent 643a20d commit 71dfa19

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

src/queries/catalog/dependencies-query/dependencies-query-executor.ts

+16-2
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ import { WriteFunctions } from './function-info/write-functions';
3232
import type { DependencyInfoLinkAttachedInfo, FunctionInfo } from './function-info/function-info';
3333
import { DependencyInfoLinkConstraint } from './function-info/function-info';
3434
import { CallTargets } from '../call-context-query/identify-link-to-last-call-relation';
35+
import { isValue } from '../../../dataflow/eval/values/r-value';
3536
import { valueSetGuard } from '../../../dataflow/eval/values/general';
36-
import { collectStrings } from '../../../dataflow/eval/values/string/string-constants';
3737

3838
function collectNamespaceAccesses(data: BasicQueryData, libraries: LibraryInfo[]) {
3939
/* for libraries, we have to additionally track all uses of `::` and `:::`, for this we currently simply traverse all uses */
@@ -251,7 +251,21 @@ function resolveBasedOnConfig(data: BasicQueryData, vertex: DataflowGraphVertexF
251251

252252
const resolved = valueSetGuard(resolveIdToValue(argument, { environment, graph: data.dataflow.graph, full }));
253253
if(resolved) {
254-
return collectStrings(resolved.elements);
254+
const values: string[] = [];
255+
for(const value of resolved.elements) {
256+
if(!isValue(value)) {
257+
return undefined;
258+
}
259+
260+
if(value.type === 'string' && isValue(value.value)) {
261+
values.push(value.value.str);
262+
} else if(value.type === 'logical' && isValue(value.value)) {
263+
values.push(value.value.valueOf() ? 'TRUE' : 'FALSE');
264+
} else {
265+
return undefined;
266+
}
267+
}
268+
return values;
255269
}
256270
}
257271

test/functionality/dataflow/environments/resolve.test.ts

-14
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,9 @@ import { valueFromTsValue } from '../../../../src/dataflow/eval/values/general';
99
import { setFrom } from '../../../../src/dataflow/eval/values/sets/set-constants';
1010
import { Top } from '../../../../src/dataflow/eval/values/r-value';
1111

12-
// async function get(code: string) {
13-
// const result = await new PipelineExecutor(DEFAULT_DATAFLOW_PIPELINE, {
14-
// parser: new RShell(),
15-
// request: requestFromInput(code.trim())
16-
// }).allRemainingSteps();
17-
// return result;
18-
// }
19-
2012
describe('Resolve', () => {
2113
describe('ByName', () => {
2214

23-
// test('Resolve Vector', async() => {
24-
// const { dataflow } = await get('x <- c("a", "b", "c")');
25-
// const result = resolveValueOfVariable('x', dataflow.environment, dataflow.graph.idMap);
26-
// assert.equal(result, ['a', 'b', 'c']);
27-
// });
28-
2915
test(label('Locally without distracting elements', ['global-scope', 'lexicographic-scope'], ['other']), () => {
3016
const xVar = variable('x', '_1');
3117
const env = defaultEnv().defineInEnv(xVar);

0 commit comments

Comments
 (0)