diff options
author | 2015-04-20 14:02:40 +0000 | |
---|---|---|
committer | 2015-04-20 16:45:01 +0000 | |
commit | 59fc7f323cb55a9d2a3965fd0840f86fdecbb404 (patch) | |
tree | 6ecb2e86b4fafa9aa28a33f78e93ac95ae57ed42 /src/main/java/com/google/devtools/build/lib/packages | |
parent | f9971e6b9acb32fbb090c73d257a1b67fb688f51 (diff) |
Skylark fail function: Remove when attribute.
It appears to be unused. Use an explicit 'if' instead.
--
MOS_MIGRATED_REVID=91581070
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/packages')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/packages/MethodLibrary.java | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/packages/MethodLibrary.java b/src/main/java/com/google/devtools/build/lib/packages/MethodLibrary.java index 84775f4caa..82a2f0a3ff 100644 --- a/src/main/java/com/google/devtools/build/lib/packages/MethodLibrary.java +++ b/src/main/java/com/google/devtools/build/lib/packages/MethodLibrary.java @@ -963,26 +963,18 @@ public class MethodLibrary { }; @SkylarkBuiltin(name = "fail", - doc = "Raises an error (the execution stops), except if the <code>when</code> condition " - + "is False.", + doc = "Raises an error that cannot be intercepted.", returnType = Environment.NoneType.class, mandatoryParams = { @Param(name = "msg", type = String.class, doc = "Error message to display for the user")}, optionalParams = { @Param(name = "attr", type = String.class, - doc = "The name of the attribute that caused the error"), - @Param(name = "when", type = Boolean.class, - doc = "When False, the function does nothing. Default is True.")}) + doc = "The name of the attribute that caused the error")}) private static final Function fail = new MixedModeFunction( - "fail", ImmutableList.of("msg", "attr", "when"), 1, false) { + "fail", ImmutableList.of("msg", "attr"), 1, false) { @Override public Object call(Object[] args, FuncallExpression ast, Environment env) throws EvalException { - if (args[2] != null) { - if (!EvalUtils.toBoolean(args[2])) { - return Environment.NONE; - } - } String msg = cast(args[0], String.class, "msg", ast.getLocation()); if (args[1] != null) { msg = "attribute " + cast(args[1], String.class, "attr", ast.getLocation()) |