From 27ece3a22aa16efb856515e52dc55b5e56662ea5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20B=C3=BChler?= <david.buhler@cea.fr> Date: Fri, 27 Nov 2020 09:01:45 +0100 Subject: [PATCH] [ivette] Allows a multiple selection of 0 elements. --- ivette/src/frama-c/states.ts | 6 +++--- ivette/src/renderer/ASTview.tsx | 5 +++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/ivette/src/frama-c/states.ts b/ivette/src/frama-c/states.ts index 03b5165b9bb..3895ee4978f 100644 --- a/ivette/src/frama-c/states.ts +++ b/ivette/src/frama-c/states.ts @@ -648,10 +648,10 @@ function reducer(s: Selection, action: SelectionActions): Selection { return selectLocation(s, action.location); } if (isMultipleSelect(action)) { - if (action.locations.length === 0) - return s; const index = action.index > 0 ? action.index : 0; - const selection = selectLocation(s, action.locations[index]); + const selection = + action.locations.length === 0 ? s : + selectLocation(s, action.locations[index]); return { ...selection, multiple: { diff --git a/ivette/src/renderer/ASTview.tsx b/ivette/src/renderer/ASTview.tsx index 1c71fa78b83..4f50844ba06 100644 --- a/ivette/src/renderer/ASTview.tsx +++ b/ivette/src/renderer/ASTview.tsx @@ -87,15 +87,16 @@ async function studia(marker: string, info: markerInfoData, kind: access) { const request = kind === 'Reads' ? getReadsLval : getWritesLval; const data = await Server.send(request, marker); const locations = data.direct.map(([f, m]) => ({ function: f, marker: m })); + const lval = info.name; if (locations.length > 0) { - const lval = info.name; const name = `${kind} of ${lval}`; const title = `List of statements ${ (kind === 'Reads') ? 'accessing' : 'modifying' } the memory location pointed by ${lval}.`; return { name, title, locations, index: 0 }; } - return 'MULTIPLE_CLEAR'; + const name = `No ${kind.toLowerCase()} of ${lval}`; + return { name, title: '', locations: [], index: 0 }; } // -------------------------------------------------------------------------- -- GitLab