From ac50ffca5e079db0b3e30a1feed20915d4476959 Mon Sep 17 00:00:00 2001 From: Bob Nystrom Date: Wed, 8 Jul 2015 14:53:21 -0700 Subject: [PATCH] fix(transform): handle multiple interfaces in directive processor Comma separate the list of interfaces in the directive transformer. Closes #2941 --- .../src/transform/directive_processor/rewriter.dart | 6 +++--- .../interfaces_files/expected/soup.ng_deps.dart | 2 +- .../directive_processor/interfaces_files/soup.dart | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/angular2/src/transform/directive_processor/rewriter.dart b/modules/angular2/src/transform/directive_processor/rewriter.dart index 8541ee1859..59336ee42b 100644 --- a/modules/angular2/src/transform/directive_processor/rewriter.dart +++ b/modules/angular2/src/transform/directive_processor/rewriter.dart @@ -193,9 +193,9 @@ class CreateNgDepsVisitor extends Object with SimpleAstVisitor { node.implementsClause.interfaces != null && node.implementsClause.interfaces.isNotEmpty) { writer.print(''', 'interfaces': const ['''); - node.implementsClause.interfaces.forEach((interface) { - writer.print('${interface.name}'); - }); + writer.print(node.implementsClause.interfaces + .map((interface) => interface.name) + .join(', ')); writer.print(']'); } writer.print('})'); diff --git a/modules/angular2/test/transform/directive_processor/interfaces_files/expected/soup.ng_deps.dart b/modules/angular2/test/transform/directive_processor/interfaces_files/expected/soup.ng_deps.dart index 3e8cd95092..7e654c36ed 100644 --- a/modules/angular2/test/transform/directive_processor/interfaces_files/expected/soup.ng_deps.dart +++ b/modules/angular2/test/transform/directive_processor/interfaces_files/expected/soup.ng_deps.dart @@ -12,6 +12,6 @@ void initReflector(reflector) { 'factory': () => new ChangingSoupComponent(), 'parameters': const [], 'annotations': const [const Component(selector: '[soup]')], - 'interfaces': const [OnChange] + 'interfaces': const [OnChange, AnotherInterface] }); } diff --git a/modules/angular2/test/transform/directive_processor/interfaces_files/soup.dart b/modules/angular2/test/transform/directive_processor/interfaces_files/soup.dart index 0365174837..cf7fc4d16c 100644 --- a/modules/angular2/test/transform/directive_processor/interfaces_files/soup.dart +++ b/modules/angular2/test/transform/directive_processor/interfaces_files/soup.dart @@ -3,4 +3,4 @@ library dinner.soup; import 'package:angular2/src/core/annotations_impl/annotations.dart'; @Component(selector: '[soup]') -class ChangingSoupComponent implements OnChange {} +class ChangingSoupComponent implements OnChange, AnotherInterface {}