title: Any code after DynamicParam block on the script level is parsed as syntax error
body: <p>I am trying to use <em>DynamicParam</em> on the script level. All examples on the internet show function level. As long as I have no code after the DynamicParam {}, it works (I can stop inside the block in debugger), however any code added after is a syntax error. I've seen some advise that begin/process/end should be used and I tried that and it did not have any affect. </p>
  
  <p>I have this for proof of concept:</p>
  
  <p><strong>MyScript.ps1</strong></p>
  
  <pre><code>[CmdletBinding()]
  Param(
   [parameter()]
   [string] $a,
  
   [parameter()]
   [string] $b,
  
   [parameter()]
   [string] $c
  )
  DynamicParam
  {
    if($a -match 'aaa') 
    {
       # .......
       # creates dynamic param here
       # .......
    }
  }
  
  # Anything below this line is not accepted by powershell parser
  # Next line will cause powershell to generate: "Unexpected token '$x' in expression or statement" error.
  $x = 10 
  </code></pre>
  
  <p>If I add:</p>
  
  <pre><code>begin {}
  process {}
  end {}
  </code></pre>
  
  <p>I still cannot add any code after.</p>
  
  <p>Perhaps some silly mistake I cannot see; I am stuck.</p>
  
  <p>Powershell version:</p>
  
  <pre><code>$PSVersionTable.PSVersion
  Major Minor Build Revision
  ----- ----- ----- ---------
  4      0    -1    -1
  </code></pre>