-
Notifications
You must be signed in to change notification settings - Fork 643
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Correctly restore whether or not a function is an inner generator
Summary: If a generator was large enough to be lazily compiled, we would lose that information when reconstituting the function's context. This meant the function was generated as a regular function instead of a generator. #utd-hermes-ignore-android Reviewed By: tmikov Differential Revision: D23580247 fbshipit-source-id: af5628bf322cbdc7c7cdfbb5f8d0756328518ea1
- Loading branch information
1 parent
cba0416
commit 0918353
Showing
8 changed files
with
64 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/** | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
// RUN: %hermes -lazy %s | %FileCheck %s --match-full-lines | ||
|
||
// Make sure we can correctly resolve scopes through lazily compiled | ||
// functions in lazily compiled generators. | ||
function f() { | ||
var f_var = 10; | ||
function* g() { | ||
var g_var = 32; | ||
function h() { | ||
/* Some text to pad out the function so that it won't be eagerly compiled | ||
* for being too short. Lorem ipsum dolor sit amet, consectetur adipiscing | ||
* elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. | ||
*/ | ||
return f_var + g_var; | ||
} | ||
yield h(); | ||
} | ||
return g().next().value; | ||
} | ||
// CHECK: 42 | ||
print(f()); |