-
Notifications
You must be signed in to change notification settings - Fork 26.6k
fix(ivy): special case [style] and [class] bindings for future use #23232
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
Conversation
You can preview 749ed3f at https://pr23232-749ed3f.ngbuilds.io/. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one small nit, LGTM otherwise
import {MockDirectory, setup} from '../aot/test_util'; | ||
import {compile, expectEmit} from './mock_compile'; | ||
|
||
/* These tests are codified version of the tests in compiler_canonical_spec.ts. Every |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove this comment as it is not relevant
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
?
convertedBinding); | ||
continue; | ||
} | ||
|
||
const instruction = BINDING_INSTRUCTION_MAP[input.type]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not const instruction = getInputInstruction(input);
?
(or something similar as the number of args is different, the idea being to centralize the computation of the instruction)
actually something like
// class & style
const specialInstruction = SPECIAL_BINDING_INSTRUCTION_MAP[input.name];
if (specialInstruction) {
this.instruction(
this._bindingMode, input.sourceSpan, specialInstruction, o.literal(elementIndex),
convertedBinding);
continue;
}
const instruction = ...;
// ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hehe
$r3$.ɵE(0, 'div'); | ||
$r3$.ɵe(); | ||
} | ||
$r3$.ɵs(0,ctx.myStyleExp); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ctx
should probably not be hardcoded -> use $ctx$
instead ? (in the arg list and here)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see inline comments
749ed3f
to
5e61db0
Compare
5c4fc09
to
3c1d545
Compare
You can preview 5e61db0 at https://pr23232-5e61db0.ngbuilds.io/. |
You can preview 5c4fc09 at https://pr23232-5c4fc09.ngbuilds.io/. |
You can preview 3c1d545 at https://pr23232-3c1d545.ngbuilds.io/. |
$r3$.ɵE(0, 'div'); | ||
$r3$.ɵe(); | ||
} | ||
$r3$.ɵs(0,$ctx$.myStyleExp); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
space after comma?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No it's not needed because this code is generated by AOT (and it conserves size by avoiding unnecessary space usage).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is a test, and spaces are ignored so for readability you should add it.
$r3$.ɵE(0, 'div'); | ||
$r3$.ɵe(); | ||
} | ||
$r3$.ɵk(0,$ctx$.myClassExp); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
space after comma?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comment above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see my comment above. please add space to make it more readable. This is test only and will not have effect on output of compiler.
@@ -267,6 +267,11 @@ const BINDING_INSTRUCTION_MAP: {[index: number]: o.ExternalReference | undefined | |||
[PropertyBindingType.Style]: R3.elementStyleNamed | |||
}; | |||
|
|||
const SPECIAL_CASED_BINDING_INSTRUCTION_MAP: {[index: string]: o.ExternalReference | undefined} = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| undefined
?
3c1d545
to
29d4466
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
inline comments
@@ -273,6 +273,11 @@ const BINDING_INSTRUCTION_MAP: {[index: number]: o.ExternalReference | undefined | |||
[PropertyBindingType.Style]: R3.elementStyleNamed | |||
}; | |||
|
|||
const SPECIAL_CASED_BINDING_INSTRUCTION_MAP: {[index: string]: o.ExternalReference} = { | |||
'className': R3.elementClass, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
class
?
import {MockDirectory, setup} from '../aot/test_util'; | ||
import {compile, expectEmit} from './mock_compile'; | ||
|
||
/* These tests are codified version of the tests in compiler_canonical_spec.ts. Every |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
?
29d4466
to
80feb9d
Compare
You can preview 29d4466 at https://pr23232-29d4466.ngbuilds.io/. |
You can preview 80feb9d at https://pr23232-80feb9d.ngbuilds.io/. |
Hi @matsko! This PR has merge conflicts due to recent upstream merges. |
80feb9d
to
e1d89d9
Compare
You can preview e1d89d9 at https://pr23232-e1d89d9.ngbuilds.io/. |
e1d89d9
to
f0ca8b9
Compare
You can preview f0ca8b9 at https://pr23232-f0ca8b9.ngbuilds.io/. |
$r3$.ɵe(); | ||
} | ||
if (rf & 2) { | ||
$r3$.ɵs(0,$r3$.ɵb($ctx$.myClassExp)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be ɵk
?
428f29d
to
9e7e278
Compare
You can preview 9e7e278 at https://pr23232-9e7e278.ngbuilds.io/. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please update status.md
9e7e278
to
e284c46
Compare
You can preview e284c46 at https://pr23232-e284c46.ngbuilds.io/. |
|
So there's good news and bad news. 👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there. 😕 The bad news is that it appears that one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that here in the pull request. Note to project maintainer: This is a terminal state, meaning the |
A Googler has manually verified that the CLAs look good. (Googler, please make sure the reason for overriding the CLA status is clearly documented in these comments.) |
You can preview 292f37d at https://pr23232-292f37d.ngbuilds.io/. |
@@ -25,8 +25,12 @@ export class Identifiers { | |||
|
|||
static elementAttribute: o.ExternalReference = {name: 'ɵa', moduleName: CORE}; | |||
|
|||
static elementClass: o.ExternalReference = {name: 'ɵk', moduleName: CORE}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please update environment.ts with that.
Also may be add a comment in this file and environment.ts to remember to keep them in sync.
Thanks
Edit: The instructions are actually already there.
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
No description provided.