summaryrefslogtreecommitdiff
path: root/rule-compiler/rule-compiler.js
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2017-03-28 21:50:44 -0700
committerAdam Ierymenko <adam.ierymenko@gmail.com>2017-03-28 21:50:44 -0700
commitb95914844753060005395d51a7d9886cba8d17ca (patch)
treea4627499f176395687b7fdd96dd589906b7b75fb /rule-compiler/rule-compiler.js
parent855361b5b88297eba3e62a9bdfa3e0933b962e81 (diff)
downloadinfinitytier-b95914844753060005395d51a7d9886cba8d17ca.tar.gz
infinitytier-b95914844753060005395d51a7d9886cba8d17ca.zip
Small rule compiler fix with tag defaults.
Diffstat (limited to 'rule-compiler/rule-compiler.js')
-rw-r--r--rule-compiler/rule-compiler.js9
1 files changed, 3 insertions, 6 deletions
diff --git a/rule-compiler/rule-compiler.js b/rule-compiler/rule-compiler.js
index feb30f90..89936213 100644
--- a/rule-compiler/rule-compiler.js
+++ b/rule-compiler/rule-compiler.js
@@ -762,7 +762,7 @@ function compile(src,rules,caps,tags)
return [ tag[k][1],tag[k][2],'Duplicate tag default directive.' ];
if ((k + 1) >= tag.length)
return [ tag[k][1],tag[k][2],'Missing value for default.' ];
- dfl = tag[++k][0]||null;
+ dfl = tag[++k][0]||0;
} else if (tkeyword === 'flag') {
if ((k + 2) >= tag.length)
return [ tag[k][1],tag[k][2],'Missing tag flag name or bit index.' ];
@@ -806,7 +806,7 @@ function compile(src,rules,caps,tags)
if (id < 0)
return [ tag[0][1],tag[0][2],'Tag definition is missing a numeric ID.' ];
- if (dfl) {
+ if (dfl !== null) {
let dfl2 = enums[dfl];
if (typeof dfl2 === 'number') {
dfl = dfl2;
@@ -815,10 +815,7 @@ function compile(src,rules,caps,tags)
if (typeof dfl2 === 'number') {
dfl = dfl2;
} else {
- dfl = _parseNum(dfl)||0;
- if (dfl < 0)
- dfl = 0;
- else dfl &= 0xffffffff;
+ dfl = Math.abs(_parseNum(dfl)||0) & 0xffffffff;
}
}
}