From bc0f67cb7d902e0fdad2d4070e196e2b4c8341b7 Mon Sep 17 00:00:00 2001 From: EagleoutIce Date: Fri, 9 Aug 2024 13:43:57 +0200 Subject: [PATCH] feat-fix: check for id markers befor checking for positions --- src/slicing/criterion/parse.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/slicing/criterion/parse.ts b/src/slicing/criterion/parse.ts index 662777f5f2..ece38d1689 100644 --- a/src/slicing/criterion/parse.ts +++ b/src/slicing/criterion/parse.ts @@ -30,14 +30,14 @@ export class CriteriaParseError extends Error { */ export function slicingCriterionToId(criterion: SingleSlicingCriterion, decorated: NormalizedAst): NodeId { let resolved: NodeId | undefined - if(criterion.includes(':')) { + if(criterion.startsWith('$')) { + resolved = normalizeIdToNumberIfPossible(criterion.substring(1)) as NodeId + } else if(criterion.includes(':')) { const [line, column] = criterion.split(':').map(c => parseInt(c)) resolved = locationToId([line, column], decorated.idMap) } else if(criterion.includes('@')) { const [line, name] = criterion.split(/@(.*)/s) // only split at first occurrence resolved = conventionalCriteriaToId(parseInt(line), name, decorated.idMap) - } else if(criterion.startsWith('$')) { - resolved = normalizeIdToNumberIfPossible(criterion.substring(1)) as NodeId } if(resolved === undefined) {