diff options
author | alon@honor <none@none> | 2010-10-19 20:14:11 -0700 |
---|---|---|
committer | alon@honor <none@none> | 2010-10-19 20:14:11 -0700 |
commit | 84266fa6f9afc63d1b5a260c715ec70fddc4d156 (patch) | |
tree | 75de64496824804f6b01c0757904515402e5a256 | |
parent | 377185c933bd55a260a525d1eb8316c8ea896da1 (diff) |
cleanup discovery of block types
-rw-r--r-- | src/analyzer.js | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/analyzer.js b/src/analyzer.js index ca0ada1c..15e7b291 100644 --- a/src/analyzer.js +++ b/src/analyzer.js @@ -84,21 +84,26 @@ function analyzer(data) { if (type.length == 1) return; if (data.types[type]) return; if (['internal', 'inbounds', 'void'].indexOf(type) != -1) return; - //dprint('types', '// addType: ' + type); - var check = new RegExp(/^\[(\d+)\ x\ (.*)\]$/g).exec(type); - // 'blocks': [14 x %struct.X] etc. - if (check) { + if (isNumberType(type)) return; + + // 'blocks': [14 x %struct.X] etc. If this is a pointer, we need + // to look at the underlying type - it was not defined explicitly + // anywhere else. + var nonPointing = removeAllPointing(type); + var check = new RegExp(/^\[(\d+)\ x\ (.*)\]$/g).exec(nonPointing); + if (check && !data.types[nonPointing]) { var num = parseInt(check[1]); var subType = check[2]; - data.types[type] = { - name_: type, + data.types[nonPointing] = { + name_: nonPointing, fields: range(num).map(function() { return subType }), lineNum: '?', }; return; } + + if (isPointerType(type)) return; if (['['].indexOf(type) != -1) return; - if (isNumberType(type) || isPointerType(type)) return; data.types[type] = { name_: type, fields: [ 'i32' ], // XXX |