style(dart/transform): Format Dart files in reflection

Run the formatter on some Dart-specific reflection files.
This commit is contained in:
Tim Blasi 2015-04-17 11:07:23 -07:00
parent 5c25248582
commit 5b4eb0c6d7
2 changed files with 42 additions and 23 deletions

View File

@ -13,26 +13,43 @@ class ReflectionCapabilities {
int length = ctor.parameters.length;
switch (length) {
case 0: return () => create(name, []).reflectee;
case 1: return (a1) => create(name, [a1]).reflectee;
case 2: return (a1, a2) => create(name, [a1, a2]).reflectee;
case 3: return (a1, a2, a3) => create(name, [a1, a2, a3]).reflectee;
case 4: return (a1, a2, a3, a4) => create(name, [a1, a2, a3, a4]).reflectee;
case 5: return (a1, a2, a3, a4, a5) => create(name, [a1, a2, a3, a4, a5]).reflectee;
case 6: return (a1, a2, a3, a4, a5, a6) => create(name, [a1, a2, a3, a4, a5, a6]).reflectee;
case 7: return (a1, a2, a3, a4, a5, a6, a7) => create(name, [a1, a2, a3, a4, a5, a6, a7]).reflectee;
case 8: return (a1, a2, a3, a4, a5, a6, a7, a8) => create(name, [a1, a2, a3, a4, a5, a6, a7, a8]).reflectee;
case 9: return (a1, a2, a3, a4, a5, a6, a7, a8, a9) => create(name, [a1, a2, a3, a4, a5, a6, a7, a8, a9]).reflectee;
case 10: return (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) => create(name, [a1, a2, a3, a4, a5, a6, a7, a8, a9, a10]).reflectee;
};
case 0:
return () => create(name, []).reflectee;
case 1:
return (a1) => create(name, [a1]).reflectee;
case 2:
return (a1, a2) => create(name, [a1, a2]).reflectee;
case 3:
return (a1, a2, a3) => create(name, [a1, a2, a3]).reflectee;
case 4:
return (a1, a2, a3, a4) => create(name, [a1, a2, a3, a4]).reflectee;
case 5:
return (a1, a2, a3, a4, a5) =>
create(name, [a1, a2, a3, a4, a5]).reflectee;
case 6:
return (a1, a2, a3, a4, a5, a6) =>
create(name, [a1, a2, a3, a4, a5, a6]).reflectee;
case 7:
return (a1, a2, a3, a4, a5, a6, a7) =>
create(name, [a1, a2, a3, a4, a5, a6, a7]).reflectee;
case 8:
return (a1, a2, a3, a4, a5, a6, a7, a8) =>
create(name, [a1, a2, a3, a4, a5, a6, a7, a8]).reflectee;
case 9:
return (a1, a2, a3, a4, a5, a6, a7, a8, a9) =>
create(name, [a1, a2, a3, a4, a5, a6, a7, a8, a9]).reflectee;
case 10:
return (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) =>
create(name, [a1, a2, a3, a4, a5, a6, a7, a8, a9, a10]).reflectee;
}
throw "Factory cannot take more than 10 arguments";
}
List<List> parameters(typeOrFunc) {
final parameters = typeOrFunc is Type ?
_constructorParameters(typeOrFunc) :
_functionParameters(typeOrFunc);
final parameters = typeOrFunc is Type
? _constructorParameters(typeOrFunc)
: _functionParameters(typeOrFunc);
return parameters.map(_convertParameter).toList();
}
@ -44,9 +61,9 @@ class ReflectionCapabilities {
}
List annotations(typeOrFunc) {
final meta = typeOrFunc is Type ?
_constructorMetadata(typeOrFunc) :
_functionMetadata(typeOrFunc);
final meta = typeOrFunc is Type
? _constructorMetadata(typeOrFunc)
: _functionMetadata(typeOrFunc);
return meta.map((m) => m.reflectee).toList();
}
@ -58,12 +75,14 @@ class ReflectionCapabilities {
SetterFn setter(String name) {
var symbol = new Symbol(name);
return (receiver, value) => reflect(receiver).setField(symbol, value).reflectee;
return (receiver, value) =>
reflect(receiver).setField(symbol, value).reflectee;
}
MethodFn method(String name) {
var symbol = new Symbol(name);
return (receiver, posArgs) => reflect(receiver).invoke(symbol, posArgs).reflectee;
return (receiver, posArgs) =>
reflect(receiver).invoke(symbol, posArgs).reflectee;
}
List _functionParameters(Function func) {