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

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

Issue 2630983002: Reland "Change GN to disallow reading args defined in the same..." (Closed)
Patch Set: Created 3 years, 11 months 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 034a112cef33a4f0f38d7e981d0bebf247c48b20..d27db443e34e49633fe4ab2c8c18fd7e121c1102 100644
--- a/tools/gn/docs/reference.md
+++ b/tools/gn/docs/reference.md
@@ -1641,8 +1641,9 @@
The precise behavior of declare args is:
- 1. The declare_arg block executes. Any variables in the enclosing scope are
- available for reading.
+ 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).
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
@@ -1661,12 +1662,10 @@
like [], "", or -1, and after the declare_args block, call exec_script if
the value is unset by the user.
- - 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:
+ - 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:
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