feat: refactoring project

This commit is contained in:
Carlos
2024-11-23 14:56:07 -05:00
parent f0c2a50c18
commit 1c6db5818d
2351 changed files with 39323 additions and 60326 deletions

View File

@@ -107,6 +107,23 @@ export function make_sequence(orig, expressions) {
});
}
export function make_empty_function(self) {
return make_node(AST_Function, self, {
uses_arguments: false,
argnames: [],
body: [],
is_generator: false,
async: false,
variables: new Map(),
uses_with: false,
uses_eval: false,
parent_scope: null,
enclosed: [],
cname: 0,
block_scope: undefined,
});
}
export function make_node_from_constant(val, orig) {
switch (typeof val) {
case "string":
@@ -333,9 +350,9 @@ export function is_reachable(scope_node, defs) {
}
/** Check if a ref refers to the name of a function/class it's defined within */
export function is_recursive_ref(compressor, def) {
export function is_recursive_ref(tw, def) {
var node;
for (var i = 0; node = compressor.parent(i); i++) {
for (var i = 0; node = tw.parent(i); i++) {
if (node instanceof AST_Lambda || node instanceof AST_Class) {
var name = node.name;
if (name && name.definition() === def) {