Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(ivy): generate pipe names instead of defs #23104

Closed
wants to merge 1 commit into from

Conversation

kara
Copy link
Contributor

@kara kara commented Mar 30, 2018

This PR updates the Ivy compiler to generate pipe names instead of defs.

Original template:

{{ name | myPipe }}

Before:

class MyPipe {
   static ngPipeDef = definePipe({
      type: MyPipe,
      ...
   });
}

...
template: (ctx: SomeComp, cm: boolean) {
   if (cm) {
      T(0);
      Pp(1, MyPipe.ngPipeDef);
   }
   t(0, i1('', pb1(1, ctx.name), ''));
}

After:

class MyPipe {
   static ngPipeDef = definePipe({
      name: 'myPipe',
      type: MyPipe,
      ...
   });
}

...
template: (ctx: SomeComp, cm: boolean) {
   if (cm) {
      T(0);
      Pp(1, 'myPipe');
   }
   t(0, i1('', pb1(1, ctx.name), ''));
}

Notes:

  • We used to have an optimization where we passed the first instance of a pure pipe to any subsequent invocations of that pipe, to avoid having to instantiate it multiple times. Now that the compiler is generating code as if it doesn't know which pipes are present in the template (and thus which ones are pure and should get an instance), it no longer makes sense to generate this extra argument.

  • Once test(ivy): create todo app in ivy #22921 goes in, we'll want to refactor to share the addDependencyToComponent logic.

@kara kara requested a review from mhevery March 30, 2018 23:21
@kara kara added action: review The PR is still awaiting reviews from at least one requested reviewer comp: ivy refactoring Issue that involves refactoring or code-cleanup target: major This PR is targeted for the next major release labels Mar 30, 2018
@kara
Copy link
Contributor Author

kara commented Mar 31, 2018

presubmit

@kara kara added action: merge The PR is ready for merge by the caretaker and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Mar 31, 2018
@alxhub alxhub closed this in 85d3b59 Apr 2, 2018
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 13, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker cla: yes refactoring Issue that involves refactoring or code-cleanup target: major This PR is targeted for the next major release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants