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

boolean binop reconstruction vs return #9249

Open
nadako opened this issue Mar 16, 2020 · 1 comment
Open

boolean binop reconstruction vs return #9249

nadako opened this issue Mar 16, 2020 · 1 comment
Labels
Milestone

Comments

@nadako
Copy link
Member

nadako commented Mar 16, 2020

This was reduced from a more complex binop chain, but even this simple one is not packed back into a binop. Would be nice if it would ^^

class Main {
	static function main() {}

	static function f(a:Bool, b:Bool):Bool {
		return a && b;
	}
}
Main.f = function(a,b) {
	if(a) {
		return b;
	} else {
		return false;
	}
};

This looks similar to #6302


In the "real world" code this might get quite ugly:

if(this._pulsingEffect != null && (this._image != null || !this._hasImage())) {
	if(this._doAnimate) {
		if(this._animation != null) {
			return this._animation.get_animationPlaying();
		} else {
			return false;
		}
	} else {
		return true;
	}
} else {
	return false;
}

out of this source:

return _pulsingEffect != null
	&& (_image != null || !_hasImage())
	&& (!_doAnimate || (_animation != null && _animation.animationPlaying));
@RealyUniqueName
Copy link
Member

Reproducible with 4.0.5 and 3.4.7, so it's not a regression.

@RealyUniqueName RealyUniqueName added this to the Backlog milestone Mar 17, 2020
@Simn Simn modified the milestones: Backlog, Later Mar 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants