| Index: lib/src/js/printer.dart
|
| diff --git a/lib/src/js/printer.dart b/lib/src/js/printer.dart
|
| index bd8de3b40aa49c9bae41dc8051df78f5f84e9465..02bf379a74871a8b82bd27ef89827c59c42b1c54 100644
|
| --- a/lib/src/js/printer.dart
|
| +++ b/lib/src/js/printer.dart
|
| @@ -621,8 +621,17 @@ class Printer implements NodeVisitor {
|
| }
|
|
|
| visitDestructuredVariable(DestructuredVariable node) {
|
| - var hasName = node.name != null;
|
| - if (hasName) visit(node.name);
|
| + var name = node.name;
|
| + var hasName = name != null;
|
| + if (hasName) {
|
| + if (name is LiteralString) {
|
| + out("[");
|
| + out(name.value);
|
| + out("]");
|
| + } else {
|
| + visit(name);
|
| + }
|
| + }
|
| if (node.structure != null) {
|
| if (hasName) {
|
| out(":");
|
| @@ -639,6 +648,10 @@ class Printer implements NodeVisitor {
|
| }
|
| }
|
|
|
| + visitSimpleBindingPattern(SimpleBindingPattern node) {
|
| + visit(node.name);
|
| + }
|
| +
|
| visitAssignment(Assignment assignment) {
|
| visitNestedExpression(assignment.leftHandSide, LEFT_HAND_SIDE,
|
| newInForInit: inForInit,
|
| @@ -1585,13 +1598,23 @@ abstract class VariableDeclarationVisitor<T> extends BaseVisitor<T> {
|
|
|
| _scanVariableBinding(VariableBinding d) {
|
| if (d is Identifier) declare(d);
|
| - if (d is RestParameter) _scanVariableBinding(d.parameter);
|
| - else if (d is BindingPattern) {
|
| - for (var v in d.variables) {
|
| - if (v.name != null) declare(v.name);
|
| - if (v.structure != null) _scanVariableBinding(v.structure);
|
| - }
|
| - }
|
| + else d.accept(this);
|
| + }
|
| +
|
| + visitRestParameter(RestParameter node) {
|
| + _scanVariableBinding(node.parameter);
|
| + super.visitRestParameter(node);
|
| + }
|
| +
|
| + visitDestructuredVariable(DestructuredVariable node) {
|
| + var name = node.name;
|
| + if (name is Identifier) _scanVariableBinding(name);
|
| + super.visitDestructuredVariable(node);
|
| + }
|
| +
|
| + visitSimpleBindingPattern(SimpleBindingPattern node) {
|
| + _scanVariableBinding(node.name);
|
| + super.visitSimpleBindingPattern(node);
|
| }
|
|
|
| visitVariableInitialization(VariableInitialization node) {
|
|
|