Permalink
Browse files

added line breaking error on 'return' statement with and without asi …

…option (when it's broken, fix it).
  • Loading branch information...
1 parent f3d3a0f commit 9a50821f7dae23030ca7eb52d580d43acd7b89c0 @guyzmo committed Mar 24, 2013
Showing with 4 additions and 1 deletion.
  1. +1 −1 src/stable/jshint.js
  2. +2 −0 tests/stable/unit/options.js
  3. +1 −0 tests/stable/unit/parser.js
View
@@ -3565,7 +3565,7 @@ var JSHINT = (function () {
warningAt("W093", this.first.line, this.first.character);
}
}
- } else if (!state.option.asi) {
+ } else {
nolinebreak(this); // always warn (Line breaking error)
}
reachable("return");
@@ -338,6 +338,8 @@ exports.asi = function (test) {
TestRun(test, 2)
.addError(2, "Missing semicolon.") // throw on "use strict", even option asi is used
+ .addError(4, "Line breaking error 'return'.")
+ .addError(17, "Line breaking error 'return'.")
.test(src, { asi: true });
test.done();
@@ -2966,6 +2966,7 @@ exports["automatic comma insertion GH-950"] = function (test) {
var run = TestRun(test)
.addError(2, "Bad line breaking before 'instanceof'.")
.addError(6, "Bad line breaking before '&&'.")
+ .addError(8, "Line breaking error 'return'.")
.addError(9, "Label 'a' on 1 statement.")
.addError(9, "Expected an assignment or function call and instead saw an expression.");

0 comments on commit 9a50821

Please sign in to comment.