function assert(cond) { | |
if (!cond) | |
throw new Error("broke assertion"); | |
} | |
noInline(assert); | |
function shouldThrowInvalidConstAssignment(f) { | |
var threw = false; | |
try { | |
f(); | |
} catch(e) { | |
if (e.name.indexOf("TypeError") !== -1 && e.message.indexOf("readonly") !== -1) | |
threw = true; | |
} | |
assert(threw); | |
} | |
noInline(shouldThrowInvalidConstAssignment); | |
const constValue = "const"; | |
const {a: destructureObj} = {a: 20}; | |
const [destructureArr] = [40]; |