Created
March 31, 2016 00:32
-
-
Save anonymous/49715c82e834f8e2c184d35a821ec468 to your computer and use it in GitHub Desktop.
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
function assert(b, i) { | |
if (!b) { | |
throw new Error("Bad") | |
} | |
} | |
function foo(arg) { | |
let o; | |
if (arg) { | |
o = {}; | |
} else { | |
o = function() { } | |
} | |
return typeof o; | |
} | |
noInline(foo); | |
let o1 = {}; | |
let o2 = function() { } | |
for (let i = 0; i < 10000; i++) { | |
let bool = !!(i % 2); | |
let result = foo(bool); | |
if (bool) | |
assert(result === "object"); | |
else | |
assert(result === "function"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment