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

Eliminate duplicate tests when function parameters are defined #2654

Merged
merged 1 commit into from
Jan 14, 2025

Conversation

fernewelten
Copy link
Contributor

Fixes #2647

When AGS code defines a parameter within a function header and a body follows then that parameter can hide or collide with global definitions. Code for these checks is already provided where the compiler processes local variable defns. So no need to duplicate the checks where the compiler processes parameter definitions – delete these checks.

This fixes a bug : These checks were even done when a function body doesn't even follow (i.e., for an import or forward declaration of a function), which is incorrect and makes for strange warnings.

Example code:

import void foo();
import void test(int foo); // Should NOT yield any warning or error

Provide googletests that demonstrate that the bug is fixed.

When a parameter is defined in a function header and a body follows then that parameter can hide or collide with global definitions. Code for these checks is already provided where the compiler processes local variable defns. No need to duplicate the checks where parameter definitions are processed.

Fixes a bug : These checks were even done when a function body doesn't follow (import or forward declaration of a function), which is incorrect.

Provide googletests that demonstrate that the bug is fixed.
@ivan-mogilko ivan-mogilko merged commit 9b23771 into adventuregamestudio:ags4 Jan 14, 2025
17 of 21 checks passed
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.

2 participants