Bug 262491 - Add basic support for decorators as part of the ES6 support
Add basic support for decorators as part of the ES6 support
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:57 UTC by Jenselme
Modified: 2016-06-29 20:47 UTC (History)
2 users (show)

See Also:
Issue Type: ENHANCEMENT
:


Attachments
Decorators and errors (14.96 KB, image/png)
2016-06-20 18:57 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:57:15 UTC
Created attachment 160101 [details]
Decorators and errors

Currently the editor reports decorators as errors (which is fine) but other errors in the document are then not reported (see screenshot).

Event if decorators are not part of the ES6 standard, they will be in ES2016. Moreover, some frameworks already rely on this feature (like aurelia: http://aurelia.io/docs.html#/aurelia/dependency-injection/1.0.0-beta.1.2.2/doc/article/dependency-injection-basics). So do tools like babel.

VSCode reports this as an error with this message:

> Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option to remove this warning.

Expected result: reported as an error with a message stating this is not in ES6.

Example code:

import { inject } from 'aurelia-framework';

@inject()
export class Decorators {
    test() {
        this.;   // Should be  reported as an error.
    }
}
Comment 1 Petr Pisl 2016-06-21 13:12:49 UTC
Treat it as enhancement. The best solution is to extend the parser. But now I would like to stabilize the current functionality and then add new functionality.
Comment 2 Petr Hejl 2016-06-21 13:36:37 UTC
This is ES7 feature.
https://github.com/wycats/javascript-decorators/blob/master/README.md
Comment 3 Petr Hejl 2016-06-29 13:34:12 UTC
Fixed in trunk.
Comment 4 Jenselme 2016-06-29 20:47:22 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