<p dir="auto">await does not works on method of super class</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="class Animal {
  constructor() {
  }

  async walk() {
    console.log('animal walk')
  }
}

class Dog extends Animal {
  constructor() {
    super();
  }

  async walk() {
    await super.walk();
    console.log('dog walk');
  }
}"><pre class="notranslate"><code class="notranslate">class Animal {
  constructor() {
  }

  async walk() {
    console.log('animal walk')
  }
}

class Dog extends Animal {
  constructor() {
    super();
  }

  async walk() {
    await super.walk();
    console.log('dog walk');
  }
}
</code></pre></div>
<p dir="auto">I suppose this piece of code should work, but It doesn't, as method walk of Dog will be transformed to</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="class Dog extends Animal {
  ...

  walk() {
      return __awaiter(this, void 0, Promise, function* () {
          yield super.walk();
          console.log('dog walk');
      });
  }
}"><pre class="notranslate"><code class="notranslate">class Dog extends Animal {
  ...

  walk() {
      return __awaiter(this, void 0, Promise, function* () {
          yield super.walk();
          console.log('dog walk');
      });
  }
}
</code></pre></div>
<p dir="auto">but the specification says keyword 'super' is only permitted in a constructor, method call and member accessor in derived class.</p>
<p dir="auto">Given the TypeScript:</p>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="class B extends A {
  async method() { 
    super.superMethod();
  }
}"><pre class="notranslate"><span class="pl-k">class</span> <span class="pl-smi">B</span> <span class="pl-k">extends</span> <span class="pl-smi">A</span> <span class="pl-kos">{</span>
  <span class="pl-k">async</span> <span class="pl-en">method</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-kos">{</span> 
    <span class="pl-smi">super</span><span class="pl-kos">.</span><span class="pl-en">superMethod</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
  <span class="pl-kos">}</span>
<span class="pl-kos">}</span></pre></div>
<p dir="auto">We emit the following JavaScript:</p>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="var __awaiter = ...;
class B extends A {
  method() {
    return __awaiter(this, void 0, Promise, function* () {
      super.superMethod(); // Error
    });
  }
}"><pre class="notranslate"><span class="pl-k">var</span> <span class="pl-s1">__awaiter</span> <span class="pl-c1">=</span> ...<span class="pl-kos">;</span>
<span class="pl-k">class</span> <span class="pl-smi">B</span> <span class="pl-k">extends</span> <span class="pl-smi">A</span> <span class="pl-kos">{</span>
  <span class="pl-en">method</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
    <span class="pl-k">return</span> <span class="pl-en">__awaiter</span><span class="pl-kos">(</span><span class="pl-smi">this</span><span class="pl-kos">,</span> <span class="pl-k">void</span> <span class="pl-c1">0</span><span class="pl-kos">,</span> <span class="pl-smi">Promise</span><span class="pl-kos">,</span> <span class="pl-k">function</span><span class="pl-c1">*</span> <span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
      <span class="pl-smi">super</span><span class="pl-kos">.</span><span class="pl-en">superMethod</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">;</span> <span class="pl-c">// Error</span>
    <span class="pl-kos">}</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
  <span class="pl-kos">}</span>
<span class="pl-kos">}</span></pre></div>
<p dir="auto">However, <code class="notranslate">super</code> is not bound inside the generator function.</p>
<p dir="auto">We may instead want to consider changing the emit to the following:</p>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="var __awaiter = ...;
class B extends A {
  method() {
    return __awaiter(this, void 0, Promise, B.prototype._method_async);
  }
  *_method_async() {
    super.superMethod(); // No error
  }
}"><pre class="notranslate"><span class="pl-k">var</span> <span class="pl-s1">__awaiter</span> <span class="pl-c1">=</span> ...<span class="pl-kos">;</span>
<span class="pl-k">class</span> <span class="pl-smi">B</span> <span class="pl-k">extends</span> <span class="pl-smi">A</span> <span class="pl-kos">{</span>
  <span class="pl-en">method</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
    <span class="pl-k">return</span> <span class="pl-en">__awaiter</span><span class="pl-kos">(</span><span class="pl-smi">this</span><span class="pl-kos">,</span> <span class="pl-k">void</span> <span class="pl-c1">0</span><span class="pl-kos">,</span> <span class="pl-smi">Promise</span><span class="pl-kos">,</span> <span class="pl-smi">B</span><span class="pl-kos">.</span><span class="pl-c1">prototype</span><span class="pl-kos">.</span><span class="pl-c1">_method_async</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
  <span class="pl-kos">}</span>
  <span class="pl-c1">*</span><span class="pl-en">_method_async</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
    <span class="pl-smi">super</span><span class="pl-kos">.</span><span class="pl-en">superMethod</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">;</span> <span class="pl-c">// No error</span>
  <span class="pl-kos">}</span>
<span class="pl-kos">}</span></pre></div>
<p dir="auto">In this case the <code class="notranslate">super</code> binding in <code class="notranslate">_method_async</code> works as expected. Also, we pass <code class="notranslate">B.prototype._method_async</code> to <code class="notranslate">__awaiter</code> here, rather than <code class="notranslate">this._method_async</code> so that we will won't need to worry about collisions. Note, though, that we will need to take class expressions into consideration here, as they may not always have a reachable name.</p>