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(compiler): some template parser refactorings #38581

Conversation

petebacondarwin
Copy link
Member

@petebacondarwin petebacondarwin commented Aug 25, 2020

These refactorings are preparation for implementation of the new ng-linker.
See individual commits for the details.

@petebacondarwin petebacondarwin added area: compiler Issues related to `ngc`, Angular's template compiler refactoring Issue that involves refactoring or code-cleanup labels Aug 25, 2020
@ngbot ngbot bot added this to the needsTriage milestone Aug 25, 2020
@petebacondarwin petebacondarwin added the target: major This PR is targeted for the next major release label Aug 26, 2020
@petebacondarwin petebacondarwin changed the title refactor(compiler): move the line-ending handling decision refactor(compiler): some template parser refactorings Aug 26, 2020
@petebacondarwin petebacondarwin force-pushed the linker-template-line-ending-normalization branch from 4bb52a4 to a5bfea1 Compare August 26, 2020 11:23
@petebacondarwin petebacondarwin marked this pull request as ready for review August 26, 2020 11:29
@petebacondarwin petebacondarwin added this to In progress in ng-linker via automation Aug 26, 2020
@petebacondarwin petebacondarwin force-pushed the linker-template-line-ending-normalization branch from a5bfea1 to 54ccb49 Compare August 26, 2020 11:38
@pullapprove pullapprove bot requested a review from ayazhafiz August 26, 2020 11:38
@petebacondarwin petebacondarwin force-pushed the linker-template-line-ending-normalization branch 2 times, most recently from 2ca14a1 to 8988283 Compare August 26, 2020 13:14
ng-linker automation moved this from In progress to Reviewer approved Aug 26, 2020
Copy link
Member

@ayazhafiz ayazhafiz left a comment

Choose a reason for hiding this comment

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

LGTM for language service

@petebacondarwin petebacondarwin moved this from Reviewer approved to Review in progress in ng-linker Aug 26, 2020
@JoostK JoostK added the action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews label Aug 26, 2020
@JoostK JoostK moved this from Review in progress to In progress in ng-linker Aug 26, 2020
@petebacondarwin petebacondarwin added action: review The PR is still awaiting reviews from at least one requested reviewer 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 Aug 26, 2020
@petebacondarwin petebacondarwin force-pushed the linker-template-line-ending-normalization branch 2 times, most recently from 43c0723 to 3b36af6 Compare August 28, 2020 09:15
@alxhub
Copy link
Member

alxhub commented Aug 28, 2020

Presubmit

Previously the lexer was responsible for deciding whether an "inline"
template should also have its line-endings normalized.

Now this decision is made higher up in the call stack to allow more
flexibility in the parser/lexer.
Previously, the `startSourceSpan` property could be null
but in reality it is always well defined - except for a legacy
case in the old i18n extraction/merging code, where the
typings for source-spans are already being undermined.

Making this property non-null, simplifies code elsewhere
in the project.
Previously, the `sourceSpan` and `startSourceSpan` were the same
object, which meant that you had the following situation:

```
element = <div>some content</div>
sourceSpan = <div>
startSourceSpan = <div>
endSourceSpan = </div>
```

This made `sourceSpan` redundant and meant that if you
wanted a span for the whole element including its content
and closing tag, it had to be computed.

Now `sourceSpan` is separated from `startSourceSpan`
resulting in:

```
element = <div>some content</div>
sourceSpan = <div>some content</div>
startSourceSpan = <div>
endSourceSpan = </div>
```
@petebacondarwin petebacondarwin force-pushed the linker-template-line-ending-normalization branch from 3b36af6 to 8977558 Compare September 1, 2020 12:56
@petebacondarwin petebacondarwin 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 Sep 2, 2020
@atscott atscott closed this in 86e11f1 Sep 2, 2020
ng-linker automation moved this from In progress to Done Sep 2, 2020
atscott pushed a commit that referenced this pull request Sep 2, 2020
Previously, the `startSourceSpan` property could be null
but in reality it is always well defined - except for a legacy
case in the old i18n extraction/merging code, where the
typings for source-spans are already being undermined.

Making this property non-null, simplifies code elsewhere
in the project.

PR Close #38581
atscott pushed a commit that referenced this pull request Sep 2, 2020
…38581)

Previously, the `sourceSpan` and `startSourceSpan` were the same
object, which meant that you had the following situation:

```
element = <div>some content</div>
sourceSpan = <div>
startSourceSpan = <div>
endSourceSpan = </div>
```

This made `sourceSpan` redundant and meant that if you
wanted a span for the whole element including its content
and closing tag, it had to be computed.

Now `sourceSpan` is separated from `startSourceSpan`
resulting in:

```
element = <div>some content</div>
sourceSpan = <div>some content</div>
startSourceSpan = <div>
endSourceSpan = </div>
```

PR Close #38581
@petebacondarwin petebacondarwin deleted the linker-template-line-ending-normalization branch September 3, 2020 07:21
profanis pushed a commit to profanis/angular that referenced this pull request Sep 5, 2020
…8581)

Previously the lexer was responsible for deciding whether an "inline"
template should also have its line-endings normalized.

Now this decision is made higher up in the call stack to allow more
flexibility in the parser/lexer.

PR Close angular#38581
profanis pushed a commit to profanis/angular that referenced this pull request Sep 5, 2020
Previously, the `startSourceSpan` property could be null
but in reality it is always well defined - except for a legacy
case in the old i18n extraction/merging code, where the
typings for source-spans are already being undermined.

Making this property non-null, simplifies code elsewhere
in the project.

PR Close angular#38581
profanis pushed a commit to profanis/angular that referenced this pull request Sep 5, 2020
…ngular#38581)

Previously, the `sourceSpan` and `startSourceSpan` were the same
object, which meant that you had the following situation:

```
element = <div>some content</div>
sourceSpan = <div>
startSourceSpan = <div>
endSourceSpan = </div>
```

This made `sourceSpan` redundant and meant that if you
wanted a span for the whole element including its content
and closing tag, it had to be computed.

Now `sourceSpan` is separated from `startSourceSpan`
resulting in:

```
element = <div>some content</div>
sourceSpan = <div>some content</div>
startSourceSpan = <div>
endSourceSpan = </div>
```

PR Close angular#38581
@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 Oct 4, 2020
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 area: compiler Issues related to `ngc`, Angular's template compiler cla: yes refactoring Issue that involves refactoring or code-cleanup target: major This PR is targeted for the next major release
Projects
No open projects
ng-linker
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

5 participants