convertMatchedDirectives function

List<MatchedDirective> convertMatchedDirectives(
  1. Iterable<DirectiveAst> directives,
  2. CompileElement compileElement,
  3. CompileDirectiveMetadata compileDirectiveMetadata
)

Converts a list of ast.DirectiveAst nodes into ir.MatchedDirective instances.

CompileElement represents the element in the template that the directive has matched.

AnalyzedClass represents the Component class that is currently being compiled.

Implementation

List<ir.MatchedDirective> convertMatchedDirectives(
  Iterable<ast.DirectiveAst> directives,
  CompileElement compileElement,
  CompileDirectiveMetadata compileDirectiveMetadata,
) {
  final matchedDirectives = <ir.MatchedDirective>[];
  var index = -1;
  for (var directive in directives) {
    index++;
    var providerSource = compileElement.directiveInstances[index];
    matchedDirectives.add(convertMatchedDirective(
        directive, providerSource, compileElement, compileDirectiveMetadata));
  }
  return matchedDirectives;
}