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): replace LNode.dynamicLContainerNode with flat LContainers #26407

Closed
wants to merge 4 commits into from

Conversation

kara
Copy link
Contributor

@kara kara commented Oct 11, 2018

Previously, nodes with containers were stored flat in LViewData, so it was necessary to read LNode.data to reach the LContainer instance. This PR inverts this relationship, so we are now storing LContainer instances flat in LViewData, with LContainer[HOST_NATIVE] storing the host nodes. This allows us to remove LNode.dynamicLContainerNode and TNode.dynamicContainerNode, and is the first step toward removing LNode.data.

Still TODO:

  • Invert LNode.data for component and view nodes
  • Remove LNode.native

@mary-poppins
Copy link

You can preview 60f778d at https://pr26407-60f778d.ngbuilds.io/.

@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 labels Oct 11, 2018
@kara kara requested a review from mhevery October 11, 2018 21:03
@kara kara added the target: major This PR is targeted for the next major release label Oct 11, 2018
* @param value The initial value in `LViewData`
*/
export function readElementValue(value: LElementNode | StylingContext | LContainer): LElementNode {
if (!Array.isArray(value)) return value; // Regular LNode is stored here
Copy link
Contributor

Choose a reason for hiding this comment

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

I find this format more readable, would you mind changing it:

  if (Array.isArray(value)) {
    if (typeof value[ACTIVE_INDEX] === 'number') {
      // This is an LContainer. It may also have a styling context.
      value = value[HOST_NATIVE] as LElementNode | StylingContext;
      return Array.isArray(value) ? value[StylingIndex.ElementPosition] ! : value;
    } else {
      // This is a StylingContext, which stores the element node at 0.
      return value[StylingIndex.ElementPosition] as LElementNode;
    }
  } else {
    return value;  // Regular LNode is stored here
  }
  • Early returns confuse me.
  • Not clear that value is array after the guard.

@mhevery mhevery added action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Oct 11, 2018
@kara kara added action: merge The PR is ready for merge by the caretaker and removed action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews labels Oct 11, 2018
@mary-poppins
Copy link

You can preview 085efa4 at https://pr26407-085efa4.ngbuilds.io/.

@mary-poppins
Copy link

You can preview d979871 at https://pr26407-d979871.ngbuilds.io/.

@kara
Copy link
Contributor Author

kara commented Oct 12, 2018

presubmit

@mhevery mhevery closed this in 70cd112 Oct 12, 2018
FrederikSchlemmer pushed a commit to FrederikSchlemmer/angular that referenced this pull request Jan 3, 2019
FrederikSchlemmer pushed a commit to FrederikSchlemmer/angular that referenced this pull request Jan 3, 2019
@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 14, 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

5 participants