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

Unified Diff: tools/gn/functions.cc

Issue 1025153002: tools/gn: make defined(foo.bar) an error if !defined(foo) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 months 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gn/functions.cc
diff --git a/tools/gn/functions.cc b/tools/gn/functions.cc
index 112cf8059b60d2607aed06a659e416cbd0c225ee..b7e133550b8e5b4a0ff50b4a3e31947a53846b8d 100644
--- a/tools/gn/functions.cc
+++ b/tools/gn/functions.cc
@@ -341,9 +341,9 @@ const char kDefined_Help[] =
"\n"
" You can also check a named scope:\n"
" defined(foo.bar)\n"
- " which returns true if both foo is defined and bar is defined on the\n"
- " named scope foo. It will throw an error if foo is defined but is not\n"
- " a scope.\n"
+ " which will return true or false depending on whether bar is defined in\n"
+ " the named scope foo. It will throw an error if foo is not defined or\n"
+ " is not a scope.\n"
"\n"
"Example:\n"
"\n"
@@ -385,8 +385,10 @@ Value RunDefined(Scope* scope,
if (accessor->member()) {
// The base of the accessor must be a scope if it's defined.
const Value* base = scope->GetValue(accessor->base().value());
- if (!base)
- return Value(function, false);
+ if (!base) {
+ *err = Err(accessor, "Undefined identifier");
+ return Value();
+ }
if (!base->VerifyTypeIs(Value::SCOPE, err))
return Value();
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698