Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions linker.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,16 +70,22 @@ var findLinkReferences = function (bytecode) {
// trim trailing underscores
// NOTE: this has no way of knowing if the trailing underscore was part of the name
var libraryName = found[1].replace(/_+$/gm, '');
var fileName = libraryName;
var nameExtraction = /(.*):(.*)/.exec(libraryName);
if (nameExtraction) {
fileName = nameExtraction[1];
libraryName = nameExtraction[2];
}

if (!linkReferences[libraryName]) {
linkReferences[libraryName] = [];
if (!linkReferences[fileName]) {
linkReferences[fileName] = {};
}

linkReferences[libraryName].push({
linkReferences[fileName][libraryName] = {
// offsets are in bytes in binary representation (and not hex)
start: (offset + start) / 2,
length: 20
});
};

offset += start + 20;

Expand Down