mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-02-10 18:57:39 +07:00
Fixed #2411
This commit is contained in:
parent
fefef3bc47
commit
02ccdd2d67
@ -71,22 +71,17 @@ public class LogicStatementProcessor extends BaseProcessor{
|
||||
|
||||
writer.addStatement("out.append(\" \")");
|
||||
writer.addStatement("out.append((($T)obj).$L$L)", c.mirror(), field.name(),
|
||||
field.mirror().toString().equals("java.lang.String") ?
|
||||
".replace(\"\\n\", \"\\\\n\")" :
|
||||
Seq.with(typeu.directSupertypes(field.mirror())).contains(t -> t.toString().contains("java.lang.Enum")) ? ".name()" :
|
||||
"");
|
||||
Seq.with(typeu.directSupertypes(field.mirror())).contains(t -> t.toString().contains("java.lang.Enum")) ? ".name()" :
|
||||
"");
|
||||
|
||||
//reading primitives, strings and enums is supported; nothing else is
|
||||
reader.addStatement("if(tokens.length > $L) result.$L = $L(tokens[$L])$L",
|
||||
reader.addStatement("if(tokens.length > $L) result.$L = $L(tokens[$L])",
|
||||
index + 1,
|
||||
field.name(),
|
||||
field.mirror().toString().equals("java.lang.String") ?
|
||||
"" : (field.tname().isPrimitive() ? field.tname().box().toString() :
|
||||
field.mirror().toString()) + ".valueOf", //if it's not a string, it must have a valueOf method
|
||||
index + 1,
|
||||
field.mirror().toString().equals("java.lang.String") ?
|
||||
".replace(\"\\\\n\", \"\\n\")" :
|
||||
""
|
||||
index + 1
|
||||
);
|
||||
|
||||
index ++;
|
||||
|
@ -96,7 +96,7 @@ public class LAssembler{
|
||||
if(c == '"'){
|
||||
inString = !inString;
|
||||
}else if(c == ' ' && !inString){
|
||||
tokens.add(line.substring(lastIdx, i).replace("\\n", "\n"));
|
||||
tokens.add(line.substring(lastIdx, i));
|
||||
lastIdx = i + 1;
|
||||
}
|
||||
}
|
||||
@ -162,7 +162,7 @@ public class LAssembler{
|
||||
|
||||
//string case
|
||||
if(symbol.startsWith("\"") && symbol.endsWith("\"")){
|
||||
return putConst("___" + symbol, symbol.substring(1, symbol.length() - 1)).id;
|
||||
return putConst("___" + symbol, symbol.substring(1, symbol.length() - 1).replace("\\n", "\n")).id;
|
||||
}
|
||||
|
||||
try{
|
||||
|
Loading…
Reference in New Issue
Block a user