From 517fb5cec0dab7672cd6ce97fe72906f09125435 Mon Sep 17 00:00:00 2001 From: Timotej Lazar Date: Thu, 10 Sep 2015 21:54:09 +0200 Subject: Support hints with indexed messages Add an 'indices' field with an index array to a hint object to select a particular message. --- js/prolog.js | 10 +++++++++- js/python.js | 10 +++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/js/prolog.js b/js/prolog.js index 1d30f7c..90b1b69 100644 --- a/js/prolog.js +++ b/js/prolog.js @@ -322,8 +322,16 @@ for (i = 0; i < n; i++) { serverHint = serverHints[i]; hintDef = hintDefs[serverHint.id]; + if (serverHint.indices) { + indices = serverHint.indices + for (i = 0; i < indices.length; i++) { + hintDef = hintDef[indices[i]]; + if (!hintDef) + break; + } + } if (!hintDef) { - codeq.log.error('Undefined hint: ' + serverHint.id); + codeq.log.error('Undefined hint ' + serverHint.id + ' with indices ' + serverHint.indices); continue; } t = typeof hintDef; diff --git a/js/python.js b/js/python.js index dd346c4..d16cc72 100644 --- a/js/python.js +++ b/js/python.js @@ -274,8 +274,16 @@ for (i = 0; i < n; i++) { serverHint = serverHints[i]; hintDef = hintDefs[serverHint.id]; + if (serverHint.indices) { + indices = serverHint.indices + for (i = 0; i < indices.length; i++) { + hintDef = hintDef[indices[i]]; + if (!hintDef) + break; + } + } if (!hintDef) { - codeq.log.error('Undefined hint: ' + serverHint.id); + codeq.log.error('Undefined hint ' + serverHint.id + ' with indices ' + serverHint.indices); continue; } t = typeof hintDef; -- cgit v1.2.1