add eval-optional-call.js (#2667)

This commit is contained in:
Toru Nagashima 2020-06-23 02:58:06 +09:00 committed by GitHub
parent 5908ed29ac
commit 28c6ea208d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 19 additions and 0 deletions

View File

@ -0,0 +1,19 @@
// Copyright 2020 Toru Nagashima. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-optional-chaining-chain-evaluation
description: optional call invoked on eval function should be indirect eval.
info: |
12.3.9.2 Runtime Semantics: ChainEvaluation
OptionalChain: ?. Arguments
1. Let thisChain be this OptionalChain.
2. Let tailCall be IsInTailPosition(thisChain).
3. Return ? EvaluateCall(baseValue, baseReference, Arguments, tailCall).
features: [optional-chaining]
---*/
const a = "global";
const b = (a => eval?.("a"))("local")
assert.sameValue(b, a);