Skip to content

Commit 8c88eb6

Browse files
committed
Add comment explaining validateArgumentsAfterSplat
1 parent 0df45cd commit 8c88eb6

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/parser/sst/ArgDefListBuilder.java

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,19 +40,20 @@
4040
*/
4141
package com.oracle.graal.python.parser.sst;
4242

43-
import com.oracle.graal.python.builtins.objects.function.Signature;
44-
import com.oracle.graal.python.nodes.expression.ExpressionNode;
45-
import com.oracle.graal.python.nodes.function.FunctionDefinitionNode;
46-
import com.oracle.graal.python.nodes.statement.StatementNode;
47-
import com.oracle.graal.python.parser.ScopeEnvironment;
48-
import com.oracle.graal.python.parser.ScopeInfo;
4943
import java.util.ArrayList;
5044
import java.util.HashMap;
5145
import java.util.HashSet;
5246
import java.util.List;
5347
import java.util.Map;
5448
import java.util.Set;
5549

50+
import com.oracle.graal.python.builtins.objects.function.Signature;
51+
import com.oracle.graal.python.nodes.expression.ExpressionNode;
52+
import com.oracle.graal.python.nodes.function.FunctionDefinitionNode;
53+
import com.oracle.graal.python.nodes.statement.StatementNode;
54+
import com.oracle.graal.python.parser.ScopeEnvironment;
55+
import com.oracle.graal.python.parser.ScopeInfo;
56+
5657
public final class ArgDefListBuilder {
5758

5859
private static final String SPLAT_MARKER_NAME = "*";
@@ -214,6 +215,8 @@ public boolean hasSplat() {
214215
}
215216

216217
public boolean validateArgumentsAfterSplat() {
218+
// Python requires to have named arguments following a bare '*' marker
219+
// Check that if there is '*', there are more named parameters than its position in the list
217220
return !(splatIndex > -1 && args != null && args.get(splatIndex).name == null && paramNames.size() <= splatIndex);
218221
}
219222

0 commit comments

Comments
 (0)