@@ -50,8 +50,8 @@ public class PFunction extends PythonObject {
50
50
private static final Object [] EMPTY_DEFAULTS = new Object [0 ];
51
51
private final String name ;
52
52
private final String enclosingClassName ;
53
- private final Assumption codeStableAssumption = Truffle .getRuntime ().createAssumption ("function code unchanged for " + toString ());
54
- private final Assumption defaultsStableAssumption = Truffle .getRuntime ().createAssumption ("function defaults unchanged " + toString ());
53
+ private final Assumption codeStableAssumption = Truffle .getRuntime ().createAssumption ("function code unchanged for " + getQualifiedName ());
54
+ private final Assumption defaultsStableAssumption = Truffle .getRuntime ().createAssumption ("function defaults unchanged " + getQualifiedName ());
55
55
private final PythonObject globals ;
56
56
private final PCell [] closure ;
57
57
private final boolean isStatic ;
@@ -114,6 +114,14 @@ public String getName() {
114
114
return name ;
115
115
}
116
116
117
+ public String getQualifiedName () {
118
+ if (enclosingClassName == null ) {
119
+ return name ;
120
+ } else {
121
+ return enclosingClassName + "." + name ;
122
+ }
123
+ }
124
+
117
125
public Arity getArity () {
118
126
return getCode ().getArity ();
119
127
}
@@ -133,11 +141,7 @@ public PGeneratorFunction asGeneratorFunction() {
133
141
@ Override
134
142
public final String toString () {
135
143
CompilerAsserts .neverPartOfCompilation ();
136
- if (enclosingClassName == null ) {
137
- return String .format ("PFunction %s at 0x%x" , name , hashCode ());
138
- } else {
139
- return String .format ("PFunction %s.%s at 0x%x" , enclosingClassName , name , hashCode ());
140
- }
144
+ return String .format ("PFunction %s at 0x%x" , getQualifiedName (), hashCode ());
141
145
}
142
146
143
147
public PCode getCode () {
0 commit comments