| Index: tools/gn/template.cc
|
| diff --git a/tools/gn/template.cc b/tools/gn/template.cc
|
| index 3c4d76dafaef69bfa1d943fb163656ee448fc2c9..e865264174a1740c7fe8a9821dd8d18f5764b84c 100644
|
| --- a/tools/gn/template.cc
|
| +++ b/tools/gn/template.cc
|
| @@ -12,6 +12,7 @@
|
| #include "tools/gn/scope.h"
|
| #include "tools/gn/scope_per_file_provider.h"
|
| #include "tools/gn/value.h"
|
| +#include "tools/gn/variables.h"
|
|
|
| Template::Template(const Scope* scope, const FunctionCallNode* def)
|
| : closure_(scope->MakeClosure()),
|
| @@ -77,14 +78,14 @@ Value Template::Invoke(Scope* scope,
|
| // Scope.SetValue will copy the value which will in turn copy the scope, but
|
| // if we instead create a value and then set the scope on it, the copy can
|
| // be avoided.
|
| - const char kInvoker[] = "invoker";
|
| - template_scope.SetValue(kInvoker, Value(nullptr, std::unique_ptr<Scope>()),
|
| - invocation);
|
| - Value* invoker_value = template_scope.GetMutableValue(kInvoker, false);
|
| + template_scope.SetValue(variables::kInvoker,
|
| + Value(nullptr, std::unique_ptr<Scope>()), invocation);
|
| + Value* invoker_value =
|
| + template_scope.GetMutableValue(variables::kInvoker, false);
|
| invoker_value->SetScopeValue(std::move(invocation_scope));
|
| template_scope.set_source_dir(scope->GetSourceDir());
|
|
|
| - const base::StringPiece target_name("target_name");
|
| + const base::StringPiece target_name(variables::kTargetName);
|
| template_scope.SetValue(target_name,
|
| Value(invocation, args[0].string_value()),
|
| invocation);
|
| @@ -107,7 +108,7 @@ Value Template::Invoke(Scope* scope,
|
| // to overwrite the value of "invoker" and free the Scope owned by the
|
| // value. So we need to look it up again and don't do anything if it doesn't
|
| // exist.
|
| - invoker_value = template_scope.GetMutableValue(kInvoker, false);
|
| + invoker_value = template_scope.GetMutableValue(variables::kInvoker, false);
|
| if (invoker_value && invoker_value->type() == Value::SCOPE) {
|
| if (!invoker_value->scope_value()->CheckForUnusedVars(err))
|
| return Value();
|
|
|