Closed Bug 789277 Opened 12 years ago Closed 5 years ago

JSC: "missing ; after statement" message prints out for the line after the problem one

Categories

(Rhino Graveyard :: Compiler, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED INACTIVE

People

(Reporter: robert.flaherty, Unassigned)

Details

User Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Win64; x64; Trident/5.0; .NET CLR 2.0.50727; SLCC2; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; BOIE9;ENUS)

Steps to reproduce:

Create a simple foo.js:

var a = 3
var b = 4;



Actual results:

Warning was:

warning: line 2: missing ; after statement
var b = 4;
...^


Expected results:

Warned the "var a = 3" was missing the semicolon.  I tried monkeying with Parser.java's autoInsertSemicolon() to look at the previous sibling node of pn without any luck.  Using 1.7R4.
I cannot reproduce the warning with 1.7R4. Are there any additional set-up steps required to trigger the warning?
Yes, I set the strict mode on.  I have a related bug #391745, where I have a local copy of Main.java, and now add to processOptions(String args[]):

if (arg.equals("-strict")) {
    compilerEnv.setStrictMode(true);
    compilerEnv.setWarnTrailingComma(true);
    compilerEnv.setReservedKeywordAsIdentifier(false);
    continue;
}
I'm guessing that the parser has moved on to the next token after where a semicolon would have been expected.  When it sees it in strict mode, it spits out what we see (...^ at var).  To be more useful, we would want to see the previous line (with ......^ at the very end).
Thanks, works like a charm!

Closing. Bug management is now done here:
https://github.com/mozilla/rhino

Status: UNCONFIRMED → RESOLVED
Closed: 5 years ago
Resolution: --- → INACTIVE
You need to log in before you can comment on or make changes to this bug.