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

Unified Diff: tools/gn/docs/reference.md

Issue 2586073002: Revert GN declare_args() change. (Closed)
Patch Set: Created 4 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 | « no previous file | tools/gn/functions.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gn/docs/reference.md
diff --git a/tools/gn/docs/reference.md b/tools/gn/docs/reference.md
index ab3233aa4ed5f32d6e2e2bf2388477a6fc5cbea8..1aa56f1d4542e1623bb07afb7f12549834472f46 100644
--- a/tools/gn/docs/reference.md
+++ b/tools/gn/docs/reference.md
@@ -1641,9 +1641,8 @@
The precise behavior of declare args is:
- 1. The declare_args() block executes. Any variable defined in the enclosing
- scope is available for reading, but any variable defined earlier in
- the current scope is not (since the overrides haven't been applied yet).
+ 1. The declare_arg block executes. Any variables in the enclosing scope are
+ available for reading.
2. At the end of executing the block, any variables set within that scope
are saved globally as build arguments, with their current values being
@@ -1662,10 +1661,12 @@
like [], "", or -1, and after the declare_args block, call exec_script if
the value is unset by the user.
- - Because you cannot read the value of a variable defined in the same
- block, if you need to make the default value of one arg depend
- on the possibly-overridden value of another, write two separate
- declare_args() blocks:
+ - Any code inside of the declare_args block will see the default values of
+ previous variables defined in the block rather than the user-overridden
+ value. This can be surprising because you will be used to seeing the
+ overridden value. If you need to make the default value of one arg
+ dependent on the possibly-overridden value of another, write two separate
+ declare_args blocks:
declare_args() {
enable_foo = true
« no previous file with comments | « no previous file | tools/gn/functions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698