Skip to content

Commit 688f18d

Browse files
committed
doc string has to be TruffleString
1 parent 27cf8f0 commit 688f18d

File tree

1 file changed

+4
-4
lines changed
  • graalpython/com.oracle.graal.python/src/com/oracle/graal/python/compiler

1 file changed

+4
-4
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/compiler/Compiler.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -422,15 +422,15 @@ private <T> int addObject(HashMap<T, Integer> dict, T o) {
422422
return v;
423423
}
424424

425-
private String getDocstring(StmtTy[] body) {
425+
private TruffleString getDocstring(StmtTy[] body) {
426426
if (body != null && body.length > 0) {
427427
StmtTy stmt = body[0];
428428
if (stmt instanceof StmtTy.Expr) {
429429
ExprTy expr = ((StmtTy.Expr) stmt).value;
430430
if (expr instanceof ExprTy.Constant) {
431431
Object value = ((ExprTy.Constant) expr).value;
432432
if (value instanceof String) {
433-
return (String) value;
433+
return toTruffleStringUncached((String) value);
434434
}
435435
}
436436
}
@@ -674,7 +674,7 @@ private void visitBody(StmtTy[] stmts) {
674674
// addOp(SETUP_ANNOTATIONS);
675675
}
676676
int i = 0;
677-
String docstring = getDocstring(stmts);
677+
TruffleString docstring = getDocstring(stmts);
678678
if (docstring != null) {
679679
i++;
680680
StmtTy.Expr stmt = (StmtTy.Expr) stmts[0];
@@ -1773,7 +1773,7 @@ private Void visitFunctionDef(StmtTy.FunctionDef node, boolean isAsync) {
17731773

17741774
CodeUnit code;
17751775
try {
1776-
String docString = getDocstring(node.body);
1776+
TruffleString docString = getDocstring(node.body);
17771777
addObject(unit.constants, docString == null ? PNone.NONE : docString);
17781778
visitSequence(node.body);
17791779
code = unit.assemble(flags);

0 commit comments

Comments
 (0)