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): attribute ast records span of the value #12132

Merged
merged 1 commit into from
Oct 7, 2016

Conversation

chuckjaz
Copy link
Contributor

@chuckjaz chuckjaz commented Oct 6, 2016

Please check if the PR fulfills these requirements

What kind of change does this PR introduce? (check one with "x")

[x] Refactoring (no functional changes, no api changes)

What is the current behavior? (You can also link to an open issue here)

The Attribute class of the HTML AST does not record where the value is the source. This information is needed in the language service.

What is the new behavior?

The Attribute class records the span of the value of the attribute if the attribute has a value.

Does this PR introduce a breaking change? (check one with "x")

[ ] Yes
[x] No

@chuckjaz chuckjaz added the action: review The PR is still awaiting reviews from at least one requested reviewer label Oct 6, 2016
@chuckjaz chuckjaz added the area: core Issues related to the framework runtime label Oct 6, 2016
const ast = parser.parse('<div bar="12"></div>', 'TestComp');
const attr = (ast.rootNodes[0] as html.Element).attrs[0];
expect(attr.valueSpan.start.offset).toEqual(9);
expect(attr.valueSpan.end.offset).toEqual(13);
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: expect(attr.valueSpan.toString()).toEqual('12') ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I prefer the direct comparison to a number than converting to a string.

@vicb vicb added pr_state: LGTM and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Oct 6, 2016
@chuckjaz chuckjaz added the action: merge The PR is ready for merge by the caretaker label Oct 7, 2016
@tbosch tbosch merged commit 709a6de into angular:master Oct 7, 2016
@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 9, 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 area: core Issues related to the framework runtime cla: yes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants