Skip to content

expressionIf detection in array comprehension #365

Closed
@Gama11

Description

@Gama11

Describe the bug

expressionIf detection seems to fail here (works if the if is prefixed with return directly):

Input file

class Main {
	static function main() {
		return [
			for (meta in node.metadata) {
				var child = node.children[meta - 1];
				if (child == null) 0 else value(child);
			}
		].sum();
	}
}

Broken output

class Main {
	static function main() {
		return [
			for (meta in node.metadata) {
				var child = node.children[meta - 1];
				if (child == null)
					0
				else
					value(child);
			}
		].sum();
	}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingsamelinebroken same line formatting

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions