Using SDK version 2.2.0 and DDC, the following test program will generate a SyntaxError due to the use of the switch fallthrough continue syntax described at https://www.dartlang.org/guides/language/language-tour#switch-and-case:
void main() {
String startsWith = 'HI';
switch (startsWith) {
case 'HI':
print('H');
continue i;
i:
case 'I':
print('I');
break;
}
}
I can't reconstruct this: Trying this with dart and dart2js version 2.1.1-dev.3.2 as well as a fresh one from commit b7a5e478bbdd3d439db2726578585bc6346eaa2f, I get no compile-time errors, plus it prints both H and I. I see the same behavior with an ancient dart 1.10.1.
Could your installation of the Dart tools and system be out of order?
@eernstg It works as expected with dart2js, but it does not work when compiled with DDC.
DDC:
pub run build_runner serve web:8080
// Console output:
H
require.js:143 Uncaught SyntaxError: Undefined label 'i'
at main.dart.bootstrap.js:237
at Object.execCb (require.js:1696)
at Module.check (require.js:878)
at Module.<anonymous> (require.js:1139)
at require.js:134
at require.js:1189
at each (require.js:59)
at Module.emit (require.js:1188)
at Module.check (require.js:938)
at Module.<anonymous> (require.js:1139)
at require.js:134
at require.js:1189
at each (require.js:59)
at Module.emit (require.js:1188)
at Module.check (require.js:938)
at Module.enable (require.js:1176)
at Module.init (require.js:788)
at callGetModule (require.js:1203)
at Object.completeLoad (require.js:1590)
at HTMLScriptElement.onScriptLoad (require.js:1717)
dart2js:
pub run build_runner serve web:8080 -r
// Console output:
H
I
This appears to be fixed in 2.3.1 (both ddc-analyzer and ddc-kernel).
Most helpful comment
This appears to be fixed in
2.3.1(both ddc-analyzer and ddc-kernel).