mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-06-15 06:32:02 +00:00
Changed: Spaces around ternar operators, parenthesis on ternar inside ternat
This commit is contained in:
@@ -12,7 +12,8 @@
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library.
|
||||
* License along with this library.
|
||||
*/
|
||||
package com.jpexs.decompiler.graph.model;
|
||||
|
||||
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
|
||||
@@ -51,11 +52,31 @@ public class TernarOpItem extends GraphTargetItem {
|
||||
|
||||
@Override
|
||||
public GraphTextWriter appendTo(GraphTextWriter writer, LocalData localData) throws InterruptedException {
|
||||
if (expression.getPrecedence() >= precedence){
|
||||
writer.append("(");
|
||||
}
|
||||
expression.toString(writer, localData);
|
||||
expression.toString(writer, localData);
|
||||
if (expression.getPrecedence() >= precedence){
|
||||
writer.append(")");
|
||||
}
|
||||
writer.append(" ? ");
|
||||
|
||||
if (onTrue instanceof TernarOpItem){ //ternar in ternar better in parenthesis
|
||||
writer.append("(");
|
||||
}
|
||||
onTrue.toString(writer, localData);
|
||||
onTrue.toString(writer, localData);
|
||||
if (onTrue instanceof TernarOpItem){
|
||||
writer.append(")");
|
||||
}
|
||||
writer.append(" : ");
|
||||
if (onFalse instanceof TernarOpItem){
|
||||
writer.append("(");
|
||||
}
|
||||
onFalse.toString(writer, localData);
|
||||
if (onFalse instanceof TernarOpItem){
|
||||
writer.append(")");
|
||||
}
|
||||
|
||||
return writer;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user