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

Summary: Support default parameter values
Product: javascript Reporter: Petr Pisl <ppisl>
Component: EditorAssignee: Petr Hejl <phejl>
Status: RESOLVED FIXED    
Severity: normal CC: peterkehl, phejl
Priority: P3    
Version: 8.2   
Hardware: PC   
OS: Linux   
Issue Type: TASK Exception Reporter:
Bug Depends on:    
Bug Blocks: 242387    
Attachments: with yesterday's trunk (on Win x64)

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.