style(dart/transform): Change quote character for consistency.
Use ' as a quote character in generated output instead of ".
This commit is contained in:
parent
30253592ff
commit
95c9eca64c
|
@ -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');
|
||||
|
|
|
@ -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('})');
|
||||
|
||||
|
|
|
@ -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 =
|
||||
|
|
|
@ -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"]}
|
||||
|
|
|
@ -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});
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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]')]
|
||||
});
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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])
|
||||
]
|
||||
});
|
||||
}
|
||||
|
|
|
@ -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]')]
|
||||
});
|
||||
}
|
||||
|
|
|
@ -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]')]
|
||||
});
|
||||
}
|
||||
|
|
|
@ -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')
|
||||
]
|
||||
|
|
|
@ -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)
|
||||
]
|
||||
});
|
||||
|
|
|
@ -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 =
|
||||
|
|
Loading…
Reference in New Issue