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 258656 - Support default parameter values
Summary: Support default parameter values
Status: RESOLVED FIXED
Alias: None
Product: javascript
Classification: Unclassified
Component: Editor (show other bugs)
Version: 8.2
Hardware: PC Linux
: P3 normal with 1 vote (vote)
Assignee: Petr Hejl
URL:
Keywords:
Depends on:
Blocks: 242387
  Show dependency tree
 
Reported: 2016-04-05 12:32 UTC by Petr Pisl
Modified: 2016-05-31 09:11 UTC (History)
2 users (show)

See Also:
Issue Type: TASK
Exception Reporter:


Attachments
with yesterday's trunk (on Win x64) (28.02 KB, image/jpeg)
2016-05-31 01:56 UTC, peterkehl
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Petr Pisl 2016-04-05 12:32:51 UTC
Ecma 6 script introduce default parameters values. 

https://developer.mozilla.org/cs/docs/Web/JavaScript/Reference/Functions/Default_parameters

Currently there are false hints "Expected semicolons ... ". For example:

function f (x, y = 7, z = 42) {
    return x + y + z;
}
console.log(f(10));


Also names of parameters can be used in default value expression:

function singularAutoPlural(singular, plural = singular+"s", 
                            rallyingCry = plural + " ATTACK!!!") {
  return [singular, plural, rallyingCry ]; 
}

Mark occurrences has to mark all occurrences of a parameter in such case.
Comment 1 Petr Hejl 2016-04-14 10:01:32 UTC
Hint is fixed.
Comment 2 Petr Hejl 2016-04-14 10:17:45 UTC
Fixed. Tests web-main 036571934479
Comment 3 peterkehl 2016-05-31 01:54:42 UTC
This doesn't always work. See below and attached screenshot in yesterday's trunk:

function openPreview( config={} ) {
}
Comment 4 peterkehl 2016-05-31 01:56:08 UTC
Created attachment 159921 [details]
with yesterday's trunk (on Win x64)
Comment 5 Petr Hejl 2016-05-31 09:11:51 UTC
The feature is not in trunk it is on branch and will be merged later.