//"use strict";
// Analyze intertype data. Calculates things that are necessary in order
// to do the final conversion into JavaScript later, for example,
// properties of variables, loop structures of functions, etc.
var VAR_NATIVE = 'native';
var VAR_NATIVIZED = 'nativized';
var VAR_EMULATED = 'emulated';
var ENTRY_IDENT = toNiceIdent('%0');
function cleanFunc(func) {
func.lines = func.lines.filter(function(line) { return line.intertype !== null });
func.labels.forEach(function(label) {
label.lines = label.lines.filter(function(line) { return line.intertype !== null });
});
}
// Handy sets
var BRANCH_INVOKE = set('branch', 'invoke');
var SIDE_EFFECT_CAUSERS = set('call', 'invoke', 'atomic');
// Analyzer
function analyzer(data, sidePass) {
var mainPass = !sidePass;
// Substrate
var substrate = new Substrate('Analyzer');
// Sorter
substrate.addActor('Sorter', {
processItem: function(item) {
item.items.sort(function (a, b) { return a.lineNum - b.lineNum });
this.forwardItem(item, 'Gatherer');
}
});
// Gatherer
substrate.addActor('Gatherer', {
processItem: function(item) {
// Single-liners
['globalVariable', 'functionStub', 'unparsedFunction', 'unparsedGlobals', 'unparsedTypes', 'alias'].forEach(function(intertype) {
var temp = splitter(item.items