mirror of
https://github.com/espruino/Espruino.git
synced 2025-12-08 19:06:15 +00:00
Stop warning about break at the end of 'default' in switch statement
This commit is contained in:
parent
a0dee715d3
commit
8fa1c554e9
@ -14,6 +14,7 @@
|
||||
Added throw and try..catch..finally (see #40)
|
||||
Fixed overriding of builtins with other Builtins
|
||||
Added Date.valueOf
|
||||
Stop warning about break at the end of 'default' in switch statement
|
||||
|
||||
1v64 : Fix 'a=[2,3,4];delete a[1];'
|
||||
Make sure parseInt("0x01",16)==1 and parseInt("0x01")==1 but parseInt("0b01",16)==0
|
||||
|
||||
@ -1622,8 +1622,11 @@ NO_INLINE JsVar *jspeStatementSwitch() {
|
||||
JSP_MATCH(':');
|
||||
JSP_SAVE_EXECUTE();
|
||||
if (hasExecuted) jspSetNoExecute();
|
||||
else execInfo.execute |= EXEC_IN_SWITCH;
|
||||
while (!JSP_SHOULDNT_PARSE && execInfo.lex->tk!=LEX_EOF && execInfo.lex->tk!='}')
|
||||
jsvUnLock(jspeBlockOrStatement());
|
||||
if (execute && !hasExecuted)
|
||||
execInfo.execute = execInfo.execute & (JsExecFlags)~EXEC_BREAK;
|
||||
JSP_RESTORE_EXECUTE();
|
||||
}
|
||||
JSP_MATCH('}');
|
||||
|
||||
8
tests/test_switch_default_break.js
Normal file
8
tests/test_switch_default_break.js
Normal file
@ -0,0 +1,8 @@
|
||||
// Espruino complains about breaks at the end of 'default' - it shouldn't
|
||||
|
||||
switch(2){
|
||||
case 1:break;
|
||||
default:break;
|
||||
}
|
||||
|
||||
result = 1;
|
||||
Loading…
x
Reference in New Issue
Block a user