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

GDScript: Fix compilation of expressions compiling other classes #81577

Merged

Conversation

anvilfolk
Copy link
Contributor

@anvilfolk anvilfolk commented Sep 12, 2023

This PR is part of ongoing work on fixing cyclic dependency errors in the GDScript compiler. This removes another instance of the compiler triggering compilation of an external class during compilation of the current class, with bad side-effects.

Since more of the GDScript codebase now more fully depends on GDScriptCache::finish_compiling(), as it should, I also added dependencies to a couple of GDScriptCache::get_shallow_script() calls that did not set those dependencies.

Fixes #81548. Fixes #81447. Fixes #81799.

@anvilfolk anvilfolk requested a review from a team as a code owner September 12, 2023 15:15
Comment on lines 405 to 406
// Should not need to pass p_owner since analyzer will already have done it.
res = GDScriptCache::get_shallow_script(global_class_path, err, parser->script_path);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For those curious, this is the fix. The other stuff is just trying to ensure dependencies are properly added in the GDScriptCache.

This PR is part of ongoing work on fixing cyclic dependencies in the GDScript
compiler.
Copy link
Contributor

@ryanabx ryanabx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! I love small changes like this that are easy to review. Thanks for taking on cyclic dependency hell 😎
p.s. nice branch name

Copy link
Member

@akien-mga akien-mga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes are pretty self-contained and I trust @anvilfolk's work and @ryanabx's review, so this should be good to merge and test in dev5. If there are regressions, we'll spot them there :)

@anvilfolk
Copy link
Contributor Author

I'll be around to fix any more regressions! I did test this on my other cyclic dependencies tests and it worked properly. It might just be ongoing work to squash all these issues that only crop with with specific cyclic relationships and loading orders which exist in large projects.

Copy link
Member

@adamscott adamscott left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems fine to me! Let's mergeeeeee!

@akien-mga akien-mga merged commit e5ac7cf into godotengine:master Sep 16, 2023
15 checks passed
@akien-mga
Copy link
Member

Thanks!

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