Skip to content
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

Kinda fix infinite loop prevention problem #2826

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Gamer153
Copy link

The current loop prevention can fail for some weird code constructions, like this one:

function __spreadArray(to, from, pack) {
    if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
        if (ar || !(i in from)) {
            if (!ar) ar = Array.prototype.slice.call(from, 0, i);
            ar[i] = from[i];
        }
    }
    return to.concat(ar || Array.prototype.slice.call(from));
}

This happens because the node path can have multiple bodies. Typically the main block is in the last entry of the array, which is why I'm choosing the last body node as the real one.

If there are multiple body elements, always use the first one.
Copy link

vercel bot commented Jan 27, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
sprig ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 27, 2025 11:23pm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant