Skip to content

Conditionalized chained function call #375

@Gama11

Description

@Gama11

Describe the bug

From the infamous haxe.macro.Printer:

Input file

class Main {
	static function main() {
		return s.replace("\n", "\\n").replace("\t", "\\t").replace("\r", "\\r").replace("'", "\\'").replace('"', "\\\"") #if sys .replace("\x00", "\\x00") #end + delim;
	}
}

Broken output

class Main {
	static function main() {
		return s.replace("\n", "\\n").replace("\t", "\\t").replace("\r", "\\r").replace("'", "\\'").replace('"', "\\\"") #if sys
		.replace("\x00", "\\x00") #end + delim;
	}
}

Not sure what exactly the expected result here is, maybe something like this (conditional start and end kept in same line, and properly indented)?

class Main {
	static function main() {
		return s.replace("\n", "\\n").replace("\t", "\\t").replace("\r", "\\r").replace("'", "\\'").replace('"', "\\\"")
			#if sys .replace("\x00", "\\x00") #end + delim;
	}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingwrappingIncorrect or undesirable wrapping

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions