diff --git a/CHANGELOG.md b/CHANGELOG.md index db6e22bf6..620322361 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,7 @@ All notable changes to this project will be documented in this file. - AS2 - class detection - ignore standalone directvalues - AS1/2 - obfuscated name in forin cannot use eval - Ternar visit (can cause invalid reg declarations) +- AS1/2 - typeof precedence / parenthesis ## [14.6.0] - 2021-11-22 ### Added diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/TypeOfActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/TypeOfActionItem.java index 0586e32a9..37700e0eb 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/TypeOfActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/TypeOfActionItem.java @@ -38,14 +38,21 @@ import java.util.Set; public class TypeOfActionItem extends ActionItem { public TypeOfActionItem(GraphSourceItem instruction, GraphSourceItem lineStartIns, GraphTargetItem value) { - super(instruction, lineStartIns, PRECEDENCE_PRIMARY, value); + super(instruction, lineStartIns, PRECEDENCE_UNARY, value); } @Override public GraphTextWriter appendTo(GraphTextWriter writer, LocalData localData) throws InterruptedException { writer.append("typeof "); writer.spaceBeforeCallParenthesies(1); + if (value.getPrecedence() > getPrecedence()) { + writer.append("("); + } value.toString(writer, localData); + if (value.getPrecedence() > getPrecedence()) { + writer.append(")"); + } + return writer; }