| Index: tools/gn/functions.cc
|
| diff --git a/tools/gn/functions.cc b/tools/gn/functions.cc
|
| index 272cd9430bc96d82fef310a8f8ef5600cd3e2725..7ef78b5887231810b611fbd4bf3e18301fa78fbf 100644
|
| --- a/tools/gn/functions.cc
|
| +++ b/tools/gn/functions.cc
|
| @@ -737,7 +737,7 @@ const char kPool_Help[] =
|
|
|
| Variables
|
|
|
| - depth*
|
| + console, depth*
|
| * = required
|
|
|
| Example
|
| @@ -775,25 +775,41 @@ Value RunPool(const FunctionCallNode* function,
|
| if (g_scheduler->verbose_logging())
|
| g_scheduler->Log("Defining pool", label.GetUserVisibleName(true));
|
|
|
| - // Get the pool depth. It is an error to define a pool without a depth,
|
| - // so check first for the presence of the value.
|
| - const Value* depth = scope->GetValue(kDepth, true);
|
| - if (!depth) {
|
| - *err = Err(function, "Can't define a pool without depth.");
|
| - return Value();
|
| + // Create the new pool.
|
| + std::unique_ptr<Pool> pool(new Pool(scope->settings(), label));
|
| +
|
| + // Check the value of console.
|
| + const Value* console = scope->GetValue(variables::kConsole, true);
|
| + if (console) {
|
| + if (!console->VerifyTypeIs(Value::BOOLEAN, err))
|
| + return Value();
|
| }
|
|
|
| - if (!depth->VerifyTypeIs(Value::INTEGER, err))
|
| - return Value();
|
| + // Get the pool depth. Pool must hae a depth or be a console pool.
|
| + const Value* depth = scope->GetValue(kDepth, true);
|
| + if (console && console->boolean_value()) {
|
| + if (depth) {
|
| + *err = Err(function, "Can't define a console pool with depth.");
|
| + return Value();
|
| + }
|
|
|
| - if (depth->int_value() < 0) {
|
| - *err = Err(function, "depth must be positive or nul.");
|
| - return Value();
|
| - }
|
| + pool->set_console(console->boolean_value());
|
| + } else {
|
| + if (!depth) {
|
| + *err = Err(function, "Can't define a pool without depth.");
|
| + return Value();
|
| + }
|
|
|
| - // Create the new pool.
|
| - std::unique_ptr<Pool> pool(new Pool(scope->settings(), label));
|
| - pool->set_depth(depth->int_value());
|
| + if (!depth->VerifyTypeIs(Value::INTEGER, err))
|
| + return Value();
|
| +
|
| + if (depth->int_value() < 0) {
|
| + *err = Err(function, "depth must be positive or nul.");
|
| + return Value();
|
| + }
|
| +
|
| + pool->set_depth(depth->int_value());
|
| + }
|
|
|
| // Save the generated item.
|
| Scope::ItemVector* collector = scope->GetItemCollector();
|
|
|