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

Unified Diff: tools/gn/functions.h

Issue 2509333003: Change GN to disallow reading args defined in the same declare_args() call. (Closed)
Patch Set: update w/ review feedback 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
Index: tools/gn/functions.h
diff --git a/tools/gn/functions.h b/tools/gn/functions.h
index 9668658ac626922fe581e81f78eba01fdf1c4a92..0c977002285a76c0177e745606bd04f146e19547 100644
--- a/tools/gn/functions.h
+++ b/tools/gn/functions.h
@@ -416,6 +416,16 @@ Value RunFunction(Scope* scope,
// Helper functions -----------------------------------------------------------
+// Validates that the scope that a value is defined in is not the scope
+// of the current declare_args() call, if that's what we're in. It is
+// illegal to read a value from inside the same declare_args() call, since
+// the overrides will not have been applied yet (see `gn help declare_args`
+// for more).
+bool EnsureNotReadingFromSameDeclareArgs(const ParseNode* node,
+ const Scope* cur_scope,
+ const Scope* val_scope,
+ Err* err);
+
// Verifies that the current scope is not processing an import. If it is, it
// will set the error, blame the given parse node for it, and return false.
bool EnsureNotProcessingImport(const ParseNode* node,
@@ -464,7 +474,7 @@ Label MakeLabelForScope(const Scope* scope,
const FunctionCallNode* function,
const std::string& name);
-// Some tyesp of blocks can't be nested inside other ones. For such cases,
+// Some types of blocks can't be nested inside other ones. For such cases,
// instantiate this object upon entering the block and Enter() will fail if
// there is already another non-nestable block on the stack.
class NonNestableBlock {
« no previous file with comments | « tools/gn/docs/reference.md ('k') | tools/gn/functions.cc » ('j') | tools/gn/functions.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698