File tree Expand file tree Collapse file tree 2 files changed +71
-1
lines changed Expand file tree Collapse file tree 2 files changed +71
-1
lines changed Original file line number Diff line number Diff line change @@ -124,7 +124,9 @@ class AstNodeVisitor extends ThrowingAstVisitor<void>
124
124
125
125
@override
126
126
void visitAssignmentExpression (AssignmentExpression node) {
127
- throw UnimplementedError ();
127
+ visit (node.leftHandSide);
128
+ writer.space ();
129
+ finishAssignment (node.operator , node.rightHandSide);
128
130
}
129
131
130
132
@override
Original file line number Diff line number Diff line change
1
+ 40 columns |
2
+ >>> Chained assignment.
3
+ a=b=c;
4
+ <<<
5
+ a = b = c;
6
+ >>> Compound assignment operators.
7
+ a*=b/=c~/=d%=e;
8
+ <<<
9
+ a *= b /= c ~/= d %= e;
10
+ >>>
11
+ a+=b-=c;
12
+ <<<
13
+ a += b -= c;
14
+ >>>
15
+ a<<=b>>>=c>>=d;
16
+ <<<
17
+ a <<= b >>>= c >>= d;
18
+ >>>
19
+ a&=b^=c|=d;
20
+ <<<
21
+ a &= b ^= c |= d;
22
+ >>>
23
+ a??=b;
24
+ <<<
25
+ a ??= b;
26
+ >>> Split after `=`.
27
+ variableName = thisIsReallyQuiteAVeryLongVariableName;
28
+ <<<
29
+ variableName =
30
+ thisIsReallyQuiteAVeryLongVariableName;
31
+ >>> Prefer to split at "=" over infix operator.
32
+ variableName = argument * argument + argument;
33
+ <<<
34
+ variableName =
35
+ argument * argument + argument;
36
+ >>> Prefer block-like splitting for collections.
37
+ variableName = [element, element, element];
38
+ <<<
39
+ variableName = [
40
+ element,
41
+ element,
42
+ element,
43
+ ];
44
+ >>> Prefer block-like splitting for function calls.
45
+ variableName = function(argument, argument);
46
+ <<<
47
+ variableName = function(
48
+ argument,
49
+ argument,
50
+ );
51
+ >>> No block-like splitting for empty argument lists.
52
+ variableNameExactLength____ = function();
53
+ <<<
54
+ variableNameExactLength____ =
55
+ function();
56
+ >>> No block-like splitting if function name doesn't fit.
57
+ longVariableName = veryLongFunctionName_(argument);
58
+ <<<
59
+ longVariableName =
60
+ veryLongFunctionName_(argument);
61
+ >>> Indent block if function name doesn't fit and arguments split.
62
+ longVariableName = veryLongFunctionName_(argument, another);
63
+ <<<
64
+ longVariableName =
65
+ veryLongFunctionName_(
66
+ argument,
67
+ another,
68
+ );
You can’t perform that action at this time.
0 commit comments