@@ -1504,11 +1504,15 @@ public let CodeGenerators: [CodeGenerator] = [
15041504 [
15051505 GeneratorStub ( " PlainFunctionBeginGenerator " , provides: [ . javascript, . subroutine] ) {
15061506 b in
1507- let randomParameters = b. randomParameters ( )
1507+ let ( randomParameters, defaultValues) = b. randomParameters ( )
1508+ . withRandomDefaultParameters (
1509+ probability: 0.1 ,
1510+ randomVariable: { b. randomJsVariable ( ) } )
15081511 b. setParameterTypesForNextSubroutine (
15091512 randomParameters. parameterTypes)
15101513 let instr = b. emit (
1511- BeginPlainFunction ( parameters: randomParameters. parameters, functionName: nil ) )
1514+ BeginPlainFunction ( parameters: randomParameters. parameters, functionName: nil ) ,
1515+ withInputs: defaultValues)
15121516 if randomParameters. parameters. hasRestParameter && probability ( 0.2 ) {
15131517 b. getProperty ( " length " , of: instr. innerOutputs. last!)
15141518 }
@@ -1532,11 +1536,15 @@ public let CodeGenerators: [CodeGenerator] = [
15321536 { b in
15331537 // We could consider having a standalone DirectiveGenerator, but probably most of the time it won't do anything meaningful.
15341538 // We could also consider keeping a list of known directives in the JavaScriptEnvironment, but currently we only use 'use strict'.
1535- let randomParameters = b. randomParameters ( )
1539+ let ( randomParameters, defaultValues) = b. randomParameters ( )
1540+ . withRandomDefaultParameters (
1541+ probability: 0.1 ,
1542+ randomVariable: { b. randomJsVariable ( ) } )
15361543 b. setParameterTypesForNextSubroutine (
15371544 randomParameters. parameterTypes)
15381545 let instr = b. emit (
1539- BeginPlainFunction ( parameters: randomParameters. parameters, functionName: nil ) )
1546+ BeginPlainFunction ( parameters: randomParameters. parameters, functionName: nil ) ,
1547+ withInputs: defaultValues)
15401548 if randomParameters. parameters. hasRestParameter && probability ( 0.2 ) {
15411549 b. getProperty ( " length " , of: instr. innerOutputs. last!)
15421550 }
@@ -1561,11 +1569,15 @@ public let CodeGenerators: [CodeGenerator] = [
15611569 " ArrowFunctionBeginGenerator " ,
15621570 provides: [ . subroutine, . javascript]
15631571 ) { b in
1564- let randomParameters = b. randomParameters ( )
1572+ let ( randomParameters, defaultValues) = b. randomParameters ( )
1573+ . withRandomDefaultParameters (
1574+ probability: 0.1 ,
1575+ randomVariable: { b. randomJsVariable ( ) } )
15651576 b. setParameterTypesForNextSubroutine (
15661577 randomParameters. parameterTypes)
15671578 let instr = b. emit (
1568- BeginArrowFunction ( parameters: randomParameters. parameters) )
1579+ BeginArrowFunction ( parameters: randomParameters. parameters) ,
1580+ withInputs: defaultValues)
15691581 if randomParameters. parameters. hasRestParameter && probability ( 0.2 ) {
15701582 b. getProperty ( " length " , of: instr. innerOutputs. last!)
15711583 }
@@ -1586,12 +1598,16 @@ public let CodeGenerators: [CodeGenerator] = [
15861598 " GeneratorFunctionBeginGenerator " ,
15871599 provides: [ . generatorFunction, . subroutine, . javascript]
15881600 ) { b in
1589- let randomParameters = b. randomParameters ( )
1601+ let ( randomParameters, defaultValues) = b. randomParameters ( )
1602+ . withRandomDefaultParameters (
1603+ probability: 0.1 ,
1604+ randomVariable: { b. randomJsVariable ( ) } )
15901605 b. setParameterTypesForNextSubroutine (
15911606 randomParameters. parameterTypes)
15921607 let instr = b. emit (
15931608 BeginGeneratorFunction (
1594- parameters: randomParameters. parameters, functionName: nil ) )
1609+ parameters: randomParameters. parameters, functionName: nil ) ,
1610+ withInputs: defaultValues)
15951611 if randomParameters. parameters. hasRestParameter && probability ( 0.2 ) {
15961612 b. getProperty ( " length " , of: instr. innerOutputs. last!)
15971613 }
@@ -1623,11 +1639,15 @@ public let CodeGenerators: [CodeGenerator] = [
16231639 GeneratorStub (
16241640 " AsyncFunctionBeginGenerator " , provides: [ . javascript, . subroutine, . asyncFunction]
16251641 ) { b in
1626- let randomParameters = b. randomParameters ( )
1642+ let ( randomParameters, defaultValues) = b. randomParameters ( )
1643+ . withRandomDefaultParameters (
1644+ probability: 0.1 ,
1645+ randomVariable: { b. randomJsVariable ( ) } )
16271646 b. setParameterTypesForNextSubroutine (
16281647 randomParameters. parameterTypes)
16291648 let instr = b. emit (
1630- BeginAsyncFunction ( parameters: randomParameters. parameters, functionName: nil ) )
1649+ BeginAsyncFunction ( parameters: randomParameters. parameters, functionName: nil ) ,
1650+ withInputs: defaultValues)
16311651 if randomParameters. parameters. hasRestParameter && probability ( 0.2 ) {
16321652 b. getProperty ( " length " , of: instr. innerOutputs. last!)
16331653 }
@@ -1653,12 +1673,15 @@ public let CodeGenerators: [CodeGenerator] = [
16531673 " AsyncArrowFunctionBeginGenerator " ,
16541674 provides: [ . javascript, . asyncFunction]
16551675 ) { b in
1656- let randomParameters = b. randomParameters ( )
1676+ let ( randomParameters, defaultValues) = b. randomParameters ( )
1677+ . withRandomDefaultParameters (
1678+ probability: 0.1 ,
1679+ randomVariable: { b. randomJsVariable ( ) } )
16571680 b. setParameterTypesForNextSubroutine (
16581681 randomParameters. parameterTypes)
16591682 let instr = b. emit (
16601683 BeginAsyncArrowFunction (
1661- parameters: randomParameters. parameters) )
1684+ parameters: randomParameters. parameters) , withInputs : defaultValues )
16621685 if randomParameters. parameters. hasRestParameter && probability ( 0.2 ) {
16631686 b. getProperty ( " length " , of: instr. innerOutputs. last!)
16641687 }
@@ -1689,12 +1712,16 @@ public let CodeGenerators: [CodeGenerator] = [
16891712 " AsyncGeneratorFunctionBeginGenerator " ,
16901713 provides: [ . javascript, . subroutine, . asyncFunction, . generatorFunction]
16911714 ) { b in
1692- let randomParameters = b. randomParameters ( )
1715+ let ( randomParameters, defaultValues) = b. randomParameters ( )
1716+ . withRandomDefaultParameters (
1717+ probability: 0.1 ,
1718+ randomVariable: { b. randomJsVariable ( ) } )
16931719 b. setParameterTypesForNextSubroutine (
16941720 randomParameters. parameterTypes)
16951721 let instr = b. emit (
16961722 BeginAsyncGeneratorFunction (
1697- parameters: randomParameters. parameters, functionName: nil ) )
1723+ parameters: randomParameters. parameters, functionName: nil ) ,
1724+ withInputs: defaultValues)
16981725 if randomParameters. parameters. hasRestParameter && probability ( 0.2 ) {
16991726 b. getProperty ( " length " , of: instr. innerOutputs. last!)
17001727 }
0 commit comments