diff options
author | 2016-06-14 10:28:31 +0000 | |
---|---|---|
committer | 2016-06-14 11:03:49 +0000 | |
commit | 014388cec904f391ce8e54d323c9e9ce527ca0eb (patch) | |
tree | 82b78efc9ae2aea2eab48d72e70c5352e77a2b25 /src/main/java/com/google/devtools/build/lib/skylarkinterface/SkylarkSignature.java | |
parent | 3dd7f269bbfd463435bfc6af3424626f15f8850c (diff) |
Use only one list of parameters for SkylarkSignature
Optional and named parameters are now specified using `defaultValue`
and `named` (and `positional`). The new structure allow for parameters
that are both named and positional (which was forbidden before).
This new structure will be used to give the @SkylarkCallable annotation
the possibility to provide named and default arguments. It should be
a functional no-op for Bazel users.
--
MOS_MIGRATED_REVID=124821455
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/skylarkinterface/SkylarkSignature.java')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/skylarkinterface/SkylarkSignature.java | 29 |
1 files changed, 4 insertions, 25 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/skylarkinterface/SkylarkSignature.java b/src/main/java/com/google/devtools/build/lib/skylarkinterface/SkylarkSignature.java index 4fc8ad1a4f..5a12ec038f 100644 --- a/src/main/java/com/google/devtools/build/lib/skylarkinterface/SkylarkSignature.java +++ b/src/main/java/com/google/devtools/build/lib/skylarkinterface/SkylarkSignature.java @@ -23,10 +23,8 @@ import java.lang.annotation.Target; * * <p>Use this annotation around a {@link com.google.devtools.build.lib.syntax.BuiltinFunction} or * a {@link com.google.devtools.build.lib.syntax.BuiltinFunction.Factory}. The annotated function - * should expect the arguments described by {@link #parameters()}, - * {@link #optionalPositionals()}, {@link #extraPositionals()}, {@link #mandatoryNamedOnly()}, - * {@link #optionalNamedOnly()} and {@link #extraKeywords()}. It should also expect the following - * extraneous arguments: + * should expect the arguments described by {@link #parameters()}, {@link #extraPositionals()}, + * and {@link #extraKeywords()}. It should also expect the following extraneous arguments: * * <ul> * <li> @@ -60,28 +58,9 @@ public @interface SkylarkSignature { String doc() default ""; /** - * List of mandatory positional parameters for calling this method. These parameters have - * to be placed first in the list of arguments when calling that method. + * List of parameters for calling this method. Named only parameters are expected to be last. */ - Param[] mandatoryPositionals() default {}; - - /** - * List of optional positional parameters for calling this method. These parameters have - * to be placed before any named parameters when calling the method. - */ - Param[] optionalPositionals() default {}; - - /** - * List of optional named parameters for calling this method. These parameters can be specified - * in the list of arguments using the <code>key=value</code> format in calling the method. - */ - Param[] optionalNamedOnly() default {}; - - /** - * List of mandatory named parameters for calling this method. These parameters must be specified - * in the list of arguments using the <code>key=value</code> format in calling the method. - */ - Param[] mandatoryNamedOnly() default {}; + Param[] parameters() default {}; /** * Defines a catch all positional parameters. By default, it is an error to define more |