blob: 234f5d4eb6b8f03da8a487711e24ca575e21b256 [file] [log] [blame]
Ben Murdoch61f157c2016-09-16 13:49:30 +01001// Copyright 2015 the V8 project authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5// Flags: --allow-natives-syntax
6
7function assertAsync(b, s) {
8 if (!b) {
9 %AbortJS(" FAILED!")
10 }
11}
12
13class P extends Promise {
14 constructor() {
15 super(...arguments)
16 return new Proxy(this, {
17 get: (_, key) => {
18 return key == 'then' ?
19 this.then.bind(this) :
20 this.constructor.resolve(20)
21 }
22 })
23 }
24}
25
26let p = P.resolve(10)
27p.key.then(v => assertAsync(v === 20));