aboutsummaryrefslogtreecommitdiff
path: root/src/parser.js
diff options
context:
space:
mode:
authoralon@honor <none@none>2010-09-06 14:14:02 -0700
committeralon@honor <none@none>2010-09-06 14:14:02 -0700
commit3c5c095e6542f6c9f56fbdce7a1bfa698a78fe34 (patch)
tree1864aaf5b5bee70cb84d0817250a23457ac25037 /src/parser.js
parent4cc594f20933435dee74046d2d10d61b1a19c5fa (diff)
fix bug with ignoring "struct... as struct
Diffstat (limited to 'src/parser.js')
-rw-r--r--src/parser.js8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/parser.js b/src/parser.js
index 568dd3a4..6da567db 100644
--- a/src/parser.js
+++ b/src/parser.js
@@ -83,8 +83,10 @@ function isStructPointerType(type) {
function isStructType(type) {
if (/^\[\d+\ x\ (.*)\]/g.test(type)) return true; // [15 x ?] blocks. Like structs
- var proof = '%struct';
- return type.substr(0, proof.length) == proof && !isPointerType(type);
+ if (isPointerType(type)) return false;
+ var proofs = ['%struct', '%"struct'];
+ return type.substr(0, proofs[0].length) == proofs[0] ||
+ type.substr(0, proofs[1].length) == proofs[1];
}
function isPointerType(type) { // TODO!
@@ -1092,6 +1094,7 @@ function analyzer(data) {
type.flatIndexes = type.fields.map(function(field) {
var curr = type.flatSize;
if (isStructType(field)) {
+ dprint('types', 'type: ' + type.name_ + ' is so far of size ' + curr + ' and has ' + field + ' which is sized ' + item.types[field].flatSize);
var size = item.types[field].flatSize;
type.flatSize += size;
sizes.push(size);
@@ -1101,6 +1104,7 @@ function analyzer(data) {
}
return curr;
});
+ dprint('types', 'type: ' + type.name_ + ' has FINAL size of ' + type.flatSize);
if (type.needsFlattening && dedup(sizes).length == 1) {
type.flatFactor = sizes[0];
}