// 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]
features: [async-functions]
---*/

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);
