// This test case is made to be run with --ion-eager.
function ret2() { return 2;
}
// Check with default case in the middle. function test0(x) { var res = 0; switch (x) { case (res |= 0x40, 1): // x === 1
res |= 0x1; default: // otherwise
res |= 0x2; case (res |= 0x80, ret2()): // x === 2
res |= 0x4; case (res |= 0x100, 1 + ret2()): // x === 3
res |= 0x8; break; case (res |= 0x200, 0): // x === 0
res |= 0x10;
}
res |= 0x20; return res;
}
// Check with no default and only one case. function test1(x) { var res = 0; switch (x) { case (res |= 0x1, ret2()): // x === 2
res |= 0x2;
}
res |= 0x4; return res;
}
// Check with default case identical to a case. function test2(x) { var res = 0; switch (x) { case (res |= 0x1, 0):
res |= 0x10; break; default: case (res |= 0x2, 1):
res |= 0x20; break; case (res |= 0x4, ret2()): // x === 2
res |= 0x40;
}
res |= 0x100; return res;
}
// Check a non-break, non-empty default at the end. function test3(x) { var res = 0; switch (x) { case (res |= 0x1, 1):
res |= 0x10; case (res |= 0x2, ret2()): // x === 2
res |= 0x20; default:
res |= 0x40;
}
res |= 0x100; return res;
}
// Check cfg in condition of non-last case with no break. (reverse post order failure ?) function test4(x) { var res = 0; switch (x) { case (res |= 0x1, (x ? 1 : 0)):
res |= 0x10; case (res |= 0x2, ret2()): // x === 2
res |= 0x20;
}
res |= 0x100; return res;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.