Преглед изворни кода

Check for AsyncGenerator in FillScopeObject

rhuanjl пре 4 година
родитељ
комит
862372ec20

+ 2 - 2
lib/Runtime/Language/JavascriptOperators.cpp

@@ -7497,8 +7497,8 @@ SetElementIHelper_INDEX_TYPE_IS_NUMBER:
                 DynamicType* newType = nullptr;
                 if (nonSimpleParamList)
                 {
-                    bool skipLetAttrForArguments = ((JavascriptGeneratorFunction::IsBaseGeneratorFunction(funcCallee) || VarIs<JavascriptAsyncFunction>(funcCallee)) ?
-                        VarTo<JavascriptGeneratorFunction>(funcCallee)->GetGeneratorVirtualScriptFunction()->GetFunctionBody()->HasReferenceableBuiltInArguments()
+                    bool skipLetAttrForArguments = ( VarIs<JavascriptGeneratorFunction>(funcCallee) ?
+                        UnsafeVarTo<JavascriptGeneratorFunction>(funcCallee)->GetGeneratorVirtualScriptFunction()->GetFunctionBody()->HasReferenceableBuiltInArguments()
                         : funcCallee->GetFunctionBody()->HasReferenceableBuiltInArguments());
 
                     if (skipLetAttrForArguments)

+ 10 - 0
test/es7/async-generator-functionality.js

@@ -1,5 +1,6 @@
 //-------------------------------------------------------------------------------------------------------
 // Copyright (C) Microsoft. All rights reserved.
+// Copyright (c) 2021 ChakraCore Project Contributors. All rights reserved.
 // Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
 //-------------------------------------------------------------------------------------------------------
 
@@ -247,6 +248,15 @@ const tests = [
                 ErrorPromise(this.name, ag.return.call(input), TypeError, `AsyncGenerator.prototype.return should reject with TypeError when called on ${typeof input} ${input}`);
             }
         }
+    },
+    {
+        name : "AsyncGenerator with complex params containing eval",
+        body() {
+            async function* agf(param = 0) {
+                eval('');
+            }
+            AddPromise(this.name, "Evaluate complex params and perform eval - but nothing to do should close", agf().next(), {done : true});
+        }
     }
 ];