aboutsummaryrefslogtreecommitdiffstats
path: root/src/function-forms/error/async-arrow-function.template
blob: a64737742cab8f751a851bbe4a1969ccc32fd1bd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// Copyright (C) 2017 Leo Balter. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
path: language/expressions/async-arrow-function/
name: async arrow function expression
esid: sec-async-arrow-function-definitions
info: |
  14.7 Async Arrow Function Definitions

  AsyncArrowFunction :
    ...
    CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody

  AsyncConciseBody :
    { AsyncFunctionBody }

  ...

  Supplemental Syntax

  When processing an instance of the production AsyncArrowFunction :
  CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody the interpretation of
  CoverCallExpressionAndAsyncArrowHead is refined using the following grammar:

  AsyncArrowHead :
    async ArrowFormalParameters
flags: [async]
---*/

var callCount = 0;
var f;
f = async (/*{ params }*/) => {
  /*{ body }*/
  callCount = callCount + 1;
};

f(/*{ args }*/)
  .then(_ => {
    throw new Test262Error('function should not be resolved');
  }, error => assert.sameValue(error.constructor, /*{ error }*/))
  .then(() => {
    assert.sameValue(callCount, 0, 'function body is not evaluated');
  }, $DONE)
  .then($DONE, $DONE);