Chromium Code Reviews| Index: pkg/analyzer2dart/lib/src/tree_shaker.dart |
| diff --git a/pkg/analyzer2dart/lib/src/tree_shaker.dart b/pkg/analyzer2dart/lib/src/tree_shaker.dart |
| index bdf94c5809b26c0b03d3a481821d25968724f4a8..6b55396cfa6171e23bbb2eabfa3d020e78f434d2 100644 |
| --- a/pkg/analyzer2dart/lib/src/tree_shaker.dart |
| +++ b/pkg/analyzer2dart/lib/src/tree_shaker.dart |
| @@ -137,6 +137,19 @@ class LocalReachabilityComputer { |
| } |
| } |
| } |
| + } else if (selector.kind == SelectorKind.SETTER) { |
| + for (PropertyAccessorElement accessor in classElement.accessors) { |
| + // accessor.name uses the convention that setter names end in '='. |
| + if (accessor.isSetter && '${selector.name}=' == accessor.name) { |
|
scheglov
2014/10/21 14:58:21
We could probably make it slightly faster by compu
Paul Berry
2014/10/21 15:14:04
Done.
|
| + if (accessor.isSynthetic) { |
| + // This accessor is implied by the corresponding field declaration. |
| + // TODO(paulberry): should we distinguish reads and writes? |
| + fields.add(accessor.variable); |
| + } else { |
| + accessors.add(accessor); |
| + } |
| + } |
| + } |
| } |
| } |
| } |
| @@ -294,8 +307,10 @@ class TreeShakingVisitor extends SemanticVisitor { |
| new Selector.getter(semantics.identifier.name, null)); |
| } |
| if (semantics.isWrite) { |
| - // TODO(paulberry): implement. |
| - return giveUp(node, '_handlePropertyAccess of ${semantics}.'); |
| + // Selector.setter constructor uses the convention that setter names |
| + // don't end in '='. |
| + analysis.invokes.add( |
| + new Selector.setter(semantics.identifier.name, null)); |
| } |
| } |