aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/syntax/MethodLibrary.java
diff options
context:
space:
mode:
authorGravatar Jon Brandvein <brandjon@google.com>2016-07-26 13:04:10 +0000
committerGravatar Damien Martin-Guillerez <dmarting@google.com>2016-07-27 11:12:58 +0000
commitad81cffc9d9c6234fe22c19bd26523313a82d554 (patch)
tree040c08c6a2980da22cc9234bd0b53d1b4c23845f /src/main/java/com/google/devtools/build/lib/syntax/MethodLibrary.java
parent0c8bbc913a4e2c8c02898b7358d4a4c421801795 (diff)
Make 3-arg form of getattr() work when third arg is None
-- MOS_MIGRATED_REVID=128463789
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/syntax/MethodLibrary.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/syntax/MethodLibrary.java4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/syntax/MethodLibrary.java b/src/main/java/com/google/devtools/build/lib/syntax/MethodLibrary.java
index 59690f4b16..f103211379 100644
--- a/src/main/java/com/google/devtools/build/lib/syntax/MethodLibrary.java
+++ b/src/main/java/com/google/devtools/build/lib/syntax/MethodLibrary.java
@@ -2120,7 +2120,7 @@ public class MethodLibrary {
parameters = {
@Param(name = "x", doc = "The struct whose attribute is accessed."),
@Param(name = "name", doc = "The name of the struct attribute."),
- @Param(name = "default", defaultValue = "None",
+ @Param(name = "default", defaultValue = "unbound",
doc = "The default value to return in case the struct "
+ "doesn't have an attribute of the given name.")},
useLocation = true, useEnvironment = true)
@@ -2133,7 +2133,7 @@ public class MethodLibrary {
// 'Real' describes methods with structField() == false. Because DotExpression.eval returned
// null in this case, we know that structField() cannot return true.
boolean isRealMethod = hasMethod(obj, name, loc);
- if (defaultValue != Runtime.NONE && !isRealMethod) {
+ if (defaultValue != Runtime.UNBOUND && !isRealMethod) {
return defaultValue;
}
throw new EvalException(loc, Printer.format("Object of type '%s' has no attribute %r%s",