diff --git a/ivette/src/dome/renderer/dome.tsx b/ivette/src/dome/renderer/dome.tsx index ade2d71019d066cc7ecf28f354bf7e9d73e05ee7..51eb64b19f4f5f77a58e6cb45c3ecacd0fcfc471 100644 --- a/ivette/src/dome/renderer/dome.tsx +++ b/ivette/src/dome/renderer/dome.tsx @@ -592,7 +592,7 @@ type Serialize<A> = (a: A) => string; The hook returns the cached version of the function. */ export function useCache<K, V>(r: (k: K) => V, s?: Serialize<K>): (k: K) => V { - const [ cache ] = React.useState(new Map<string, V>()); + const { current: cache } = React.useRef(new Map<string, V>()); const serialize = React.useMemo(() => s ? s : (k: K) => `${k}`, [s]); const get = React.useCallback((k: K): V => { const id = serialize(k); diff --git a/ivette/src/frama-c/plugins/eva/ControlPoint.tsx b/ivette/src/frama-c/plugins/eva/ControlPoint.tsx deleted file mode 100644 index 10b5ddddd7073a0bb9a949f621813ff8ac93dbd5..0000000000000000000000000000000000000000 --- a/ivette/src/frama-c/plugins/eva/ControlPoint.tsx +++ /dev/null @@ -1,61 +0,0 @@ -/* ************************************************************************ */ -/* */ -/* This file is part of Frama-C. */ -/* */ -/* Copyright (C) 2007-2021 */ -/* CEA (Commissariat à l'énergie atomique et aux énergies */ -/* alternatives) */ -/* */ -/* you can redistribute it and/or modify it under the terms of the GNU */ -/* Lesser General Public License as published by the Free Software */ -/* Foundation, version 2.1. */ -/* */ -/* It is distributed in the hope that it will be useful, */ -/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ -/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ -/* GNU Lesser General Public License for more details. */ -/* */ -/* See the GNU Lesser General Public License version 2.1 */ -/* for more details (enclosed in the file licenses/LGPLv2.1). */ -/* */ -/* ************************************************************************ */ - -import React from 'react'; -import BeforeImage from './img/before.svg'; -import AfterImage from './img/after.svg'; -import ThenImage from './img/then.svg'; -import ElseImage from './img/else.svg'; - -type controlPointKind = 'before' | 'after' | 'then' | 'else'; -interface Props { kind : controlPointKind } - -function imageSource(kind: controlPointKind): string { - switch (kind) { - case 'before': return BeforeImage; - case 'after': return AfterImage; - case 'then': return ThenImage; - case 'else': return ElseImage; - } -} - -function imageTitle(kind: controlPointKind): string { - switch (kind) { - case 'before': return 'Before the selected statement'; - case 'after': return 'After the selected statement'; - case 'then': return 'Inside the "then" branch'; - case 'else': return 'Inside the "else" branch'; - } -} - -export default function ControlPoint(p: Props): JSX.Element { - return ( - <img - style={{ verticalAlign: 'middle' }} - src={imageSource(p.kind)} - height="18px" - width="18px" - title={imageTitle(p.kind)} - alt={imageTitle(p.kind)} - /> - ); -} diff --git a/ivette/src/frama-c/plugins/eva/img/after.svg b/ivette/src/frama-c/plugins/eva/img/after.svg deleted file mode 100644 index 402642a8a8cad649cff5a9e1c869b95b047b8f46..0000000000000000000000000000000000000000 Binary files a/ivette/src/frama-c/plugins/eva/img/after.svg and /dev/null differ diff --git a/ivette/src/frama-c/plugins/eva/img/before.svg b/ivette/src/frama-c/plugins/eva/img/before.svg deleted file mode 100644 index e2972eb52ae1b2cf502d3a9300d92156ada101ab..0000000000000000000000000000000000000000 Binary files a/ivette/src/frama-c/plugins/eva/img/before.svg and /dev/null differ diff --git a/ivette/src/frama-c/plugins/eva/img/else.svg b/ivette/src/frama-c/plugins/eva/img/else.svg deleted file mode 100644 index 049e435fa26a592758befa64d802f350c8bfa6af..0000000000000000000000000000000000000000 Binary files a/ivette/src/frama-c/plugins/eva/img/else.svg and /dev/null differ diff --git a/ivette/src/frama-c/plugins/eva/img/index.d.ts b/ivette/src/frama-c/plugins/eva/img/index.d.ts deleted file mode 100644 index bff94710c9150dd892467e11d1fe96335361cebb..0000000000000000000000000000000000000000 --- a/ivette/src/frama-c/plugins/eva/img/index.d.ts +++ /dev/null @@ -1 +0,0 @@ -declare module '*.svg'; diff --git a/ivette/src/frama-c/plugins/eva/img/then.svg b/ivette/src/frama-c/plugins/eva/img/then.svg deleted file mode 100644 index 862c51f3bc08572f49b8d266823d6dddb08ce86a..0000000000000000000000000000000000000000 Binary files a/ivette/src/frama-c/plugins/eva/img/then.svg and /dev/null differ diff --git a/ivette/src/frama-c/plugins/eva/valuetable.tsx b/ivette/src/frama-c/plugins/eva/valuetable.tsx index bcad18f8c8c81780811e4352c8a88527af7f7bdd..8ac37bf297b462a59fc76a6b93869b63138b7c26 100644 --- a/ivette/src/frama-c/plugins/eva/valuetable.tsx +++ b/ivette/src/frama-c/plugins/eva/valuetable.tsx @@ -835,20 +835,17 @@ class FunctionsManager { setByCallstacks(fct: string, byCallstacks: boolean): void { const infos = this.cache.get(fct); - if (!infos) return; - infos.byCallstacks = byCallstacks; + if (infos) infos.byCallstacks = byCallstacks; } setFolded(fct: string, folded: boolean): void { const infos = this.cache.get(fct); - if (!infos) return; - infos.folded = folded; + if (infos) infos.folded = folded; } changeStartingCallstack(fct: string, n: number): void { const infos = this.cache.get(fct); - if (!infos) return; - infos.startingCallstack = n; + if (infos) infos.startingCallstack = n; } pin(loc: Location): void { @@ -866,21 +863,10 @@ class FunctionsManager { this.getInfos(fct).track(target); } - status(loc?: Location): MarkerStatus | undefined { - if (!loc) return undefined; - const infos = this.cache.get(loc.fct); - if (infos?.pinned.has(loc.target)) - return [ 'Pinned', true ]; - else if (infos?.tracked.has(loc.target)) - return [ 'Tracked', true ]; - return 'JustFocused'; - } - removeLocation(loc: Location): void { const { target, fct } = loc; const infos = this.cache.get(fct); - if (!infos) return; - infos.delete(target); + if (infos) infos.delete(target); } delete(fct: string): void {