style(dart/transform): Change quote character for consistency.

Use ' as a quote character in generated output instead of ".
This commit is contained in:
Tim Blasi 2015-03-12 13:18:36 -07:00
parent 30253592ff
commit 95c9eca64c
15 changed files with 41 additions and 43 deletions

View File

@ -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');

View File

@ -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('})');

View File

@ -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 =

View File

@ -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"]}

View File

@ -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});
}

View File

@ -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();
}

View File

@ -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);

View File

@ -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]')]
});
}

View File

@ -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);

View File

@ -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])
]
});
}

View File

@ -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]')]
});
}

View File

@ -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]')]
});
}

View File

@ -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')
]

View File

@ -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)
]
});

View File

@ -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 =