| Index: frog/minfrog
|
| ===================================================================
|
| --- frog/minfrog (revision 2468)
|
| +++ frog/minfrog (working copy)
|
| @@ -3521,6 +3521,9 @@
|
| var index = this.visitValue(node.index);
|
| return target.invoke$4(this, ':index', node, new Arguments(null, [index]));
|
| }
|
| +MethodGenerator.prototype._expressionNeedsParens = function(e) {
|
| + return ((e instanceof BinaryExpression) || (e instanceof ConditionalExpression) || (e instanceof PostfixExpression) || this._isUnaryIncrement(e));
|
| +}
|
| MethodGenerator.prototype.visitBinaryExpression = function(node, isVoid) {
|
| var kind = node.op.kind;
|
| if (kind == 35/*TokenKind.AND*/ || kind == 34/*TokenKind.OR*/) {
|
| @@ -3574,6 +3577,9 @@
|
| }
|
| return x.invoke$4(this, name, node, new Arguments(null, [y]));
|
| }
|
| + else if ((assignKind != 0) && this._expressionNeedsParens(node.y)) {
|
| + return this._visitAssign(assignKind, node.x, new ParenExpression(node.y, node.y.span), node, to$call$1(null), isVoid);
|
| + }
|
| else {
|
| return this._visitAssign(assignKind, node.x, node.y, node, to$call$1(null), isVoid);
|
| }
|
| @@ -3983,7 +3989,7 @@
|
| var val = this.visitValue(item);
|
| val.invoke$4(this, 'toString', item, Arguments.get$EMPTY());
|
| var code = val.get$code();
|
| - if ((item instanceof BinaryExpression) || (item instanceof ConditionalExpression) || (item instanceof PostfixExpression) || this._isUnaryIncrement(item)) {
|
| + if (this._expressionNeedsParens(item)) {
|
| code = ('(' + code + ')');
|
| }
|
| if ($eq(items.get$length(), 0) || ($ne(code, "''") && $ne(code, '""'))) {
|
|
|