aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2011-09-01 10:50:43 -0700
committerAlon Zakai <alonzakai@gmail.com>2011-09-01 10:50:43 -0700
commit7359e3ff751c241d19f638c59f127ab73c2c7e07 (patch)
treec01238e51e7b76a8b6af386305f352e5242451d9
parentfcc9d08d9e4a7513f021952263d05f97ef997f2f (diff)
fix bugs with parsing anonymous structure types
-rw-r--r--src/analyzer.js2
-rw-r--r--src/intertyper.js1
-rw-r--r--src/parseTools.js1
-rw-r--r--src/runtime.js2
-rw-r--r--src/settings.js2
5 files changed, 5 insertions, 3 deletions
diff --git a/src/analyzer.js b/src/analyzer.js
index 8f2ea146..3384bdea 100644
--- a/src/analyzer.js
+++ b/src/analyzer.js
@@ -349,7 +349,7 @@ function analyzer(data) {
// Decision time
- var pointedType = removePointing(variable.type);
+ var pointedType = pointingLevels(variable.type) > 0 ? removePointing(variable.type) : null;
if (variable.origin == 'getelementptr') {
// Use our implementation that emulates pointers etc.
// TODO Can we perhaps nativize some of these? However to do so, we need to discover their
diff --git a/src/intertyper.js b/src/intertyper.js
index 5cdbff81..f6bf44b2 100644
--- a/src/intertyper.js
+++ b/src/intertyper.js
@@ -150,6 +150,7 @@ function intertyper(data, parseFunctions, baseLineNum) {
tokens.push(token);
token.type = '{';
token.text = '{ ' + token.text + ' }';
+ while (pointingLevels(text) > pointingLevels(token.text)) token.text += '*'; // TODO: optimize
lastToken = token;
} else {
tokens.push(token);
diff --git a/src/parseTools.js b/src/parseTools.js
index 78b88ea8..46f664b4 100644
--- a/src/parseTools.js
+++ b/src/parseTools.js
@@ -53,6 +53,7 @@ function preprocess(text, constants) {
function addPointing(type) { return type + '*' }
function removePointing(type, num) {
if (num === 0) return type;
+ assert(type.substr(type.length-(num ? num : 1)).replace(/\*/g, '') === '');
return type.substr(0, type.length-(num ? num : 1));
}
diff --git a/src/runtime.js b/src/runtime.js
index abeb0d2a..7e3c7b84 100644
--- a/src/runtime.js
+++ b/src/runtime.js
@@ -130,7 +130,7 @@ Runtime = {
size = Types.types[field].flatSize;
alignSize = Types.types[field].alignSize;
} else {
- dprint('Unclear type in struct: ' + field + ', in ' + type.name_);
+ dprint('Unclear type in struct: ' + field + ', in ' + type.name_ + ' :: ' + dump(Types.types[type.name_]));
assert(0);
}
alignSize = type.packed ? 1 : Math.min(alignSize, QUANTUM_SIZE);
diff --git a/src/settings.js b/src/settings.js
index 31acfc1a..ab532e67 100644
--- a/src/settings.js
+++ b/src/settings.js
@@ -140,7 +140,7 @@ FAKE_X86_FP80 = 0; // Replaces x86_fp80 with double. This loses precision. It is
// (which is nonportable anyhow).
// Compiler debugging options
-DEBUG_TAGS_SHOWING = ['framework', 'frameworkLines'];
+DEBUG_TAGS_SHOWING = [];
// Some useful items:
// framework
// frameworkLines