From 95c9eca64c8adefacc8e2fdfdf81822ae98c0875 Mon Sep 17 00:00:00 2001 From: Tim Blasi Date: Thu, 12 Mar 2015 13:18:36 -0700 Subject: [PATCH] style(dart/transform): Change quote character for consistency. Use ' as a quote character in generated output instead of ". --- .../src/transform/bind_generator/generator.dart | 2 +- .../transform/directive_processor/rewriter.dart | 6 +++--- .../transform/directive_processor/all_tests.dart | 2 +- .../parameter_metadata/expected/soup.ngDeps.dart | 6 +++--- .../basic_bind_files/expected/bar.ngDeps.dart | 14 +++++++------- .../integration/chained_deps_files/bar.dart | 3 +-- .../chained_deps_files/expected/bar.ngDeps.dart | 9 ++++----- .../chained_deps_files/expected/foo.ngDeps.dart | 6 +++--- .../integration/list_of_types_files/bar.dart | 2 +- .../list_of_types_files/expected/bar.ngDeps.dart | 8 ++++---- .../expected/bar.ngDeps.dart | 6 +++--- .../synthetic_ctor_files/expected/bar.ngDeps.dart | 6 +++--- .../two_annotations_files/expected/bar.ngDeps.dart | 6 +++--- .../two_deps_files/expected/bar.ngDeps.dart | 6 +++--- .../transform/reflection_remover/all_tests.dart | 2 +- 15 files changed, 41 insertions(+), 43 deletions(-) diff --git a/modules/angular2/src/transform/bind_generator/generator.dart b/modules/angular2/src/transform/bind_generator/generator.dart index 3081d33ab6..48df6aa1e4 100644 --- a/modules/angular2/src/transform/bind_generator/generator.dart +++ b/modules/angular2/src/transform/bind_generator/generator.dart @@ -71,7 +71,7 @@ class _ExtractSettersVisitor extends Object // TODO(kegluneq): Remove this restriction if (entry.key is SimpleStringLiteral) { var propName = entry.key.value; - bindPieces.add('"${propName}": (' + bindPieces.add('\'${propName}\': (' '${currentName} o, String value) => o.${propName} = value'); } else { logger.error('`bind` currently only supports string literals'); diff --git a/modules/angular2/src/transform/directive_processor/rewriter.dart b/modules/angular2/src/transform/directive_processor/rewriter.dart index 112bf9c15d..e7e73deb3c 100644 --- a/modules/angular2/src/transform/directive_processor/rewriter.dart +++ b/modules/angular2/src/transform/directive_processor/rewriter.dart @@ -150,19 +150,19 @@ class CreateNgDepsVisitor extends Object } writer.print('..registerType('); visitNode(node.name); - writer.print(', {"factory": '); + writer.print(', {\'factory\': '); if (ctor == null) { _generateEmptyFactory(node.name.toString()); } else { ctor.accept(_factoryVisitor); } - writer.print(', "parameters": '); + writer.print(', \'parameters\': '); if (ctor == null) { _generateEmptyParams(); } else { ctor.accept(_paramsVisitor); } - writer.print(', "annotations": '); + writer.print(', \'annotations\': '); node.accept(_metaVisitor); writer.print('})'); diff --git a/modules/angular2/test/transform/directive_processor/all_tests.dart b/modules/angular2/test/transform/directive_processor/all_tests.dart index 708fe085da..6080226265 100644 --- a/modules/angular2/test/transform/directive_processor/all_tests.dart +++ b/modules/angular2/test/transform/directive_processor/all_tests.dart @@ -15,7 +15,7 @@ import '../common/read_file.dart'; var formatter = new DartFormatter(); void allTests() { - test('should preserve parameter annotations as const instances', () { + test('should preserve parameter annotations as const instances.', () { var inputPath = 'parameter_metadata/soup.dart'; var expected = _readFile('parameter_metadata/expected/soup.ngDeps.dart'); var output = diff --git a/modules/angular2/test/transform/directive_processor/parameter_metadata/expected/soup.ngDeps.dart b/modules/angular2/test/transform/directive_processor/parameter_metadata/expected/soup.ngDeps.dart index f7efc4e80e..4558a20022 100644 --- a/modules/angular2/test/transform/directive_processor/parameter_metadata/expected/soup.ngDeps.dart +++ b/modules/angular2/test/transform/directive_processor/parameter_metadata/expected/soup.ngDeps.dart @@ -9,9 +9,9 @@ void setupReflection(reflector) { _visited = true; reflector ..registerType(SoupComponent, { - "factory": + 'factory': (String description, salt) => new SoupComponent(description, salt), - "parameters": const [const [Tasty, String], const [const Inject(Salt)]], - "annotations": const [const Component(selector: '[soup]')] + 'parameters': const [const [Tasty, String], const [const Inject(Salt)]], + 'annotations': const [const Component(selector: '[soup]')] }); } // {"version":1,"importOffset":104,"registerOffset":451,"imports":["package:angular2/src/core/annotations/annotations.dart"]} diff --git a/modules/angular2/test/transform/integration/basic_bind_files/expected/bar.ngDeps.dart b/modules/angular2/test/transform/integration/basic_bind_files/expected/bar.ngDeps.dart index 3c99b26677..b9fa0b4ca1 100644 --- a/modules/angular2/test/transform/integration/basic_bind_files/expected/bar.ngDeps.dart +++ b/modules/angular2/test/transform/integration/basic_bind_files/expected/bar.ngDeps.dart @@ -9,19 +9,19 @@ void setupReflection(reflector) { _visited = true; reflector ..registerType(MyComponent, { - "factory": () => new MyComponent(), - "parameters": const [], - "annotations": const [ + 'factory': () => new MyComponent(), + 'parameters': const [], + 'annotations': const [ const Component(selector: 'soup', services: const [ToolTip]) ] }) ..registerType(ToolTip, { - "factory": () => new ToolTip(), - "parameters": const [], - "annotations": const [ + 'factory': () => new ToolTip(), + 'parameters': const [], + 'annotations': const [ const Decorator( selector: '[tool-tip]', bind: const {'text': 'tool-tip'}) ] }) - ..registerSetters({"text": (ToolTip o, String value) => o.text = value}); + ..registerSetters({'text': (ToolTip o, String value) => o.text = value}); } diff --git a/modules/angular2/test/transform/integration/chained_deps_files/bar.dart b/modules/angular2/test/transform/integration/chained_deps_files/bar.dart index 3bbd3bb2f4..19f0b341c0 100644 --- a/modules/angular2/test/transform/integration/chained_deps_files/bar.dart +++ b/modules/angular2/test/transform/integration/chained_deps_files/bar.dart @@ -3,8 +3,7 @@ library bar; import 'package:angular2/src/core/annotations/annotations.dart'; import 'foo.dart' as dep; -@Component( - selector: '[soup]', services: const [dep.DependencyComponent]) +@Component(selector: '[soup]', services: const [dep.DependencyComponent]) class MyComponent { MyComponent(); } diff --git a/modules/angular2/test/transform/integration/chained_deps_files/expected/bar.ngDeps.dart b/modules/angular2/test/transform/integration/chained_deps_files/expected/bar.ngDeps.dart index 6033870b71..b907cafd31 100644 --- a/modules/angular2/test/transform/integration/chained_deps_files/expected/bar.ngDeps.dart +++ b/modules/angular2/test/transform/integration/chained_deps_files/expected/bar.ngDeps.dart @@ -11,12 +11,11 @@ void setupReflection(reflector) { _visited = true; reflector ..registerType(MyComponent, { - "factory": () => new MyComponent(), - "parameters": const [], - "annotations": const [ + 'factory': () => new MyComponent(), + 'parameters': const [], + 'annotations': const [ const Component( - selector: '[soup]', - services: const [dep.DependencyComponent]) + selector: '[soup]', services: const [dep.DependencyComponent]) ] }); i0.setupReflection(reflector); diff --git a/modules/angular2/test/transform/integration/chained_deps_files/expected/foo.ngDeps.dart b/modules/angular2/test/transform/integration/chained_deps_files/expected/foo.ngDeps.dart index 7fbdb9e3b1..db192c6a6f 100644 --- a/modules/angular2/test/transform/integration/chained_deps_files/expected/foo.ngDeps.dart +++ b/modules/angular2/test/transform/integration/chained_deps_files/expected/foo.ngDeps.dart @@ -9,8 +9,8 @@ void setupReflection(reflector) { _visited = true; reflector ..registerType(DependencyComponent, { - "factory": () => new DependencyComponent(), - "parameters": const [], - "annotations": const [const Component(selector: '[salad]')] + 'factory': () => new DependencyComponent(), + 'parameters': const [], + 'annotations': const [const Component(selector: '[salad]')] }); } diff --git a/modules/angular2/test/transform/integration/list_of_types_files/bar.dart b/modules/angular2/test/transform/integration/list_of_types_files/bar.dart index e8cf596129..2d242c1396 100644 --- a/modules/angular2/test/transform/integration/list_of_types_files/bar.dart +++ b/modules/angular2/test/transform/integration/list_of_types_files/bar.dart @@ -3,7 +3,7 @@ library bar; import 'package:angular2/src/core/annotations/annotations.dart'; import 'foo.dart'; -@Component(services: const [MyContext]) +@Component(componentServices: const [MyContext]) class MyComponent { final MyContext c; MyComponent(this.c); diff --git a/modules/angular2/test/transform/integration/list_of_types_files/expected/bar.ngDeps.dart b/modules/angular2/test/transform/integration/list_of_types_files/expected/bar.ngDeps.dart index 7fbc8e1ef8..a8c1ca0721 100644 --- a/modules/angular2/test/transform/integration/list_of_types_files/expected/bar.ngDeps.dart +++ b/modules/angular2/test/transform/integration/list_of_types_files/expected/bar.ngDeps.dart @@ -10,10 +10,10 @@ void setupReflection(reflector) { _visited = true; reflector ..registerType(MyComponent, { - "factory": (MyContext c) => new MyComponent(c), - "parameters": const [const [MyContext]], - "annotations": const [ - const Component(services: const [MyContext]) + 'factory': (MyContext c) => new MyComponent(c), + 'parameters': const [const [MyContext]], + 'annotations': const [ + const Component(componentServices: const [MyContext]) ] }); } diff --git a/modules/angular2/test/transform/integration/simple_annotation_files/expected/bar.ngDeps.dart b/modules/angular2/test/transform/integration/simple_annotation_files/expected/bar.ngDeps.dart index 3092e198e9..f41b74e72f 100644 --- a/modules/angular2/test/transform/integration/simple_annotation_files/expected/bar.ngDeps.dart +++ b/modules/angular2/test/transform/integration/simple_annotation_files/expected/bar.ngDeps.dart @@ -9,8 +9,8 @@ void setupReflection(reflector) { _visited = true; reflector ..registerType(MyComponent, { - "factory": () => new MyComponent(), - "parameters": const [], - "annotations": const [const Component(selector: '[soup]')] + 'factory': () => new MyComponent(), + 'parameters': const [], + 'annotations': const [const Component(selector: '[soup]')] }); } diff --git a/modules/angular2/test/transform/integration/synthetic_ctor_files/expected/bar.ngDeps.dart b/modules/angular2/test/transform/integration/synthetic_ctor_files/expected/bar.ngDeps.dart index 3092e198e9..f41b74e72f 100644 --- a/modules/angular2/test/transform/integration/synthetic_ctor_files/expected/bar.ngDeps.dart +++ b/modules/angular2/test/transform/integration/synthetic_ctor_files/expected/bar.ngDeps.dart @@ -9,8 +9,8 @@ void setupReflection(reflector) { _visited = true; reflector ..registerType(MyComponent, { - "factory": () => new MyComponent(), - "parameters": const [], - "annotations": const [const Component(selector: '[soup]')] + 'factory': () => new MyComponent(), + 'parameters': const [], + 'annotations': const [const Component(selector: '[soup]')] }); } diff --git a/modules/angular2/test/transform/integration/two_annotations_files/expected/bar.ngDeps.dart b/modules/angular2/test/transform/integration/two_annotations_files/expected/bar.ngDeps.dart index f6da7c81e1..807b9db100 100644 --- a/modules/angular2/test/transform/integration/two_annotations_files/expected/bar.ngDeps.dart +++ b/modules/angular2/test/transform/integration/two_annotations_files/expected/bar.ngDeps.dart @@ -10,9 +10,9 @@ void setupReflection(reflector) { _visited = true; reflector ..registerType(MyComponent, { - "factory": () => new MyComponent(), - "parameters": const [], - "annotations": const [ + 'factory': () => new MyComponent(), + 'parameters': const [], + 'annotations': const [ const Component(selector: '[soup]'), const Template(inline: 'Salad') ] diff --git a/modules/angular2/test/transform/integration/two_deps_files/expected/bar.ngDeps.dart b/modules/angular2/test/transform/integration/two_deps_files/expected/bar.ngDeps.dart index 0e30a77379..8025b9ddd7 100644 --- a/modules/angular2/test/transform/integration/two_deps_files/expected/bar.ngDeps.dart +++ b/modules/angular2/test/transform/integration/two_deps_files/expected/bar.ngDeps.dart @@ -10,10 +10,10 @@ void setupReflection(reflector) { _visited = true; reflector ..registerType(MyComponent, { - "factory": + 'factory': (prefix.MyContext c, String inValue) => new MyComponent(c, inValue), - "parameters": const [const [prefix.MyContext], const [String]], - "annotations": const [ + 'parameters': const [const [prefix.MyContext], const [String]], + 'annotations': const [ const Component(selector: prefix.preDefinedSelector) ] }); diff --git a/modules/angular2/test/transform/reflection_remover/all_tests.dart b/modules/angular2/test/transform/reflection_remover/all_tests.dart index 4291b5dae1..69228f8e60 100644 --- a/modules/angular2/test/transform/reflection_remover/all_tests.dart +++ b/modules/angular2/test/transform/reflection_remover/all_tests.dart @@ -11,7 +11,7 @@ import '../common/read_file.dart'; void allTests() { var codegen = new Codegen('web/index.dart', 'web/index.ngDeps.dart'); - test('should remove uses of mirrors & insert calls to generated code', () { + test('should remove uses of mirrors & insert calls to generated code.', () { var code = readFile('reflection_remover/reflection_remover_files/index.dart'); var output =