Skip to content

Commit 536dcea

Browse files
committed
Fix PropertyNode.toString().
1 parent a6bb0d8 commit 536dcea

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

graal-js/src/com.oracle.js.parser/src/com/oracle/js/parser/ir/PropertyNode.java

+15-10
Original file line numberDiff line numberDiff line change
@@ -150,33 +150,38 @@ public <R> R accept(TranslatorNodeVisitor<? extends LexicalContext, R> visitor)
150150

151151
@Override
152152
public void toString(final StringBuilder sb, final boolean printType) {
153+
if (isStatic) {
154+
sb.append("static ");
155+
}
156+
153157
if (value != null) {
154-
if (isStatic) {
155-
sb.append("static ");
156-
}
157-
if (value instanceof FunctionNode && ((FunctionNode) value).isMethod()) {
158+
if (isClassStaticBlock()) {
159+
sb.append("{}");
160+
} else if (value instanceof FunctionNode && ((FunctionNode) value).isMethod()) {
161+
if (((FunctionNode) value).isAsync()) {
162+
sb.append("async ");
163+
}
164+
if (((FunctionNode) value).isGenerator()) {
165+
sb.append('*');
166+
}
158167
toStringKey(sb, printType);
159168
((FunctionNode) value).toStringTail(sb, printType);
160169
} else {
161170
toStringKey(sb, printType);
162171
sb.append(": ");
163172
value.toString(sb, printType);
164173
}
174+
} else if (isClassField()) {
175+
toStringKey(sb, printType);
165176
}
166177

167178
if (getter != null) {
168-
if (isStatic) {
169-
sb.append("static ");
170-
}
171179
sb.append("get ");
172180
toStringKey(sb, printType);
173181
getter.toStringTail(sb, printType);
174182
}
175183

176184
if (setter != null) {
177-
if (isStatic) {
178-
sb.append("static ");
179-
}
180185
sb.append("set ");
181186
toStringKey(sb, printType);
182187
setter.toStringTail(sb, printType);

0 commit comments

Comments
 (0)