processTemplates function
Future<TemplateCompilerOutputs>
processTemplates(
- LibraryElement library,
- BuildStep buildStep,
- CompilerFlags flags
Given an input library a.dart, returns output for a.template.dart.
"Output" here is defined in terms of TemplateCompilerOutput, or an
abstract collection of elements that need to be emitted into the
corresponding .template.dart file. See TemplateCompilerOutput.
Implementation
Future<TemplateCompilerOutputs> processTemplates(
LibraryElement library,
BuildStep buildStep,
CompilerFlags flags,
) async {
// Temporary replace for `resolveReflectables` which is also
// checks elements with `@Injectable()` annotation.
checkInjectables(library);
// Collect the elements to implement `@GeneratedInjector`(s).
final injectors = InjectorReader.findInjectors(library);
// Collect the elements to implement views for `@Component`(s).
final compiler = createTemplateCompiler(buildStep, flags);
final sourceModule = await compiler.compile(library);
// Return them to be emitted to disk as generated code in the future.
return TemplateCompilerOutputs(sourceModule, injectors);
}