Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.