Skip to content

Commit bb32648

Browse files
committed
simplify ToDisplayString
1 parent dc4fb17 commit bb32648

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/PythonAbstractObject.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@
131131
import com.oracle.truffle.api.dsl.Cached.Shared;
132132
import com.oracle.truffle.api.dsl.CachedContext;
133133
import com.oracle.truffle.api.dsl.GenerateUncached;
134+
import com.oracle.truffle.api.dsl.ImportStatic;
134135
import com.oracle.truffle.api.dsl.ReportPolymorphism;
135136
import com.oracle.truffle.api.dsl.Specialization;
136137
import com.oracle.truffle.api.interop.ArityException;
@@ -147,7 +148,6 @@
147148
import com.oracle.truffle.api.nodes.Node;
148149
import com.oracle.truffle.api.profiles.BranchProfile;
149150
import com.oracle.truffle.api.profiles.ConditionProfile;
150-
import com.oracle.truffle.api.source.SourceSection;
151151

152152
@ExportLibrary(InteropLibrary.class)
153153
@ExportLibrary(PythonObjectLibrary.class)
@@ -1777,11 +1777,8 @@ public Class<? extends TruffleLanguage<?>> getLanguage() {
17771777
}
17781778

17791779
@ExportMessage
1780+
@ImportStatic(PythonOptions.class)
17801781
public static class ToDisplayString {
1781-
public static final boolean useRepr(PythonContext context) {
1782-
return PythonOptions.getFlag(context, PythonOptions.UseReprForPrintString);
1783-
}
1784-
17851782
@Specialization(guards = {"allowSideEffects", "builtins != null"}) // may be null during
17861783
// initialization
17871784
public static String builtin(PythonAbstractObject self, boolean allowSideEffects,
@@ -1790,7 +1787,7 @@ public static String builtin(PythonAbstractObject self, boolean allowSideEffects
17901787
@Cached ReadAttributeFromObjectNode readStr,
17911788
@Cached CallNode callNode,
17921789
@Cached CastToJavaStringNode castStr,
1793-
@Cached(value = "useRepr(context)", allowUncached = true) boolean useRepr) {
1790+
@Cached(value = "getFlag(context, UseReprForPrintString)", allowUncached = true) boolean useRepr) {
17941791
Object toStrAttr;
17951792
if (useRepr) {
17961793
toStrAttr = readStr.execute(builtins, BuiltinNames.REPR);

0 commit comments

Comments
 (0)