From ef481b25dafa272bf20e77b3c1071dad3e635804 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jindra=20Pet=F8=EDk?= Date: Tue, 1 Jan 2013 21:56:02 +0100 Subject: [PATCH] AS3: precedence parentheses - call, new --- .../com/jpexs/asdec/abc/avm2/treemodel/CallTreeItem.java | 6 +++++- .../jpexs/asdec/abc/avm2/treemodel/ConstructTreeItem.java | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/CallTreeItem.java b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/CallTreeItem.java index 7a5f7afa2..f5a800d71 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/CallTreeItem.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/CallTreeItem.java @@ -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(")"); } } diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/ConstructTreeItem.java b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/ConstructTreeItem.java index 65ccff120..8c9ba8fde 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/ConstructTreeItem.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/ConstructTreeItem.java @@ -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(")"); } }