Merge branch 'master' into if-element-comment-split
# Conflicts:
# CHANGELOG.md
diff --git a/CHANGELOG.md b/CHANGELOG.md
index e6daef9..3383a07 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,6 +7,7 @@
* Add `--verbose` to hide advanced options in `--help` output.
* Split outer nested control flow elements (#869).
* Always place a blank line after script tags (#782).
+* Don't add unneeded splits on if elements near comments (#888).
# 1.3.3
diff --git a/lib/src/source_visitor.dart b/lib/src/source_visitor.dart
index 0214e98..aa74036 100644
--- a/lib/src/source_visitor.dart
+++ b/lib/src/source_visitor.dart
@@ -1899,7 +1899,7 @@
// Wrap the whole thing in a single rule. If a split happens inside the
// condition or the then clause, we want the then and else clauses to split.
- builder.startRule();
+ builder.startLazyRule();
var hasInnerControlFlow = false;
for (var element in ifElements) {
diff --git a/test/regression/0800/0888.unit b/test/regression/0800/0888.unit
new file mode 100644
index 0000000..98025a8
--- /dev/null
+++ b/test/regression/0800/0888.unit
@@ -0,0 +1,85 @@
+>>>
+main() {
+ final args = [
+ if (_configuration.useBlobs) ...[
+ "--snapshot-kind=app-aot-blobs",
+ "--blobs_container_filename=$tempDir/out.aotsnapshot"
+ ] else if (_configuration.useElf) ...[
+ "--snapshot-kind=app-aot-elf",
+ "--elf=$tempDir/out.aotsnapshot"
+ ] else ...[
+ "--snapshot-kind=app-aot-assembly",
+ "--assembly=$tempDir/out.S"
+ ],
+ if (_isAndroid && _isArm) '--no-sim-use-hardfp',
+ if (_configuration.isMinified) '--obfuscate',
+ if (_configuration.useQemu) '--no-use-integer-division',
+ ..._replaceDartFiles(arguments, tempKernelFile(tempDir)),
+ ];
+
+ final args2 = [
+ if (_configuration.useBlobs) ...[
+ "--snapshot-kind=app-aot-blobs",
+ "--blobs_container_filename=$tempDir/out.aotsnapshot"
+ ] else if (_configuration.useElf) ...[
+ "--snapshot-kind=app-aot-elf",
+ "--elf=$tempDir/out.aotsnapshot"
+ ] else ...[
+ "--snapshot-kind=app-aot-assembly",
+ "--assembly=$tempDir/out.S"
+ ],
+ if (_isAndroid && _isArm)
+ '--no-sim-use-hardfp',
+ if (_configuration.isMinified)
+ '--obfuscate',
+ // The SIMARM precompiler assumes support for integer division, but the
+ // Qemu arm cpus do not support integer division.
+ if (_configuration.useQemu)
+ '--no-use-integer-division',
+ ..._replaceDartFiles(arguments, tempKernelFile(tempDir)),
+ ];
+
+ print(args);
+ print(args2);
+}
+<<<
+main() {
+ final args = [
+ if (_configuration.useBlobs) ...[
+ "--snapshot-kind=app-aot-blobs",
+ "--blobs_container_filename=$tempDir/out.aotsnapshot"
+ ] else if (_configuration.useElf) ...[
+ "--snapshot-kind=app-aot-elf",
+ "--elf=$tempDir/out.aotsnapshot"
+ ] else ...[
+ "--snapshot-kind=app-aot-assembly",
+ "--assembly=$tempDir/out.S"
+ ],
+ if (_isAndroid && _isArm) '--no-sim-use-hardfp',
+ if (_configuration.isMinified) '--obfuscate',
+ if (_configuration.useQemu) '--no-use-integer-division',
+ ..._replaceDartFiles(arguments, tempKernelFile(tempDir)),
+ ];
+
+ final args2 = [
+ if (_configuration.useBlobs) ...[
+ "--snapshot-kind=app-aot-blobs",
+ "--blobs_container_filename=$tempDir/out.aotsnapshot"
+ ] else if (_configuration.useElf) ...[
+ "--snapshot-kind=app-aot-elf",
+ "--elf=$tempDir/out.aotsnapshot"
+ ] else ...[
+ "--snapshot-kind=app-aot-assembly",
+ "--assembly=$tempDir/out.S"
+ ],
+ if (_isAndroid && _isArm) '--no-sim-use-hardfp',
+ if (_configuration.isMinified) '--obfuscate',
+ // The SIMARM precompiler assumes support for integer division, but the
+ // Qemu arm cpus do not support integer division.
+ if (_configuration.useQemu) '--no-use-integer-division',
+ ..._replaceDartFiles(arguments, tempKernelFile(tempDir)),
+ ];
+
+ print(args);
+ print(args2);
+}
\ No newline at end of file