From 4a8da557b5878db1bcf66da32f48a0f97ca37e7a Mon Sep 17 00:00:00 2001 From: Francois-Rene Rideau Date: Fri, 10 Apr 2015 18:56:21 +0000 Subject: Skylark builtin function cleanups Clean up related to Skylark builtin functions. Replace "hidden" field of some annotations with a "documented" field (with reversed semantics). -- MOS_MIGRATED_REVID=90827020 --- .../build/lib/syntax/SkylarkSignatureProcessor.java | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'src/main/java/com/google/devtools/build/lib/syntax/SkylarkSignatureProcessor.java') diff --git a/src/main/java/com/google/devtools/build/lib/syntax/SkylarkSignatureProcessor.java b/src/main/java/com/google/devtools/build/lib/syntax/SkylarkSignatureProcessor.java index 6d7b1dbb1f..bacb78a7dc 100644 --- a/src/main/java/com/google/devtools/build/lib/syntax/SkylarkSignatureProcessor.java +++ b/src/main/java/com/google/devtools/build/lib/syntax/SkylarkSignatureProcessor.java @@ -54,8 +54,8 @@ public class SkylarkSignatureProcessor { ? null : new HashMap(); HashMap doc = new HashMap<>(); - boolean undocumented = annotation.undocumented(); - if (annotation.doc().isEmpty() && !undocumented) { + boolean documented = annotation.documented(); + if (annotation.doc().isEmpty() && documented) { throw new RuntimeException(String.format("function %s is undocumented", name)); } @@ -63,11 +63,11 @@ public class SkylarkSignatureProcessor { ? null : defaultValues.iterator(); try { for (Param param : annotation.mandatoryPositionals()) { - paramList.add(getParameter(name, param, enforcedTypes, doc, undocumented, + paramList.add(getParameter(name, param, enforcedTypes, doc, documented, /*mandatory=*/true, /*star=*/false, /*starStar=*/false, /*defaultValue=*/null)); } for (Param param : annotation.optionalPositionals()) { - paramList.add(getParameter(name, param, enforcedTypes, doc, undocumented, + paramList.add(getParameter(name, param, enforcedTypes, doc, documented, /*mandatory=*/false, /*star=*/false, /*starStar=*/false, /*defaultValue=*/getDefaultValue(param, defaultValuesIterator))); } @@ -79,22 +79,22 @@ public class SkylarkSignatureProcessor { Preconditions.checkArgument(annotation.extraPositionals().length == 1); starParam = annotation.extraPositionals()[0]; } - paramList.add(getParameter(name, starParam, enforcedTypes, doc, undocumented, + paramList.add(getParameter(name, starParam, enforcedTypes, doc, documented, /*mandatory=*/false, /*star=*/true, /*starStar=*/false, /*defaultValue=*/null)); } for (Param param : annotation.mandatoryNamedOnly()) { - paramList.add(getParameter(name, param, enforcedTypes, doc, undocumented, + paramList.add(getParameter(name, param, enforcedTypes, doc, documented, /*mandatory=*/true, /*star=*/false, /*starStar=*/false, /*defaultValue=*/null)); } for (Param param : annotation.optionalNamedOnly()) { - paramList.add(getParameter(name, param, enforcedTypes, doc, undocumented, + paramList.add(getParameter(name, param, enforcedTypes, doc, documented, /*mandatory=*/false, /*star=*/false, /*starStar=*/false, /*defaultValue=*/getDefaultValue(param, defaultValuesIterator))); } if (annotation.extraKeywords().length > 0) { Preconditions.checkArgument(annotation.extraKeywords().length == 1); paramList.add( - getParameter(name, annotation.extraKeywords()[0], enforcedTypes, doc, undocumented, + getParameter(name, annotation.extraKeywords()[0], enforcedTypes, doc, documented, /*mandatory=*/false, /*star=*/false, /*starStar=*/true, /*defaultValue=*/null)); } FunctionSignature.WithValues signature = @@ -124,7 +124,7 @@ public class SkylarkSignatureProcessor { // Then the only per-parameter information needed is a documentation string. private static Parameter getParameter( String name, Param param, Map enforcedTypes, - Map paramDoc, boolean undocumented, + Map paramDoc, boolean documented, boolean mandatory, boolean star, boolean starStar, @Nullable Object defaultValue) throws FunctionSignature.SignatureException { @@ -166,7 +166,7 @@ public class SkylarkSignatureProcessor { if (enforcedTypes != null) { enforcedTypes.put(param.name(), enforcedType); } - if (param.doc().isEmpty() && !undocumented) { + if (param.doc().isEmpty() && documented) { throw new RuntimeException(String.format("parameter %s is undocumented", name)); } if (paramDoc != null) { -- cgit v1.2.3