Add if.js example for trees.

This commit is contained in:
Andreas Gal 2008-07-17 16:38:09 -07:00
parent abaf140791
commit 93c1fd0a24
2 changed files with 14 additions and 1 deletions

13
js/src/if.js Normal file
View File

@ -0,0 +1,13 @@
function f() {
var q = 0;
for (var i = 0; i < 100; i++) {
if ((i & 1) == 0)
q++;
else
q--;
}
print(q);
}
f();

View File

@ -1088,7 +1088,7 @@ js_IsLoopExit(JSContext* cx, JSScript* script, jsbytecode* pc)
/* figure out whether this side exit is exitting the loop and don't trace in that case */
jssrcnote* note = js_GetSrcNote(script, pc);
if (!note) /* no note -> BREAK */
return true;
return false;
switch (SN_TYPE(note)) {
case SRC_WHILE:
case SRC_BREAK2LABEL: