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

validate contents of await blocks #1093

Merged
merged 1 commit into from
Jan 11, 2018
Merged

validate contents of await blocks #1093

merged 1 commit into from
Jan 11, 2018

Conversation

Rich-Harris
Copy link
Member

fixes the easiest part of #1061

@codecov-io
Copy link

codecov-io commented Jan 11, 2018

Codecov Report

Merging #1093 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1093      +/-   ##
==========================================
+ Coverage   91.53%   91.54%   +<.01%     
==========================================
  Files         123      123              
  Lines        4477     4481       +4     
  Branches     1443     1444       +1     
==========================================
+ Hits         4098     4102       +4     
  Misses        162      162              
  Partials      217      217
Impacted Files Coverage Δ
src/validate/html/index.ts 97.36% <100%> (+0.3%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9cfa174...5fea63a. Read the comment docs.

@@ -54,6 +54,12 @@ export default function validateHtml(validator: Validator, html: Node) {
if (node.else) {
visit(node.else);
}

if (node.type === 'AwaitBlock') {
Copy link
Member

Choose a reason for hiding this comment

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

What happens if the await block is missing one of these sections? Would visit get called with undefined? It looks like that would throw an exception.

Copy link
Member Author

Choose a reason for hiding this comment

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

That's never the case — see https://github.com/sveltejs/svelte/blob/master/src/parse/state/mustache.ts#L203-L229. If we changed how that worked in future, the tests would fail, so we'd be able to add guards at that point.

@Rich-Harris Rich-Harris merged commit 2537db9 into master Jan 11, 2018
@Rich-Harris Rich-Harris deleted the gh-1061-a branch January 11, 2018 18:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants