@@ -2007,7 +2007,8 @@ PZip zip(VirtualFrame frame, Object cls, Object[] args,
2007
2007
}
2008
2008
2009
2009
// function(code, globals[, name[, argdefs[, closure]]])
2010
- @ Builtin (name = "function" , minNumOfPositionalArgs = 3 , maxNumOfPositionalArgs = 6 , constructsClass = PythonBuiltinClassType .PFunction , isPublic = false )
2010
+ @ Builtin (name = "function" , minNumOfPositionalArgs = 3 , parameterNames = {"$cls" , "code" , "globals" , "name" , "argdefs" ,
2011
+ "closure" }, constructsClass = PythonBuiltinClassType .PFunction , isPublic = false )
2011
2012
@ GenerateNodeFactory
2012
2013
public abstract static class FunctionNode extends PythonBuiltinNode {
2013
2014
private static final TruffleString T_LAMBDA = tsLiteral ("<lambda>" );
@@ -2038,6 +2039,14 @@ public PFunction function(@SuppressWarnings("unused") Object cls, PCode code, PD
2038
2039
return factory ().createFunction (name , code , globals , PCell .toCellArray (getObjectArrayNode .execute (closure )));
2039
2040
}
2040
2041
2042
+ @ Specialization
2043
+ public PFunction function (@ SuppressWarnings ("unused" ) Object cls , PCode code , PDict globals , @ SuppressWarnings ("unused" ) PNone name , PTuple defaultArgs ,
2044
+ @ SuppressWarnings ("unused" ) PNone closure ,
2045
+ @ Shared ("getObjectArrayNode" ) @ Cached GetObjectArrayNode getObjectArrayNode ) {
2046
+ // TODO split defaults of positional args from kwDefaults
2047
+ return factory ().createFunction (code .getName (), code , globals , getObjectArrayNode .execute (defaultArgs ), null , null );
2048
+ }
2049
+
2041
2050
@ Specialization
2042
2051
public PFunction function (@ SuppressWarnings ("unused" ) Object cls , PCode code , PDict globals , TruffleString name , PTuple defaultArgs , @ SuppressWarnings ("unused" ) PNone closure ,
2043
2052
@ Shared ("getObjectArrayNode" ) @ Cached GetObjectArrayNode getObjectArrayNode ) {
0 commit comments