File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed
graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change 52
52
import com .oracle .graal .python .builtins .objects .common .SequenceStorageNodes ;
53
53
import com .oracle .graal .python .builtins .objects .dict .PDict ;
54
54
import com .oracle .graal .python .builtins .objects .ints .PInt ;
55
+ import com .oracle .graal .python .builtins .objects .object .PythonObjectLibrary ;
55
56
import com .oracle .graal .python .nodes .SpecialMethodNames ;
56
57
import com .oracle .graal .python .nodes .call .special .LookupAndCallBinaryNode ;
57
58
import com .oracle .graal .python .nodes .call .special .LookupAndCallUnaryNode ;
70
71
import com .oracle .truffle .api .dsl .Specialization ;
71
72
import com .oracle .truffle .api .dsl .TypeSystemReference ;
72
73
import com .oracle .truffle .api .frame .VirtualFrame ;
74
+ import com .oracle .truffle .api .library .CachedLibrary ;
75
+
76
+ import static com .oracle .graal .python .nodes .SpecialMethodNames .__INDEX__ ;
73
77
74
78
@ CoreFunctions (defineModule = OperatorModuleBuiltins .MODULE_NAME )
75
79
public class OperatorModuleBuiltins extends PythonBuiltins {
@@ -224,4 +228,14 @@ public boolean doString(String arg1, String arg2) {
224
228
}
225
229
226
230
}
231
+
232
+ @ Builtin (name = "index" , minNumOfPositionalArgs = 1 )
233
+ @ GenerateNodeFactory
234
+ abstract static class IndexNode extends PythonUnaryBuiltinNode {
235
+ @ Specialization (limit = "getCallSiteInlineCacheMaxDepth()" )
236
+ Object asIndex (Object value ,
237
+ @ CachedLibrary (value = "value" ) PythonObjectLibrary pol ) {
238
+ return pol .asIndex (value );
239
+ }
240
+ }
227
241
}
You can’t perform that action at this time.
0 commit comments