summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authormdempsky <mdempsky@chromium.org>2015-03-23 11:14:21 -0700
committerCommit bot <commit-bot@chromium.org>2015-03-23 18:14:59 +0000
commit365796868448a3983a5831abdc37f67588390dde (patch)
tree37f68a5e4b51e63082f93d1fc79975389ecb134e /tools
parent1e9f61ce03c1d2862e154cfd46c10859d00fb755 (diff)
downloadchromium_src-365796868448a3983a5831abdc37f67588390dde.zip
chromium_src-365796868448a3983a5831abdc37f67588390dde.tar.gz
chromium_src-365796868448a3983a5831abdc37f67588390dde.tar.bz2
tools/gn: make defined(foo.bar) an error if !defined(foo)
Users must now write "defined(foo) && defined(foo.bar)" if they want the old semantics. No Chromium BUILD.gn files were harmed in the making of this CL. Review URL: https://codereview.chromium.org/1025153002 Cr-Commit-Position: refs/heads/master@{#321808}
Diffstat (limited to 'tools')
-rw-r--r--tools/gn/functions.cc12
1 files changed, 7 insertions, 5 deletions
diff --git a/tools/gn/functions.cc b/tools/gn/functions.cc
index 112cf80..b7e1335 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();