aboutsummaryrefslogtreecommitdiff
path: root/src/jsifier.js
diff options
context:
space:
mode:
authoralon@honor <none@none>2010-10-20 23:27:59 -0700
committeralon@honor <none@none>2010-10-20 23:27:59 -0700
commitdb0bb3be253387c481774a393aae6f1034d1a990 (patch)
tree9b5de8a02e84d531091dcfbef9136471d4579100 /src/jsifier.js
parent5f4f3fe49a065a7e5ccbc9116e8d966f37e3516a (diff)
dynamic stack allocation support; demangler test closer to passing
Diffstat (limited to 'src/jsifier.js')
-rw-r--r--src/jsifier.js9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/jsifier.js b/src/jsifier.js
index 18e1d649..d20409ea 100644
--- a/src/jsifier.js
+++ b/src/jsifier.js
@@ -612,9 +612,12 @@ function JSify(data) {
return item.ident + '.f' + item.indexes[0][0].text;
});
makeFuncLineZyme('alloca', function(item) {
- assert(typeof item.allocatedIndex === 'number'); // or, return RuntimeGenerator.stackAlloc(calcAllocatedSize(item.allocatedType, TYPES));
- if (item.allocatedSize === 0) return ''; // This will not actually be shown - it's nativized
- return getFastValue('__stackBase__', '+', item.allocatedIndex.toString());
+ if (typeof item.allocatedIndex === 'number') {
+ if (item.allocatedSize === 0) return ''; // This will not actually be shown - it's nativized
+ return getFastValue('__stackBase__', '+', item.allocatedIndex.toString());
+ } else {
+ return RuntimeGenerator.stackAlloc(getFastValue(calcAllocatedSize(item.allocatedType, TYPES), '*', item.allocatedNum));
+ }
});
makeFuncLineZyme('phi', function(item) {
return '__lastLabel__ == ' + getLabelId(item.label1) + ' ? ' + toNiceIdent(item.value1) + ' : ' + toNiceIdent(item.value2);