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): remove pipe references from the template #23032

Closed
wants to merge 2 commits into from

Conversation

kara
Copy link
Contributor

@kara kara commented Mar 27, 2018

This PR removes all pipe references from the template. This improves locality because host components won't need to know what their pipes are at compile-time.

Template:

{{ name | double }}

Generated (before):

if (cm) {
  T(0);
  Pp(1, DoublePipe.ngPipeDef);
}
t(0, b(pb1(1, ctx.name));

Generated (after):

if (cm) {
  T(0);
  Pp(1, 'double');
}
t(0, b(pb1(1, ctx.name));

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

@mhevery mhevery left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

small nit

* @param type Pipe class reference. Needed to extract pipe lifecycle hooks.
* @param factory A factory for creating a pipe instance.
* @param pure Whether the pipe is pure.
*/
export function definePipe<T>(
{type, factory, pure}: {type: Type<T>, factory: () => T, pure?: boolean}): PipeDef<T> {
{name, type, factory, pure}: {name: string, type: Type<T>, factory: () => T, pure?: boolean}):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you add docs here (same as componentDef)

*/
export function renderTemplate<T>(
hostNode: RElement, template: ComponentTemplate<T>, context: T,
providedRendererFactory: RendererFactory3, host: LElementNode | null,
directiveRegistry: DirectiveDefListOrFactory | null = null): LElementNode {
{directives,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's not use {} in args since they are not efficient and require object creation. I think sticking to positional args is safer.

@mary-poppins
Copy link

You can preview df6def1 at https://pr23032-df6def1.ngbuilds.io/.

@kara
Copy link
Contributor Author

kara commented Mar 27, 2018

presubmit

@mary-poppins
Copy link

You can preview 0849e21 at https://pr23032-0849e21.ngbuilds.io/.

@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 28, 2018
@alxhub alxhub closed this in e2e80ec Mar 28, 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

4 participants