Skip to content

Commit 5a70ba0

Browse files
committed
Add getExecutableName messages to functions and methods
1 parent 34d5213 commit 5a70ba0

File tree

4 files changed

+45
-0
lines changed

4 files changed

+45
-0
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/function/PBuiltinFunction.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,17 @@ public boolean isCallable() {
175175
return true;
176176
}
177177

178+
@ExportMessage
179+
@SuppressWarnings("static-method")
180+
boolean hasExecutableName() {
181+
return true;
182+
}
183+
184+
@ExportMessage
185+
String getExecutableName() {
186+
return getName();
187+
}
188+
178189
@Override
179190
@ExportMessage
180191
@SuppressWarnings("static-method")

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/function/PFunction.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,17 @@ public boolean isCallable() {
200200
return true;
201201
}
202202

203+
@ExportMessage
204+
@SuppressWarnings("static-method")
205+
boolean hasExecutableName() {
206+
return true;
207+
}
208+
209+
@ExportMessage
210+
String getExecutableName() {
211+
return getName();
212+
}
213+
203214
@ExportMessage
204215
public SourceSection getSourceLocation() throws UnsupportedMessageException {
205216
SourceSection result = getSourceLocationDirect();

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/method/PBuiltinMethod.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,17 @@ public boolean isCallable() {
6868
return true;
6969
}
7070

71+
@ExportMessage
72+
@SuppressWarnings("static-method")
73+
boolean hasExecutableName() {
74+
return true;
75+
}
76+
77+
@ExportMessage
78+
Object getExecutableName() {
79+
return function.getName();
80+
}
81+
7182
@ExportMessage
7283
@SuppressWarnings("static-method")
7384
boolean isHashable() {

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/method/PMethod.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,18 @@ public boolean isCallable() {
7171
return true;
7272
}
7373

74+
@ExportMessage
75+
boolean hasExecutableName(
76+
@CachedLibrary("this.function") InteropLibrary lib) {
77+
return lib.hasExecutableName(function);
78+
}
79+
80+
@ExportMessage
81+
Object getExecutableName(
82+
@CachedLibrary("this.function") InteropLibrary lib) throws UnsupportedMessageException {
83+
return lib.getExecutableName(function);
84+
}
85+
7486
@ExportMessage
7587
protected SourceSection getSourceLocation(@CachedLibrary("this.function") InteropLibrary lib) throws UnsupportedMessageException {
7688
return lib.getSourceLocation(function);

0 commit comments

Comments
 (0)