Skip to content

Remove redundant alias handling in JS compiler. NFC #17419

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
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
17 changes: 1 addition & 16 deletions src/jsifier.js
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,6 @@ function ${name}(${args}) {

const original = LibraryManager.library[ident];
let snippet = original;
let redirectedIdent = null;
const deps = LibraryManager.library[ident + '__deps'] || [];
if (!Array.isArray(deps)) {
error(`JS library directive ${ident}__deps=${deps.toString()} is of type ${typeof deps}, but it should be an array!`);
Expand All @@ -307,18 +306,7 @@ function ${name}(${args}) {
});
let isFunction = false;

if (typeof snippet == 'string') {
if (snippet[0] != '=') {
const target = LibraryManager.library[snippet];
if (target) {
// Redirection for aliases. We include the parent, and at runtime make ourselves equal to it.
// This avoid having duplicate functions with identical content.
redirectedIdent = snippet;
deps.push(snippet);
snippet = mangleCSymbolName(snippet);
}
}
} else if (typeof snippet == 'object') {
if (typeof snippet == 'object') {
snippet = stringifyWithFunctions(snippet);
addImplicitDeps(snippet, deps);
} else if (typeof snippet == 'function') {
Expand Down Expand Up @@ -349,9 +337,6 @@ function ${name}(${args}) {
}
}

if (redirectedIdent) {
deps = deps.concat(LibraryManager.library[redirectedIdent + '__deps'] || []);
}
if (VERBOSE) {
printErr(`adding ${finalName} and deps ${deps} : ` + (snippet + '').substr(0, 40));
}
Expand Down