Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(133)

Unified Diff: tools/gn/format_test_data/057.golden

Issue 772663002: gn format: Make parenthesizing better (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/gn/format_test_data/057.gn ('k') | tools/gn/format_test_data/058.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gn/format_test_data/057.golden
diff --git a/tools/gn/format_test_data/057.golden b/tools/gn/format_test_data/057.golden
new file mode 100644
index 0000000000000000000000000000000000000000..d0daa6c8e72888daaddb6e2c963735229914e99b
--- /dev/null
+++ b/tools/gn/format_test_data/057.golden
@@ -0,0 +1,24 @@
+# 80 ---------------------------------------------------------------------------
+# Because there is a difference in precedence level between || and &&
+# a || b || c && d
+# is equivalent to
+# a || b || (c && d)
+# Because parens are not stored in the parse tree, the formatter recreates the
+# minimally required set to maintain meaning. However, this particular case can
+# be confusing for human readers, so we special case these ones and add
+# strictly-unnecessary parens.
+
+supports_android = is_apk || is_android_resources ||
+ (is_java_library && defined(invoker.supports_android) &&
+ invoker.supports_android)
+
+enable_one_click_signin = is_win || is_mac || (is_linux && !is_chromeos)
+enable_one_click_signin = (is_linux && !is_chromeos) || is_win || is_mac
+
+x = c || (a && b)
+x = (a && b) || c
+x = (a && b) || c
+
+x = c && (a || b)
+x = (a || b) && c
+x = a || (b && c)
« no previous file with comments | « tools/gn/format_test_data/057.gn ('k') | tools/gn/format_test_data/058.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698