diff options
author | Alon Zakai <alonzakai@gmail.com> | 2011-08-14 10:53:58 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2011-08-14 10:53:58 -0700 |
commit | 0bd1db73469505d759256b5f3bd3227d41cc0a51 (patch) | |
tree | 8966b8dcca528a21cab3ffc1896bba43ec183cb2 | |
parent | c2e69e7b25755bbb4ccd290bbad358edda8ca12b (diff) |
allow walking of allocatedNum in alloca items
-rw-r--r-- | src/intertyper.js | 8 | ||||
-rw-r--r-- | src/parseTools.js | 7 |
2 files changed, 14 insertions, 1 deletions
diff --git a/src/intertyper.js b/src/intertyper.js index 95b1fcd3..232025cb 100644 --- a/src/intertyper.js +++ b/src/intertyper.js @@ -632,11 +632,17 @@ function intertyper(data, parseFunctions, baseLineNum) { } }); // 'alloca' + var allocaPossibleVars = ['allocatedNum']; substrate.addActor('Alloca', { processItem: function(item) { item.intertype = 'alloca'; item.allocatedType = item.tokens[1].text; - item.allocatedNum = (item.tokens.length > 3 && Runtime.isNumberType(item.tokens[3].text)) ? toNiceIdent(item.tokens[4].text) : 1; + if (item.tokens.length > 3 && Runtime.isNumberType(item.tokens[3].text)) { + item.allocatedNum = toNiceIdent(item.tokens[4].text); + item.possibleVars = allocaPossibleVars; + } else { + item.allocatedNum = 1; + } item.type = addPointing(item.tokens[1].text); // type of pointer we will get Types.needAnalysis[item.type] = 0; item.type2 = item.tokens[1].text; // value we will create, and get a pointer to diff --git a/src/parseTools.js b/src/parseTools.js index 91956cad..5c746de0 100644 --- a/src/parseTools.js +++ b/src/parseTools.js @@ -1278,6 +1278,13 @@ function walkInterdata(item, pre, post, obj) { if (walkInterdata(item.params[i], pre, post, obj)) return true; } } + if (item.possibleVars) { // other attributes that might contain interesting data; here, variables + var box = { intertype: 'value', ident: '' }; + for (i = 0; i <= item.possibleVars.length; i++) { + box.ident = item[item.possibleVars[i]]; + if (walkInterdata(box, pre, post, obj)) return true; + } + } return post(item, originalObj, obj); } |