refactor(pipes): use Injector instead of pipe factories for pipe instantiation

BREAKING CHANGE
    - Pipe factories have been removed.
    - PIpe names to pipe implementations are 1-to-1  instead of 1-to-*

 Before:
     class DateFormatter {
         transform(date, args){}
     }

     class DateFormatterFactory {
       supporst(obj) { return true; }
       create(cdRef) { return new DateFormatter(); }
     }
     new Pipes({date: [new DateFormatterFactory()]})

After
    class DateFormatter {
      transform(date, args){}
    }
    new Pipes({date: DateFormatter})
This commit is contained in:
vsavkin
2015-08-06 10:39:02 -07:00
parent 06da60f4b7
commit 2dcf714d2b
28 changed files with 249 additions and 524 deletions

View File

@ -274,10 +274,7 @@ class _CodegenState {
var read = '''
if ($_IDENTICAL_CHECK_FN($pipe, $_UTIL.uninitialized)) {
$pipe = ${_names.getPipesAccessorName()}.get('$pipeType', $context, $cdRef);
} else if (!$pipe.supports($context)) {
$pipe.onDestroy();
$pipe = ${_names.getPipesAccessorName()}.get('$pipeType', $context, $cdRef);
$pipe = ${_names.getPipesAccessorName()}.get('$pipeType', $cdRef);
}
$newValue = $pipe.transform($context, [$argString]);
''';