Lines Matching refs:scope
17 #include "tools/gn/scope.h"
33 Value RunTemplateInvocation(Scope* scope,
39 if (!EnsureNotProcessingImport(invocation, scope, err))
41 Scope block_scope(scope);
42 if (!FillTargetBlockScope(scope, invocation,
52 // Now run the rule itself with that block as the current scope.
65 const Scope* scope,
67 if (scope->IsProcessingImport()) {
80 const Scope* scope,
82 if (scope->IsProcessingBuildConfig()) {
91 bool FillTargetBlockScope(const Scope* scope,
96 Scope* block_scope,
103 // Copy the target defaults, if any, into the scope we're going to execute
105 const Scope* default_scope = scope->GetTargetDefaults(target_type);
140 const Label& ToolchainLabelForScope(const Scope* scope) {
141 return scope->settings()->toolchain()->label();
144 Label MakeLabelForScope(const Scope* scope,
148 const Label& toolchain_label = ToolchainLabelForScope(scope);
160 Value RunAssert(Scope* scope,
200 Scope* scope,
203 !EnsureNotProcessingImport(function, scope, err))
206 Label label(MakeLabelForScope(scope, function, args[0].string_value()));
212 ItemTree* tree = &scope->settings()->build_settings()->item_tree();
213 Config* config = Config::GetConfig(scope->settings(), function->GetRange(),
220 ConfigValuesGenerator gen(&config->config_values(), scope,
229 tree->MarkItemDefinedLocked(scope->settings()->build_settings(), label,
243 Scope* scope,
245 // Only allow this to be called once. We use a variable in the current scope
248 if (scope->GetValue(did_declare_args_var)) {
251 Err(scope->GetValue(did_declare_args_var)->origin()->GetRange(),
256 // Find the root scope where the values will be set.
257 Scope* root = scope->mutable_containing();
258 if (!root || root->containing() || !scope->IsProcessingBuildConfig()) {
261 "root scope.");
265 // Take all variables set in the current scope as default values and put
266 // them in the parent scope. The values in the current scope are the defaults,
268 Scope::KeyValueVector values;
269 scope->GetCurrentScopeValues(&values);
277 scope->SetValue(did_declare_args_var, Value(function, 1), NULL);
285 "import: Import a file into the current scope.\n"
288 " executing the given file into the current scope.\n"
301 " The imported file's scope will be merged with the scope at the point\n"
302 " import was called. If there is a conflict (both the current scope and\n"
314 Value RunImport(Scope* scope,
319 !EnsureNotProcessingImport(function, scope, err))
325 scope->settings()->import_manager().DoImport(import_file, function,
326 scope, err);
336 Value RunSetDefaults(Scope* scope,
346 if (scope->GetTargetDefaults(target_type)) {
352 // Execute the block in a new scope that has a parent of the containing
353 // scope.
354 Scope block_scope(scope);
355 if (!FillTargetBlockScope(scope, function,
365 // Now copy the values set on the scope we made into the free-floating one
366 // (with no containing scope) used to hold the target defaults.
367 Scope* dest = scope->MakeTargetDefaults(target_type);
378 Value RunSetSourcesAssignmentFilter(Scope* scope,
388 scope->set_sources_assignment_filter(f.Pass());
412 Value RunPrint(Scope* scope,
500 Value RunFunction(Scope* scope,
513 scope->GetTemplate(function->function().value().as_string());
515 return RunTemplateInvocation(scope, function, args, block, rule, err);
527 scope, function, args, block, err);
536 Scope block_scope(scope);
545 return found_function->second.no_block_runner(scope, function, args, err);