AS3: precedence parentheses - call, new

This commit is contained in:
Jindra Petk
2013-01-01 21:56:02 +01:00
parent 1200f20414
commit ef481b25da
2 changed files with 10 additions and 2 deletions

View File

@@ -50,6 +50,10 @@ public class CallTreeItem extends TreeItem {
if (receiver instanceof ThisTreeItem) {
recPart = "";
}*/
return function.toString(constants, localRegNames, fullyQualifiedNames) + hilight("(") + args + hilight(")");
String fstr = function.toString(constants, localRegNames, fullyQualifiedNames);
if (function.precedence > precedence) {
fstr = "(" + fstr + ")";
}
return fstr + hilight("(") + args + hilight(")");
}
}

View File

@@ -44,7 +44,11 @@ public class ConstructTreeItem extends TreeItem {
if (object instanceof NewFunctionTreeItem) {
return object.toString(constants, localRegNames, fullyQualifiedNames);
}
return hilight("new ") + object.toString(constants, localRegNames, fullyQualifiedNames) + hilight("(") + argStr + hilight(")");
String obStr = object.toString(constants, localRegNames, fullyQualifiedNames);
if (object.precedence > precedence) {
obStr = "(" + obStr + ")";
}
return hilight("new ") + obStr + hilight("(") + argStr + hilight(")");
}
}