summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimotej Lazar <timotej.lazar@araneo.org>2015-09-10 21:54:09 +0200
committerTimotej Lazar <timotej.lazar@araneo.org>2015-09-10 21:54:09 +0200
commit517fb5cec0dab7672cd6ce97fe72906f09125435 (patch)
tree1d7b21d2659e4e386a2f2dc16ea411745807db69
parent34d740e4d9435a954be5b683d73da6a544d7669b (diff)
Support hints with indexed messages
Add an 'indices' field with an index array to a hint object to select a particular message.
-rw-r--r--js/prolog.js10
-rw-r--r--js/python.js10
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;