X Tutup
Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions src/jvm/clojure/lang/Compiler.java
Original file line number Diff line number Diff line change
Expand Up @@ -6559,6 +6559,8 @@ private static Expr analyzeSeq(C context, ISeq form, String name) {
try
{
Object me = macroexpand1(form);
if (me instanceof String)
me = maybeBreakString((String) me);
if(me != form)
return analyze(context, me, name);

Expand Down Expand Up @@ -7137,6 +7139,21 @@ public static ILookupThunk getLookupThunk(Object target, Keyword k){
return null; //To change body of created methods use File | Settings | File Templates.
}

static final int MAX_STR_LEN = 65535;
static Object maybeBreakString(String literal) {
if (literal.length() <= MAX_STR_LEN)
return literal;
ISeq acc = PersistentList.EMPTY;
int end = literal.length();
while (end > 0)
{
int chunk = Math.min(end, MAX_STR_LEN);
acc = acc.cons(literal.substring(end - chunk, end));
end -= chunk;
}
return acc.cons(Symbol.intern("clojure.core", "str"));
}

static void compile1(GeneratorAdapter gen, ObjExpr objx, Object form) {
Object line = lineDeref();
Object column = columnDeref();
Expand All @@ -7151,6 +7168,8 @@ static void compile1(GeneratorAdapter gen, ObjExpr objx, Object form) {
try
{
form = macroexpand(form);
if (form instanceof String)
form = maybeBreakString((String) form);
if(form instanceof IPersistentCollection && Util.equals(RT.first(form), DO))
{
for(ISeq s = RT.next(form); s != null; s = RT.next(s))
Expand Down
X Tutup