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.

Bug 262527 - Marking import expression as error when is used node hash-bang
Summary: Marking import expression as error when is used node hash-bang
Status: RESOLVED FIXED
Alias: None
Product: javascript
Classification: Unclassified
Component: Editor (show other bugs)
Version: 8.2
Hardware: PC Linux
: P3 normal (vote)
Assignee: Petr Pisl
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-06-22 09:26 UTC by Petr Pisl
Modified: 2016-06-23 01:49 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Petr Pisl 2016-06-22 09:26:29 UTC
If there is simple code 

#!/usr/bin/env node
import {basename} from "path"

then the import expression is marked as error.

It's caused, because there is hash-bang on the first line, which is replaced by an anonymous function. So the parsed source then looks like:

(function(){
import {basename} from "path"
}());

We have to change the logic, when to wrap nodejs code to the top level function.
Comment 1 Petr Pisl 2016-06-22 12:11:21 UTC
Fixed in web-main
Comment 2 Quality Engineering 2016-06-23 01:49:30 UTC
Integrated into 'main-silver', will be available in build *201606230002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/01a1fdcdeb1b
User: Petr Pisl <ppisl@netbeans.org>
Log: #262527 - Marking import expression as error when is used node hash-bang