Bug 152537

Summary: [ES6] Arrow function. Default arguments in arrow functions
Product: WebKit Reporter: GSkachkov <gskachkov>
Component: JavaScriptCoreAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, gskachkov, saam
Priority: P2    
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 140855    
Attachments:
Description Flags
Patch
none
Patch
none
Patch none

Description GSkachkov 2015-12-23 13:33:38 PST
arrow function should support default parameters in argument declaration
var arrow = (param1, param2 = "default-value") => {
  console.log(param2);
}
Comment 1 GSkachkov 2016-01-21 11:53:59 PST
Created attachment 269476 [details]
Patch

Fix comments
Comment 2 GSkachkov 2016-01-21 12:09:41 PST
Created attachment 269480 [details]
Patch

Add tests
Comment 3 Saam Barati 2016-01-21 15:45:54 PST
Comment on attachment 269480 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=269480&action=review

> LayoutTests/js/script-tests/arrowfunction-syntax.js:90
> +shouldBe("((x, y = 'default-value') => x + y)('input-value:')",'"input-value:default-value"');

you should add a test where you pass in:
- "undefined" for y
- anything that isn't undefined for y
Comment 4 GSkachkov 2016-01-22 02:26:44 PST
Created attachment 269564 [details]
Patch

Fix comments
Comment 5 WebKit Commit Bot 2016-01-22 10:47:49 PST
Comment on attachment 269564 [details]
Patch

Clearing flags on attachment: 269564

Committed r195461: <http://trac.webkit.org/changeset/195461>
Comment 6 WebKit Commit Bot 2016-01-22 10:47:52 PST
All reviewed patches have been landed.  Closing bug.