This repository has been archived by the owner on Feb 12, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 422
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
If a function is referenced before it's natural insertion point,
we cannot apply the optimization that emits "var f = ...bind(...); " calls. Added positive and negative test. While at it, reviewed some places where code emission was delayed for no reason.
- Loading branch information
Showing
5 changed files
with
95 additions
and
58 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// does not contain: bind | ||
(function() { | ||
function f() { | ||
return function() { /* This comment makes this function too big to be inlined */ return 42; } | ||
} | ||
|
||
var f1 = f(); | ||
var f2 = f(); | ||
inspect = function() { return f1() + f2(); } | ||
})(); |
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,22 @@ | ||
(function() { | ||
|
||
function wrap(obj) { | ||
function A() { | ||
return obj.hello(); | ||
} | ||
function B() { | ||
return obj.world(); | ||
} | ||
A.B = B; | ||
return A; | ||
} | ||
|
||
let fooObj = {}; | ||
let fooFn = wrap(fooObj); | ||
let barFn = wrap(fooObj); | ||
fooObj.bar = barFn; | ||
|
||
global.foo = fooFn; | ||
|
||
global.inspect = function() { return true; } | ||
})(); |