Skip to content
Browse files

Fix loop protect thinking default cases are loop labels

1 parent 5f63eb7 commit 0e16ab515cb191a6adfc4e9210c1f0b0b9fa4677 @ltegman ltegman committed with BerkeleyTrue
Showing with 3 additions and 3 deletions.
  1. +1 −1 gulpfile.js
  2. +2 −2 public/js/lib/loop-protect/loop-protect.js
View
2 gulpfile.js
@@ -521,7 +521,7 @@ gulp.task('reload', function() {
gulp.task('watch', watchDependents, function() { gulp.task('watch', watchDependents, function() {
gulp.watch(paths.lessFiles, ['less']); gulp.watch(paths.lessFiles, ['less']);
- gulp.watch(paths.js, ['js']); + gulp.watch(paths.js.concat(paths.vendorChallenges), ['js']);
gulp.watch(paths.challenges, ['test-challenges', 'reload']); gulp.watch(paths.challenges, ['test-challenges', 'reload']);
gulp.watch(paths.js, ['js', 'dependents']); gulp.watch(paths.js, ['js', 'dependents']);
gulp.watch( gulp.watch(
View
4 public/js/lib/loop-protect/loop-protect.js
@@ -18,7 +18,7 @@ if (typeof DEBUG === 'undefined') { DEBUG = true; }
// the standard loops - note that recursive is not supported // the standard loops - note that recursive is not supported
var re = /\b(for|while|do)\b/g; var re = /\b(for|while|do)\b/g;
var reSingle = /\b(for|while|do)\b/; var reSingle = /\b(for|while|do)\b/;
- var labelRe = /\b([a-z_]{1}\w+:)/i; + var labelRe = /\b(?!default:)([a-z_]{1}\w+:)/i;
var comments = /(?:\/\*(?:[\s\S]*?)\*\/)|(?:([\s;])+\/\/(?:.*)$)/gm; var comments = /(?:\/\*(?:[\s\S]*?)\*\/)|(?:([\s;])+\/\/(?:.*)$)/gm;
var loopTimeout = 1000; var loopTimeout = 1000;
@@ -136,7 +136,7 @@ if (typeof DEBUG === 'undefined') { DEBUG = true; }
// so that we insert in to the correct location (instead of possibly // so that we insert in to the correct location (instead of possibly
// outside the logic // outside the logic
return line.slice(0, matchPosition) + ';' + method + '({ line: ' + lineNum + ', reset: true }); ' + line.slice(matchPosition); return line.slice(0, matchPosition) + ';' + method + '({ line: ' + lineNum + ', reset: true }); ' + line.slice(matchPosition);
- }; + }
if (!offset) { if (!offset) {
offset = 0; offset = 0;

0 comments on commit 0e16ab5

Please sign in to comment.
Something went wrong with that request. Please try again.