code: function cacheMatchingDirectivesForNode(tNode, tView, localRefs) {
      // Please make sure to have explicit type for `exportsMap`. Inferred type triggers bug in tsickle.
      var exportsMap = localRefs ? { '': -1 } : null;
      var matches = tView.currentMatches = findDirectiveMatches(tNode);
      if (matches) {
          for (var i = 0; i < matches.length; i += 2) {
              var def = matches[i];
              var valueIndex = i + 1;
              resolveDirective(def, valueIndex, matches, tView);
              saveNameToExportMap(matches[valueIndex], def, exportsMap);
          }
      }
      if (exportsMap)
          cacheMatchingLocalNames(tNode, localRefs, exportsMap);
  }
docs: On first template pass, we match each node against available directive selectors and save
  the resulting defs in the correct instantiation order for subsequent change detection runs
  (so dependencies are always created before the directives that inject them).