aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlon Zakai <azakai@mozilla.com>2011-01-23 18:23:44 -0800
committerAlon Zakai <azakai@mozilla.com>2011-01-23 18:23:44 -0800
commitdf10a98f50d94962596fccdcaaca0cace922e3c6 (patch)
tree8c18116189e7fb7d272075041ffa80157daf1568 /src
parent82c8f1f7a5388fc322445ed899801d6ece8ced5a (diff)
minor fixes and optimizations
Diffstat (limited to 'src')
-rw-r--r--src/jsifier.js2
-rw-r--r--src/utility.js6
2 files changed, 6 insertions, 2 deletions
diff --git a/src/jsifier.js b/src/jsifier.js
index e93467c3..c64c2ced 100644
--- a/src/jsifier.js
+++ b/src/jsifier.js
@@ -205,7 +205,7 @@ function JSify(data, functionsOnly, givenTypes, givenFunctions, givenGlobalVaria
} else if (value.text && value.text[0] == '"') {
value.text = value.text.substr(1, value.text.length-2);
return JSON.stringify(parseLLVMString(value.text)) +
- ' /* ' + value.text.replace(/\*/g, '_') + ' */'; // make string safe for inclusion in comment
+ ' /* ' + value.text.substr(0, 20).replace(/\*/g, '_') + ' */'; // make string safe for inclusion in comment
} else {
// Gets an array of constant items, separated by ',' tokens
function handleSegments(tokens) {
diff --git a/src/utility.js b/src/utility.js
index 6973362d..626f9978 100644
--- a/src/utility.js
+++ b/src/utility.js
@@ -204,7 +204,11 @@ function flatten(x) {
if (typeof x !== 'object') return x;
var ret = [];
for (var i = 0; i < x.length; i++) {
- ret = ret.concat(flatten(x[i]));
+ if (typeof x[i] === 'number') {
+ ret.push(x[i]);
+ } else {
+ ret = ret.concat(flatten(x[i]));
+ }
}
return ret;
}