Skip to content

Commit ac50ffc

Browse files
munificenttbosch
authored andcommitted
fix(transform): handle multiple interfaces in directive processor
Comma separate the list of interfaces in the directive transformer. Closes angular#2941
1 parent caa252e commit ac50ffc

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

modules/angular2/src/transform/directive_processor/rewriter.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -193,9 +193,9 @@ class CreateNgDepsVisitor extends Object with SimpleAstVisitor<Object> {
193193
node.implementsClause.interfaces != null &&
194194
node.implementsClause.interfaces.isNotEmpty) {
195195
writer.print(''', 'interfaces': const [''');
196-
node.implementsClause.interfaces.forEach((interface) {
197-
writer.print('${interface.name}');
198-
});
196+
writer.print(node.implementsClause.interfaces
197+
.map((interface) => interface.name)
198+
.join(', '));
199199
writer.print(']');
200200
}
201201
writer.print('})');

modules/angular2/test/transform/directive_processor/interfaces_files/expected/soup.ng_deps.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ void initReflector(reflector) {
1212
'factory': () => new ChangingSoupComponent(),
1313
'parameters': const [],
1414
'annotations': const [const Component(selector: '[soup]')],
15-
'interfaces': const [OnChange]
15+
'interfaces': const [OnChange, AnotherInterface]
1616
});
1717
}

modules/angular2/test/transform/directive_processor/interfaces_files/soup.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ library dinner.soup;
33
import 'package:angular2/src/core/annotations_impl/annotations.dart';
44

55
@Component(selector: '[soup]')
6-
class ChangingSoupComponent implements OnChange {}
6+
class ChangingSoupComponent implements OnChange, AnotherInterface {}

0 commit comments

Comments
 (0)