Skip to content

Commit 2c6dc5f

Browse files
committed
Fix parsing non-cast terms to __cast__()
1 parent 31476fc commit 2c6dc5f

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/main/java/com/laytonsmith/core/functions/Compiler.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -355,9 +355,15 @@ public static ParseTree rewrite(List<ParseTree> list, boolean returnSConcat,
355355

356356
// Convert bare string or concat() to type reference if needed.
357357
ParseTree typeNode = node.getChildAt(0);
358-
ParseTree convertedTypeNode = __type_ref__.createFromBareStringOrConcats(typeNode);
359-
if(convertedTypeNode != null) {
360-
typeNode = convertedTypeNode;
358+
if(!typeNode.getData().isInstanceOf(CClassType.TYPE)) {
359+
ParseTree convertedTypeNode = __type_ref__.createFromBareStringOrConcats(typeNode);
360+
if(convertedTypeNode != null) {
361+
typeNode = convertedTypeNode;
362+
} else {
363+
364+
// This is not a "(classtype)" format. Skip node.
365+
continue;
366+
}
361367
}
362368

363369
// Rewrite p(A) and the next list entry B to __cast__(B, A).

0 commit comments

Comments
 (0)