This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
|Component:||Editor||Assignee:||Petr Pisl <ppisl>|
|Severity:||normal||CC:||chrizzly, linh_ray, meanyack, peterkehl, pjiricka, rednael|
|OS:||Windows 7 x64|
|Issue Type:||DEFECT||Exception Reporter:|
Description geverl 2013-02-21 19:43:39 UTC
NB 7.2 handled this fine, but NB 7.3 claims "Expected an operand but found const" for a simple line like this one: const pi = 3.14;
Comment 1 Petr Pisl 2013-02-21 20:49:46 UTC
This comes from parser. In NB 7.2 was used Rhino parser, in NB 7.3 is used Nashorn parser. The current implementation of const is a Mozilla-specific extension and is not part of ECMAScript 5 and this is the reason, why it worked in NB 7.2. The Rhino parser is Mozilla's parser. The proper fix should be on parser site, in NetBeans I can filter the message, but is not very nice approach.
Comment 2 meanyack 2013-02-26 12:07:16 UTC
I made some tests, Chrome and Mozilla handles const keyword. However, even internet explorer 10 fails. Therefore, it's safe not to use const keyword.
Comment 3 geverl 2013-02-26 16:14:53 UTC
Comment 4 Petr Pisl 2013-02-26 18:49:41 UTC
Comment 5 geverl 2013-02-26 20:41:16 UTC
OK, thanks for your explanations. I can live without const, so I'm just going to mark this as resolved.
Comment 6 Lope 2013-08-26 19:07:08 UTC
I make use of many libraries that use const and as a result Netbeans is not working properly. Lets at least add an option to ignore this parser error?
Comment 7 jnurthen 2013-09-27 20:29:12 UTC
I want to echo the comment to let us ignore the error. I sometimes work with libraries which use const and am developing code which is mozilla-only (for an Add-on). I don't care that IE doesn't support it, I just need to suppress the errors without having to revert back to 7.2
Comment 8 Vladimir Riha 2014-01-02 07:03:55 UTC
*** Bug 239881 has been marked as a duplicate of this bug. ***
Comment 9 peterkehl 2014-05-06 23:01:07 UTC
'const' is not in ECMAScript 5, but it will be in ECMAScript 6: http://wiki.ecmascript.org/doku.php?id=harmony:specification_drafts#current_working_draft As others, I also depend on 'const' because I develop Mozilla add-ons. Please, implement this.
Comment 10 Christian Lenz 2014-07-01 11:02:15 UTC
Have to use it too, and the IDE shows me the same error: "Expected an operand but found const". Voted.
Comment 11 peterkehl 2014-10-16 22:42:08 UTC