Skip to content

Commit

Permalink
Fix loop protect thinking default cases are loop labels
Browse files Browse the repository at this point in the history
  • Loading branch information
ltegman committed Jan 8, 2016
1 parent 23cb3e9 commit 5d6808e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ var Rx = require('rx'),
// lint
jsonlint = require('gulp-jsonlint'),
eslint = require('gulp-eslint'),

// unit-tests
tape = require('gulp-tape'),
tapSpec = require('tap-spec');
Expand Down Expand Up @@ -517,7 +517,7 @@ gulp.task('reload', function() {

gulp.task('watch', watchDependents, function() {
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.js, ['js', 'dependents']);
gulp.watch(
Expand Down
4 changes: 2 additions & 2 deletions public/js/lib/loop-protect/loop-protect.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ if (typeof DEBUG === 'undefined') { DEBUG = true; }
// the standard loops - note that recursive is not supported
var re = /\b(for|while|do)\b/g;
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 loopTimeout = 1000;

Expand Down Expand Up @@ -131,7 +131,7 @@ if (typeof DEBUG === 'undefined') { DEBUG = true; }
// so that we insert in to the correct location (instead of possibly
// outside the logic
return line.slice(0, matchPosition) + ';' + method + '({ line: ' + lineNum + ', reset: true }); ' + line.slice(matchPosition);
};
}

if (!offset) {
offset = 0;
Expand Down

0 comments on commit 5d6808e

Please sign in to comment.