Language-tools: Await then without variable

Created on 13 Jun 2020  ·  3Comments  ·  Source: sveltejs/language-tools

Describe the bug
I'm getting the error Cannot read property 'end' of null when using the {:then} without a variable.

To Reproduce

<script>
  let promise;
</script>

{#await promise}
  Loading...
{:then}
  Loaded!
{/await}

Expected behavior
No error.

Screenshots
image

Additional context
Output:

Error walking node  {
  start: 35,
  end: 83,
  type: 'AwaitBlock',
  expression: Node {
    type: 'Identifier',
    start: 43,
    end: 50,
    loc: SourceLocation { start: [Position], end: [Position] },
    name: 'promise'
  },
  value: null,
  error: null,
  pending: {
    start: 51,
    end: 61,
    type: 'PendingBlock',
    children: [ [Object] ],
    skip: false
  },
  then: {
    start: 61,
    end: 75,
    type: 'ThenBlock',
    children: [ [Object] ],
    skip: false
  },
  catch: {
    start: null,
    end: null,
    type: 'CatchBlock',
    children: [],
    skip: true
  }
}
bug

Most helpful comment

Thanks @skippednote ! Fix should be available in about 12 hours.

All 3 comments

nice one. i put out a request for first time contributors as this is a good first issue. happy to help whoever tries to tackle this.

Hey there 👋
I've started looking into this and have raised a pull request #189.

Thanks @skippednote ! Fix should be available in about 12 hours.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

JoeDailey picture JoeDailey  ·  6Comments

canadaduane picture canadaduane  ·  5Comments

JAD3N picture JAD3N  ·  5Comments

AlexGalays picture AlexGalays  ·  5Comments

matthewmueller picture matthewmueller  ·  3Comments