From 28c6ea208d2e4106420bb322b2d06f2570edc266 Mon Sep 17 00:00:00 2001 From: Toru Nagashima Date: Tue, 23 Jun 2020 02:58:06 +0900 Subject: [PATCH] add eval-optional-call.js (#2667) --- .../optional-chaining/eval-optional-call.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 test/language/expressions/optional-chaining/eval-optional-call.js diff --git a/test/language/expressions/optional-chaining/eval-optional-call.js b/test/language/expressions/optional-chaining/eval-optional-call.js new file mode 100644 index 0000000000..d37538bc73 --- /dev/null +++ b/test/language/expressions/optional-chaining/eval-optional-call.js @@ -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);