Revert "feat(transformers): collect provider information"
This reverts commit 81beb1c788
.
Broke Google3.
This commit is contained in:
@ -431,38 +431,14 @@ class _DirectiveMetadataVisitor extends Object
|
||||
) {
|
||||
final token = el.argumentList.arguments.first;
|
||||
|
||||
var useClass, useExisting, useValue, factoryId, useFactory, deps;
|
||||
var useClass;
|
||||
el.argumentList.arguments.skip(1).forEach((arg) {
|
||||
if (arg.name.toString() == "useClass:") {
|
||||
final id = _readIdentifier(arg.expression);
|
||||
useClass = new CompileTypeMetadata(prefix: id.prefix, name: id.name);
|
||||
} else if (arg.name.toString() == "toClass:") {
|
||||
final id = _readIdentifier(arg.expression);
|
||||
useClass = new CompileTypeMetadata(prefix: id.prefix, name: id.name);
|
||||
|
||||
} else if (arg.name.toString() == "useExisting:") {
|
||||
useExisting = _readIdentifier(arg.expression);
|
||||
} else if (arg.name.toString() == "toAlias:") {
|
||||
useExisting = _readIdentifier(arg.expression);
|
||||
|
||||
} else if (arg.name.toString() == "useValue:") {
|
||||
useValue = _readIdentifier(arg.expression);
|
||||
} else if (arg.name.toString() == "toValue:") {
|
||||
useValue = _readIdentifier(arg.expression);
|
||||
|
||||
} else if (arg.name.toString() == "useFactory:") {
|
||||
factoryId = _readIdentifier(arg.expression);
|
||||
} else if (arg.name.toString() == "toFactory:") {
|
||||
factoryId = _readIdentifier(arg.expression);
|
||||
|
||||
} else if (arg.name.toString() == "deps:") {
|
||||
deps = _readDeps(arg.expression);
|
||||
}
|
||||
});
|
||||
if (factoryId != null) {
|
||||
useFactory = new CompileFactoryMetadata(name: factoryId.name, prefix: factoryId.prefix);
|
||||
}
|
||||
return new CompileProviderMetadata(token: _readIdentifier(token), useClass: useClass, useExisting: useExisting, useValue: useValue, useFactory: useFactory, deps: deps);
|
||||
return new CompileProviderMetadata(token: _readIdentifier(token), useClass: useClass);
|
||||
|
||||
} else {
|
||||
throw new ArgumentError(
|
||||
@ -475,29 +451,6 @@ class _DirectiveMetadataVisitor extends Object
|
||||
}
|
||||
}
|
||||
|
||||
List<CompileDiDependencyMetadata> _readDeps(ListLiteral deps) {
|
||||
return deps.elements.map((p) {
|
||||
final list = p is ListLiteral ? p.elements : [p];
|
||||
final first = list.first;
|
||||
|
||||
var token;
|
||||
if (first is InstanceCreationExpression && first.constructorName.toString() == "Inject") {
|
||||
token = _readIdentifier(first.argumentList.arguments[0]);
|
||||
} else {
|
||||
token = _readIdentifier(first);
|
||||
}
|
||||
|
||||
return new CompileDiDependencyMetadata(
|
||||
token: token,
|
||||
isSelf: _hasConst(list, "Self"),
|
||||
isHost: _hasConst(list, "Host"),
|
||||
isSkipSelf: _hasConst(list, "SkipSelf"),
|
||||
isOptional: _hasConst(list, "Optional"));
|
||||
}).toList();
|
||||
}
|
||||
|
||||
bool _hasConst(List list, String name) => list.where((m) => m is InstanceCreationExpression && m.constructorName.toString() == name).isNotEmpty;
|
||||
|
||||
//TODO Use AnnotationMatcher instead of string matching
|
||||
bool _isAnnotation(Annotation node, String annotationName) {
|
||||
var id = node.name;
|
||||
|
@ -162,17 +162,6 @@ class _CompileDataCreator {
|
||||
if (provider.useClass != null) {
|
||||
provider.useClass = _resolveIdentifier(ngMetaMap, neededBy, provider.useClass);
|
||||
}
|
||||
if (provider.useExisting != null) {
|
||||
provider.useExisting = _resolveIdentifier(ngMetaMap, neededBy, provider.useExisting);
|
||||
}
|
||||
if (provider.useValue != null) {
|
||||
provider.useValue = _resolveIdentifier(ngMetaMap, neededBy, provider.useValue);
|
||||
}
|
||||
if (provider.useFactory != null) {
|
||||
final resolved = _resolveIdentifier(ngMetaMap, neededBy, provider.useFactory);
|
||||
provider.useFactory.moduleUrl = resolved.moduleUrl;
|
||||
_resolveDiDependencyMetadata(ngMetaMap, neededBy, provider.useFactory.diDeps);
|
||||
}
|
||||
resolvedProviders.add(provider);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user