aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-09-17 15:40:43 -0700
committerAlon Zakai <alonzakai@gmail.com>2013-09-23 14:33:24 -0700
commit131c2c41b776b4976b6b0bcd4ad890bda50d7efc (patch)
treeab80cedc89e0b32773891ffdd3c96daf1b224ef3
parente526309b0641dabab46e40c8c9ab3d94f669748c (diff)
deframeworkify jsifier:alias
-rw-r--r--src/jsifier.js29
1 files changed, 13 insertions, 16 deletions
diff --git a/src/jsifier.js b/src/jsifier.js
index 1388af7d..4a7a7c0b 100644
--- a/src/jsifier.js
+++ b/src/jsifier.js
@@ -367,22 +367,19 @@ function JSify(data, functionsOnly, givenFunctions) {
}
// alias
- substrate.addActor('Alias', {
- processItem: function(item) {
- item.intertype = 'GlobalVariableStub';
- var ret = [item];
- item.JS = 'var ' + item.ident + ';';
- // Set the actual value in a postset, since it may be a global variable. We also order by dependencies there
- Variables.globals[item.ident].targetIdent = item.value.ident;
- var value = Variables.globals[item.ident].resolvedAlias = finalizeLLVMParameter(item.value);
- if ((MAIN_MODULE || SIDE_MODULE) && isFunctionType(item.type)) {
- var target = item.value.ident;
- if (!Functions.aliases[target]) Functions.aliases[target] = [];
- Functions.aliases[target].push(item.ident);
- }
- return ret;
+ function aliasHandler(item) {
+ item.intertype = 'GlobalVariableStub';
+ itemsDict.GlobalVariableStub.push(item);
+ item.JS = 'var ' + item.ident + ';';
+ // Set the actual value in a postset, since it may be a global variable. We also order by dependencies there
+ Variables.globals[item.ident].targetIdent = item.value.ident;
+ var value = Variables.globals[item.ident].resolvedAlias = finalizeLLVMParameter(item.value);
+ if ((MAIN_MODULE || SIDE_MODULE) && isFunctionType(item.type)) {
+ var target = item.value.ident;
+ if (!Functions.aliases[target]) Functions.aliases[target] = [];
+ Functions.aliases[target].push(item.ident);
}
- });
+ }
function processLibraryFunction(snippet, ident) {
snippet = snippet.toString();
@@ -1903,7 +1900,7 @@ function JSify(data, functionsOnly, givenFunctions) {
}
sortGlobals(data.globalVariables).forEach(globalVariableHandler);
- substrate.addItems(data.aliass, 'Alias');
+ data.aliass.forEach(aliasHandler);
substrate.addItems(data.functions, 'FunctionSplitter');
}