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

Unified Diff: tools/gn/function_foreach.cc

Issue 2481423002: Convert gn docstrings to C++11 raw strings. (Closed)
Patch Set: Fixes Created 4 years, 1 month 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/function_exec_script.cc ('k') | tools/gn/function_forward_variables_from.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gn/function_foreach.cc
diff --git a/tools/gn/function_foreach.cc b/tools/gn/function_foreach.cc
index c264e3c1ea83fdb3b6653b7166d261d7e84c2891..e94fbe6ed5bfe100742bd16e4306b3a95dbdeb2b 100644
--- a/tools/gn/function_foreach.cc
+++ b/tools/gn/function_foreach.cc
@@ -14,35 +14,36 @@ const char kForEach[] = "foreach";
const char kForEach_HelpShort[] =
"foreach: Iterate over a list.";
const char kForEach_Help[] =
- "foreach: Iterate over a list.\n"
- "\n"
- " foreach(<loop_var>, <list>) {\n"
- " <loop contents>\n"
- " }\n"
- "\n"
- " Executes the loop contents block over each item in the list,\n"
- " assigning the loop_var to each item in sequence. The loop_var will be\n"
- " a copy so assigning to it will not mutate the list.\n"
- "\n"
- " The block does not introduce a new scope, so that variable assignments\n"
- " inside the loop will be visible once the loop terminates.\n"
- "\n"
- " The loop variable will temporarily shadow any existing variables with\n"
- " the same name for the duration of the loop. After the loop terminates\n"
- " the loop variable will no longer be in scope, and the previous value\n"
- " (if any) will be restored.\n"
- "\n"
- "Example\n"
- "\n"
- " mylist = [ \"a\", \"b\", \"c\" ]\n"
- " foreach(i, mylist) {\n"
- " print(i)\n"
- " }\n"
- "\n"
- " Prints:\n"
- " a\n"
- " b\n"
- " c\n";
+ R"(foreach: Iterate over a list.
+
+ foreach(<loop_var>, <list>) {
+ <loop contents>
+ }
+
+ Executes the loop contents block over each item in the list, assigning the
+ loop_var to each item in sequence. The loop_var will be a copy so assigning
+ to it will not mutate the list.
+
+ The block does not introduce a new scope, so that variable assignments inside
+ the loop will be visible once the loop terminates.
+
+ The loop variable will temporarily shadow any existing variables with the
+ same name for the duration of the loop. After the loop terminates the loop
+ variable will no longer be in scope, and the previous value (if any) will be
+ restored.
+
+Example
+
+ mylist = [ "a", "b", "c" ]
+ foreach(i, mylist) {
+ print(i)
+ }
+
+ Prints:
+ a
+ b
+ c
+)";
Value RunForEach(Scope* scope,
const FunctionCallNode* function,
« no previous file with comments | « tools/gn/function_exec_script.cc ('k') | tools/gn/function_forward_variables_from.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698