Bug 262490 - ES6 editor should support variables declared directly in class
ES6 editor should support variables declared directly in class
Status: VERIFIED FIXED
Product: javascript
Classification: Unclassified
Component: Editor
8.2
PC Linux
: P2 (vote)
: 8.2
Assigned To: Petr Hejl
issues@javascript
:
Depends on:
Blocks: 242387
  Show dependency treegraph
 
Reported: 2016-06-20 18:45 UTC by Jenselme
Modified: 2016-06-29 20:47 UTC (History)
2 users (show)

See Also:
Issue Type: ENHANCEMENT
:


Attachments
Wrong colors when varialbe directly in class (7.49 KB, image/png)
2016-06-20 18:45 UTC, Jenselme
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jenselme 2016-06-20 18:45:42 UTC
Created attachment 160100 [details]
Wrong colors when varialbe directly in class

When two variables or more are declared directly in the class (and not in a function), syntax highlighting doesn't work as expected (see attached screenshot).

I don't know if it is part of the standard or not, but some code is written that way (for instance in the Aurelia framework: https://github.com/aurelia/framework/blob/master/src/framework-configuration.js#L117). Furthermore, the babel transpiller handles this code fine and VSCode doesn't report it as an error.

Expected result: the code is parsed, function names are highlighted correctly and no error is reported.

Sample code:

export class Test {
    name = 'test';
    test;

    constructor() {
        
    }
}

So, this code works fine:

export class Test {
    name = 'test';
    test;

    constructor() {
        
    }
}
Comment 1 Petr Pisl 2016-06-21 13:25:30 UTC
This is not standard ES6. Marking as enhancement.
Comment 2 Petr Hejl 2016-06-21 13:38:11 UTC
This is ES7 feature.
https://github.com/jeffmo/es-class-fields-and-static-properties
Comment 3 Petr Hejl 2016-06-29 13:33:51 UTC
Fixed in trunk.
Comment 4 Jenselme 2016-06-29 20:47:45 UTC
This works perfectly. Thanks. +1 for support of experimental ES7.


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo