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): misc #23351

Closed
wants to merge 1 commit into from
Closed

refactor(ivy): misc #23351

wants to merge 1 commit into from

Conversation

vicb
Copy link
Contributor

@vicb vicb commented Apr 12, 2018

No description provided.

@mary-poppins
Copy link

You can preview 770a777 at https://pr23351-770a777.ngbuilds.io/.

kara
kara previously requested changes Apr 12, 2018
/** Whether or not this node is a component */
Component = 0b001,
/** The number of directives on this node is encoded on the least significant bits */
NbOfDirectivesMask = 0b00000000000000000000111111111111,
Copy link
Contributor

Choose a reason for hiding this comment

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

How about DirSizeMask? Find Nb kind of hard to read.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

DirSize is confusing IMO ? It could mean that directive have size.

Copy link
Contributor

Choose a reason for hiding this comment

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

If we keep number, can we write it out then as number? Nb took me a second to understand since it's not the normal abbreviation.

Copy link
Contributor

Choose a reason for hiding this comment

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

How about just DirectiveCountMask?

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, count. That is clearer than size.

/** Mask to get the number of directives on this node */
SIZE_MASK = 0b00000000000000000001111111111110
/** The index of the first directive on this node is encoded on the most significant bits */
IndexOfFirstDirectiveShift = 13,
Copy link
Contributor

Choose a reason for hiding this comment

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

How about DirIndexShift? This is kind of long and hard to read.

Copy link
Contributor Author

@vicb vicb Apr 13, 2018

Choose a reason for hiding this comment

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

Same kind or remark.
More explicit does not hurt

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm just concerned that the trade-off is readability, but I don't feel strongly

Copy link
Contributor

Choose a reason for hiding this comment

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

how about DirectiveStartingIndexShift

ngDevMode && assertNotEqual(
previousOrParentNode.tNode !.flags & TNodeFlags.NbOfDirectivesMask,
TNodeFlags.NbOfDirectivesMask, 'Reached the max number of directives');
previousOrParentNode.tNode !.flags++;
Copy link
Contributor

@kara kara Apr 12, 2018

Choose a reason for hiding this comment

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

Are you saving the first index? Looks like it's deleted here, which is probably why the tests are failing.

We should only be adding to the size this way if the first directive index has already been saved by a previous directive.

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

vicb commented Apr 13, 2018

@kara PTAL

@mary-poppins
Copy link

You can preview 5247915 at https://pr23351-5247915.ngbuilds.io/.

@mary-poppins
Copy link

You can preview d824e05 at https://pr23351-d824e05.ngbuilds.io/.

@mary-poppins
Copy link

You can preview e8b265a at https://pr23351-e8b265a.ngbuilds.io/.

@mary-poppins
Copy link

You can preview f39ed82 at https://pr23351-f39ed82.ngbuilds.io/.

@vicb
Copy link
Contributor Author

vicb commented Apr 13, 2018

@vicb vicb 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 Apr 13, 2018
@vicb vicb dismissed kara’s stale review April 13, 2018 18:30

comments adressed

Copy link
Contributor

@kara kara left a comment

Choose a reason for hiding this comment

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

LGTM

// Get the definition for the directive at this index and, if it is injectable (diPublic),
// and matches the given token, return the directive instance.
const directiveDef = defs[i] as DirectiveDef<any>;
if (directiveDef.diPublic && directiveDef.type == token) {
if (directiveDef.type == token && directiveDef.diPublic) {
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't this use triple-equals comparison? It is now different from getIdxOfMatchingDirective in render3/query.ts

@@ -196,10 +196,12 @@ function getIdxOfMatchingSelector(tNode: TNode, selector: string): number|null {
function geIdxOfMatchingDirective(node: LNode, type: Type<any>): number|null {
Copy link
Member

Choose a reason for hiding this comment

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

This should probably be named getIdxOfMatchingDirective

@mary-poppins
Copy link

You can preview 6f13bbc at https://pr23351-6f13bbc.ngbuilds.io/.

@IgorMinar IgorMinar closed this in d5e7f60 Apr 13, 2018
@vicb vicb deleted the 0412-ivyref branch April 13, 2018 22:54
@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

6 participants