Skip to content

Commit

Permalink
[MERGE #5799 @wyrichte] Fails AsmJs.cpp's module return check if a pr…
Browse files Browse the repository at this point in the history
…operty definition in the return object literal is not a binary parse node.

Merge pull request #5799 from wyrichte:build/wyrichte/asm_async
  • Loading branch information
wyrichte committed Oct 26, 2018
2 parents 276661f + a24ede7 commit 96c3c33
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/Runtime/Language/AsmJs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -851,6 +851,11 @@ namespace Js

if( member )
{
if (!(member->Grfnop() & fnopBin))
{
return m.Fail(node, _u("Return object member must be an assignment expression"));
}

ParseNode* field = ParserWrapper::GetBinaryLeft( member );
ParseNode* value = ParserWrapper::GetBinaryRight( member );
if( !ParserWrapper::IsNameDeclaration( field ) || !ParserWrapper::IsNameDeclaration( value ) )
Expand Down
2 changes: 2 additions & 0 deletions test/AsmJs/notBinaryPropertyDefinition.baseline
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Return object member must be an assignment expression
Asm.js compilation failed.
9 changes: 9 additions & 0 deletions test/AsmJs/notBinaryPropertyDefinition.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
//-------------------------------------------------------------------------------------------------------
// Copyright (C) Microsoft Corporation and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
//-------------------------------------------------------------------------------------------------------

function f() {
"use asm";
return { ...a, b };
}
7 changes: 7 additions & 0 deletions test/AsmJs/rlexe.xml
Original file line number Diff line number Diff line change
Expand Up @@ -987,6 +987,13 @@
<compile-flags>-forcedeferparse -testtrace:asmjs</compile-flags>
</default>
</test>
<test>
<default>
<files>notBinaryPropertyDefinition.js</files>
<baseline>notBinaryPropertyDefinition.baseline</baseline>
<compile-flags>-ES2018ObjectRestSpread -testtrace:asmjs</compile-flags>
</default>
</test>
<test>
<default>
<files>constbrbug.js</files>
Expand Down

0 comments on commit 96c3c33

Please sign in to comment.