Skip to content
This repository
Browse code

update winxed snapshot to 375562d

- Default values in multiassign
- Minor fixes
  • Loading branch information...
commit 3e9ca81f2faa859830698056e281893315fe7427 1 parent 5d83828
NotFound authored March 29, 2012

Showing 1 changed file with 282 additions and 152 deletions. Show diff stats Hide diff stats

  1. 434  ext/winxed/compiler.pir
434  ext/winxed/compiler.pir
@@ -19476,7 +19476,7 @@
19476 19476
     if_null $P2, __label_5
19477 19477
     unless $P2 goto __label_5
19478 19478
     new $P5, [ 'Winxed'; 'Compiler'; 'FunctionParameterDefault' ]
19479  
-    $P5.'FunctionParameterDefault'(__ARG_2, self)
  19479
+    $P5.'FunctionParameterDefault'(__ARG_2, __ARG_1, self)
19480 19480
     set $P4, $P5
19481 19481
     setattribute self, 'defaultexpr', $P4
19482 19482
     goto __label_6
@@ -19491,6 +19491,11 @@
19491 19491
     getattribute $P1, self, 'defaultexpr'
19492 19492
     if_null $P1, __label_1
19493 19493
     $P1.'optimize'()
  19494
+    $P3 = self.'getvar'()
  19495
+    $P2 = $P3.'getreg'()
  19496
+    set $S1, $P2
  19497
+    concat $S2, "__opt_flag", $S1
  19498
+    $P1.'setoptflag'($S2)
19494 19499
   __label_1: # endif
19495 19500
     .return(self)
19496 19501
 
@@ -19501,35 +19506,45 @@
19501 19506
         .param pmc __ARG_1
19502 19507
 .const 'Sub' WSubId_136 = "WSubId_136"
19503 19508
     getattribute $P1, self, 'func'
19504  
-    getattribute $P4, self, 'name'
  19509
+    getattribute $P5, self, 'name'
19505 19510
     null $S1
19506  
-    if_null $P4, __label_1
19507  
-    set $S1, $P4
  19511
+    if_null $P5, __label_1
  19512
+    set $S1, $P5
19508 19513
   __label_1:
19509 19514
     $P2 = self.'getvar'()
19510  
-    $P5 = $P2.'gettype'()
19511  
-    $P4 = WSubId_136($P5)
  19515
+    $P6 = $P2.'gettype'()
  19516
+    $P5 = WSubId_136($P6)
19512 19517
     null $S2
19513  
-    if_null $P4, __label_2
19514  
-    set $S2, $P4
  19518
+    if_null $P5, __label_2
  19519
+    set $S2, $P5
19515 19520
   __label_2:
19516  
-    $P4 = $P2.'getreg'()
19517  
-    __ARG_1.'print'('        .param ', $S2, ' ', $P4)
  19521
+    $P5 = $P2.'getreg'()
  19522
+    __ARG_1.'print'('        .param ', $S2, ' ', $P5)
19518 19523
     getattribute $P3, self, 'modifiers'
19519 19524
     if_null $P3, __label_3
19520  
-    getattribute $P4, $P1, 'start'
19521  
-    $P3.'emitmodifiers'(__ARG_1, $P4, $S1)
  19525
+    getattribute $P5, $P1, 'start'
  19526
+    $P3.'emitmodifiers'(__ARG_1, $P5, $S1)
19522 19527
   __label_3: # endif
19523 19528
     getattribute $P4, self, 'defaultexpr'
19524 19529
     if_null $P4, __label_4
19525  
-    $P5 = $P2.'getreg'()
19526  
-    __ARG_1.'print'(" :optional\n        .param int __opt_flag", $P5, " :opt_flag")
  19530
+    $P5 = $P4.'getoptflag'()
  19531
+    __ARG_1.'print'(" :optional\n        .param int ", $P5, " :opt_flag")
19527 19532
   __label_4: # endif
19528 19533
     __ARG_1.'say'('')
19529 19534
 
19530 19535
 .end # emit
19531 19536
 
19532 19537
 
  19538
+.sub 'emitdefault' :method
  19539
+        .param pmc __ARG_1
  19540
+    getattribute $P1, self, 'defaultexpr'
  19541
+    if_null $P1, __label_1
  19542
+    $P1.'emit'(__ARG_1)
  19543
+  __label_1: # endif
  19544
+
  19545
+.end # emitdefault
  19546
+
  19547
+
19533 19548
 .sub 'get_type' :method
19534 19549
     getattribute $P1, self, 'type'
19535 19550
     .return($P1)
@@ -19544,13 +19559,6 @@
19544 19559
 
19545 19560
 .end # getvar
19546 19561
 
19547  
-
19548  
-.sub 'get_default' :method
19549  
-    getattribute $P1, self, 'defaultexpr'
19550  
-    .return($P1)
19551  
-
19552  
-.end # get_default
19553  
-
19554 19562
 .sub Winxed_class_init :anon :load :init
19555 19563
     newclass $P0, [ 'Winxed'; 'Compiler'; 'FunctionParameter' ]
19556 19564
     addattribute $P0, 'func'
@@ -19564,63 +19572,91 @@
19564 19572
 .sub 'FunctionParameterDefault' :method
19565 19573
         .param pmc __ARG_1
19566 19574
         .param pmc __ARG_2
  19575
+        .param pmc __ARG_3
19567 19576
 .const 'Sub' WSubId_68 = "WSubId_68"
19568  
-    setattribute self, 'param', __ARG_2
19569  
-    getattribute $P3, __ARG_2, 'func'
19570  
-    $P2 = WSubId_68(__ARG_1, $P3)
  19577
+    setattribute self, 'owner', __ARG_2
  19578
+    setattribute self, 'param', __ARG_3
  19579
+    $P2 = WSubId_68(__ARG_1, __ARG_2)
19571 19580
     setattribute self, 'expr', $P2
19572 19581
 
19573 19582
 .end # FunctionParameterDefault
19574 19583
 
19575 19584
 
19576 19585
 .sub 'optimize' :method
19577  
-    getattribute $P3, self, 'expr'
19578  
-    $P2 = $P3.'optimize'()
19579  
-    setattribute self, 'expr', $P2
  19586
+    getattribute $P4, self, 'expr'
  19587
+    $P3 = $P4.'optimize'()
  19588
+    setattribute self, 'expr', $P3
  19589
+    getattribute $P2, self, 'param'
  19590
+    $P1 = $P2.'getvar'()
19580 19591
 
19581 19592
 .end # optimize
19582 19593
 
19583 19594
 
  19595
+.sub 'setoptflag' :method
  19596
+        .param string __ARG_1
  19597
+    box $P1, __ARG_1
  19598
+    setattribute self, 'reg', $P1
  19599
+
  19600
+.end # setoptflag
  19601
+
  19602
+
  19603
+.sub 'getoptflag' :method
  19604
+.const 'Sub' WSubId_30 = "WSubId_30"
  19605
+    getattribute $P1, self, 'reg'
  19606
+    unless_null $P1, __label_1
  19607
+    getattribute $P2, self, 'param'
  19608
+    WSubId_30("Invalid parameter default usage", $P2)
  19609
+  __label_1: # endif
  19610
+    set $S1, $P1
  19611
+    .return($S1)
  19612
+
  19613
+.end # getoptflag
  19614
+
  19615
+
19584 19616
 .sub 'emit' :method
19585 19617
         .param pmc __ARG_1
19586 19618
     getattribute $P1, self, 'expr'
19587  
-    $P4 = $P1.'isnull'()
19588  
-    isfalse $I1, $P4
  19619
+    $P5 = $P1.'isnull'()
  19620
+    isfalse $I1, $P5
19589 19621
     unless $I1 goto __label_1
19590 19622
     getattribute $P2, self, 'param'
19591  
-    getattribute $P5, $P2, 'func'
19592  
-    $P4 = $P5.'genlabel'()
  19623
+    $P3 = $P2.'getvar'()
  19624
+    getattribute $P6, self, 'owner'
  19625
+    $P5 = $P6.'genlabel'()
19593 19626
     null $S1
19594  
-    if_null $P4, __label_2
19595  
-    set $S1, $P4
  19627
+    if_null $P5, __label_2
  19628
+    set $S1, $P5
19596 19629
   __label_2:
19597  
-    $P5 = $P2.'getvar'()
19598  
-    $P4 = $P5.'getreg'()
  19630
+    $P5 = self.'getoptflag'()
19599 19631
     null $S2
19600  
-    if_null $P4, __label_3
19601  
-    set $S2, $P4
  19632
+    if_null $P5, __label_3
  19633
+    set $S2, $P5
19602 19634
   __label_3:
19603  
-    concat $S4, "__opt_flag", $S2
19604  
-    __ARG_1.'emitif'($S4, $S1)
19605  
-    $P4 = $P2.'get_type'()
  19635
+    __ARG_1.'emitif'($S2, $S1)
  19636
+    $P5 = $P3.'getreg'()
19606 19637
     null $S3
19607  
-    if_null $P4, __label_4
19608  
-    set $S3, $P4
  19638
+    if_null $P5, __label_4
  19639
+    set $S3, $P5
19609 19640
   __label_4:
19610  
-    $P4 = $P1.'checkresult'()
19611  
-    set $S4, $P4
19612  
-    ne $S3, $S4, __label_5
19613  
-    $P1.'emit_init'(__ARG_1, $S2)
19614  
-    goto __label_6
19615  
-  __label_5: # else
19616  
-    $P3 = $P1.'emit_get'(__ARG_1)
19617  
-    ne $S3, 'P', __label_7
19618  
-    __ARG_1.'emitbox'($S2, $P3)
19619  
-    goto __label_8
19620  
-  __label_7: # else
19621  
-    __ARG_1.'emitset'($S2, $P3)
19622  
-  __label_8: # endif
19623  
-  __label_6: # endif
  19641
+    $P5 = $P3.'gettype'()
  19642
+    null $S4
  19643
+    if_null $P5, __label_5
  19644
+    set $S4, $P5
  19645
+  __label_5:
  19646
+    $P5 = $P1.'checkresult'()
  19647
+    set $S5, $P5
  19648
+    ne $S4, $S5, __label_6
  19649
+    $P1.'emit_init'(__ARG_1, $S3)
  19650
+    goto __label_7
  19651
+  __label_6: # else
  19652
+    $P4 = $P1.'emit_get'(__ARG_1)
  19653
+    ne $S4, 'P', __label_8
  19654
+    __ARG_1.'emitbox'($S3, $P4)
  19655
+    goto __label_9
  19656
+  __label_8: # else
  19657
+    __ARG_1.'emitset'($S3, $P4)
  19658
+  __label_9: # endif
  19659
+  __label_7: # endif
19624 19660
     __ARG_1.'emitlabel'($S1)
19625 19661
   __label_1: # endif
19626 19662
 
@@ -19628,8 +19664,10 @@
19628 19664
 
19629 19665
 .sub Winxed_class_init :anon :load :init
19630 19666
     newclass $P0, [ 'Winxed'; 'Compiler'; 'FunctionParameterDefault' ]
  19667
+    addattribute $P0, 'owner'
19631 19668
     addattribute $P0, 'param'
19632 19669
     addattribute $P0, 'expr'
  19670
+    addattribute $P0, 'reg'
19633 19671
 .end
19634 19672
 .namespace [ 'Winxed'; 'Compiler' ]
19635 19673
 
@@ -20243,35 +20281,35 @@
20243 20281
 .sub 'emit' :method
20244 20282
         .param pmc __ARG_1
20245 20283
 .const 'Sub' WSubId_139 = "WSubId_139"
20246  
-.const 'Sub' WSubId_45 = "WSubId_45"
20247 20284
 .const 'Sub' WSubId_3 = "WSubId_3"
20248 20285
 .const 'Sub' WSubId_5 = "WSubId_5"
20249  
-    getattribute $P22, self, 'name'
  20286
+.const 'Sub' WSubId_45 = "WSubId_45"
  20287
+    getattribute $P23, self, 'name'
20250 20288
     null $S1
20251  
-    if_null $P22, __label_1
20252  
-    set $S1, $P22
  20289
+    if_null $P23, __label_1
  20290
+    set $S1, $P23
20253 20291
   __label_1:
20254 20292
     __ARG_1.'say'()
20255 20293
     __ARG_1.'print'(".sub ")
20256  
-    $P22 = self.'isanonymous'()
20257  
-    if_null $P22, __label_2
20258  
-    unless $P22 goto __label_2
  20294
+    $P23 = self.'isanonymous'()
  20295
+    if_null $P23, __label_2
  20296
+    unless $P23 goto __label_2
20259 20297
     __ARG_1.'print'("'' :anon")
20260 20298
     goto __label_3
20261 20299
   __label_2: # else
20262 20300
     __ARG_1.'print'("'", $S1, "'")
20263 20301
   __label_3: # endif
20264  
-    getattribute $P22, self, 'subid'
20265  
-    if_null $P22, __label_4
20266 20302
     getattribute $P23, self, 'subid'
20267  
-    __ARG_1.'print'(" :subid('", $P23, "')")
  20303
+    if_null $P23, __label_4
  20304
+    getattribute $P24, self, 'subid'
  20305
+    __ARG_1.'print'(" :subid('", $P24, "')")
20268 20306
   __label_4: # endif
20269 20307
     getattribute $P1, self, 'outer'
20270 20308
     isnull $I2, $P1
20271 20309
     not $I2
20272 20310
     unless $I2 goto __label_6
20273  
-    getattribute $P22, self, 'usedlexicals'
20274  
-    isnull $I2, $P22
  20311
+    getattribute $P23, self, 'usedlexicals'
  20312
+    isnull $I2, $P23
20275 20313
     not $I2
20276 20314
   __label_6:
20277 20315
     unless $I2 goto __label_5
@@ -20280,9 +20318,9 @@
20280 20318
     __ARG_1.'print'(" :outer('", $P2, "')")
20281 20319
   __label_7: # endif
20282 20320
   __label_5: # endif
20283  
-    $P22 = self.'ismethod'()
20284  
-    if_null $P22, __label_8
20285  
-    unless $P22 goto __label_8
  20321
+    $P23 = self.'ismethod'()
  20322
+    if_null $P23, __label_8
  20323
+    unless $P23 goto __label_8
20286 20324
     __ARG_1.'print'(' :method')
20287 20325
   __label_8: # endif
20288 20326
     getattribute $P3, self, 'modifiers'
@@ -20297,99 +20335,100 @@
20297 20335
     self.'emit_extra_modifiers'(__ARG_1)
20298 20336
     __ARG_1.'say'()
20299 20337
     getattribute $P4, self, 'params'
20300  
-    set $P10, __ARG_1
20301  
-    set $P11, $P4
  20338
+    set $P8, __ARG_1
  20339
+    set $P9, $P4
20302 20340
 .const 'Sub' WSubId_3 = "WSubId_3"
20303 20341
 .const 'Sub' WSubId_5 = "WSubId_5"
20304  
-    set $P12, $P11
20305  
-    $P22 = WSubId_5("emit")
20306  
-    $P13 = WSubId_3($P22, $P10)
20307  
-    if_null $P12, __label_15
20308  
-    iter $P24, $P12
20309  
-    set $P24, 0
  20342
+    set $P10, $P9
  20343
+    $P23 = WSubId_5("emit")
  20344
+    $P11 = WSubId_3($P23, $P8)
  20345
+    if_null $P10, __label_15
  20346
+    iter $P25, $P10
  20347
+    set $P25, 0
20310 20348
   __label_14: # for iteration
20311  
-    unless $P24 goto __label_15
20312  
-    shift $P14, $P24
20313  
-    $P13($P14)
  20349
+    unless $P25 goto __label_15
  20350
+    shift $P12, $P25
  20351
+    $P11($P12)
20314 20352
     goto __label_14
20315 20353
   __label_15: # endfor
20316 20354
   __label_13:
20317 20355
   __label_12:
20318  
-    getattribute $P15, self, 'usedsubids'
20319  
-    root_new $P16, ['parrot';'ResizablePMCArray']
20320  
-    set $P17, WSubId_139
20321  
-    if_null $P15, __label_18
20322  
-    iter $P26, $P15
20323  
-    set $P26, 0
  20356
+    getattribute $P13, self, 'usedsubids'
  20357
+    root_new $P14, ['parrot';'ResizablePMCArray']
  20358
+    set $P15, WSubId_139
  20359
+    if_null $P13, __label_18
  20360
+    iter $P27, $P13
  20361
+    set $P27, 0
20324 20362
   __label_17: # for iteration
20325  
-    unless $P26 goto __label_18
20326  
-    shift $P18, $P26
20327  
-    $P22 = $P17($P18)
20328  
-    push $P16, $P22
  20363
+    unless $P27 goto __label_18
  20364
+    shift $P16, $P27
  20365
+    $P23 = $P15($P16)
  20366
+    push $P14, $P23
20329 20367
     goto __label_17
20330 20368
   __label_18: # endfor
20331  
-    set $P25, $P16
  20369
+    set $P26, $P14
20332 20370
     goto __label_16
20333 20371
   __label_16:
20334  
-    set $P22, $P25
20335  
-    join $S4, "", $P22
  20372
+    set $P23, $P26
  20373
+    join $S4, "", $P23
20336 20374
     __ARG_1.'print'($S4)
20337  
-    if_null $P4, __label_20
20338  
-    iter $P27, $P4
20339  
-    set $P27, 0
20340  
-  __label_19: # for iteration
20341  
-    unless $P27 goto __label_20
20342  
-    shift $P5, $P27
20343  
-    $P6 = $P5.'get_default'()
20344  
-    if_null $P6, __label_21
20345  
-    $P6.'emit'(__ARG_1)
20346  
-  __label_21: # endif
20347  
-    goto __label_19
20348  
-  __label_20: # endfor
20349  
-    getattribute $P7, self, 'lexicals'
20350  
-    getattribute $P8, self, 'usedlexicals'
20351  
-    isnull $I2, $P7
  20375
+    set $P17, $P4
  20376
+    $P23 = WSubId_5("emitdefault")
  20377
+    $P18 = WSubId_3($P23, __ARG_1)
  20378
+    if_null $P17, __label_21
  20379
+    iter $P28, $P17
  20380
+    set $P28, 0
  20381
+  __label_20: # for iteration
  20382
+    unless $P28 goto __label_21
  20383
+    shift $P19, $P28
  20384
+    $P18($P19)
  20385
+    goto __label_20
  20386
+  __label_21: # endfor
  20387
+  __label_19:
  20388
+    getattribute $P5, self, 'lexicals'
  20389
+    getattribute $P6, self, 'usedlexicals'
  20390
+    isnull $I2, $P5
20352 20391
     not $I2
20353 20392
     if $I2 goto __label_23
20354  
-    isnull $I2, $P8
  20393
+    isnull $I2, $P6
20355 20394
     not $I2
20356 20395
   __label_23:
20357 20396
     unless $I2 goto __label_22
20358  
-    getattribute $P22, self, 'start'
20359  
-    __ARG_1.'annotate'($P22)
20360  
-    if_null $P7, __label_25
20361  
-    iter $P28, $P7
20362  
-    set $P28, 0
  20397
+    getattribute $P23, self, 'start'
  20398
+    __ARG_1.'annotate'($P23)
  20399
+    if_null $P5, __label_25
  20400
+    iter $P29, $P5
  20401
+    set $P29, 0
20363 20402
   __label_24: # for iteration
20364  
-    unless $P28 goto __label_25
20365  
-    shift $S2, $P28
20366  
-    $P23 = $P7[$S2]
20367  
-    $P22 = WSubId_45(".lex '%0', %1", $P23, $S2)
20368  
-    __ARG_1.'say'($P22)
  20403
+    unless $P29 goto __label_25
  20404
+    shift $S2, $P29
  20405
+    $P24 = $P5[$S2]
  20406
+    $P23 = WSubId_45(".lex '%0', %1", $P24, $S2)
  20407
+    __ARG_1.'say'($P23)
20369 20408
     goto __label_24
20370 20409
   __label_25: # endfor
20371  
-    if_null $P8, __label_27
20372  
-    iter $P29, $P8
20373  
-    set $P29, 0
  20410
+    if_null $P6, __label_27
  20411
+    iter $P30, $P6
  20412
+    set $P30, 0
20374 20413
   __label_26: # for iteration
20375  
-    unless $P29 goto __label_27
20376  
-    shift $S3, $P29
  20414
+    unless $P30 goto __label_27
  20415
+    shift $S3, $P30
20377 20416
     substr $S4, $S3, 0, 1
20378 20417
     eq $S4, '$', __label_28
20379 20418
     concat $S5, "    .local pmc ", $S3
20380 20419
     __ARG_1.'say'($S5)
20381 20420
   __label_28: # endif
20382  
-    $P22 = $P8[$S3]
20383  
-    __ARG_1.'emitfind_lex'($S3, $P22)
  20421
+    $P23 = $P6[$S3]
  20422
+    __ARG_1.'emitfind_lex'($S3, $P23)
20384 20423
     goto __label_26
20385 20424
   __label_27: # endfor
20386 20425
   __label_22: # endif
20387  
-    $P22 = __ARG_1.'getDebug'()
20388  
-    set $I1, $P22
20389  
-    getattribute $P9, self, 'body'
20390  
-    $P22 = $P9.'isempty'()
20391  
-    if_null $P22, __label_29
20392  
-    unless $P22 goto __label_29
  20426
+    $P23 = __ARG_1.'getDebug'()
  20427
+    set $I1, $P23
  20428
+    getattribute $P7, self, 'body'
  20429
+    $P23 = $P7.'isempty'()
  20430
+    if_null $P23, __label_29
  20431
+    unless $P23 goto __label_29
20393 20432
     unless $I1 goto __label_31
20394 20433
     __ARG_1.'comment'('Empty body')
20395 20434
   __label_31: # endif
@@ -20398,21 +20437,21 @@
20398 20437
     unless $I1 goto __label_32
20399 20438
     __ARG_1.'comment'('Body')
20400 20439
   __label_32: # endif
20401  
-    $P9.'emit'(__ARG_1)
20402  
-    $P22 = $P9.'getend'()
20403  
-    __ARG_1.'annotate'($P22)
  20440
+    $P7.'emit'(__ARG_1)
  20441
+    $P23 = $P7.'getend'()
  20442
+    __ARG_1.'annotate'($P23)
20404 20443
   __label_30: # endif
20405 20444
     __ARG_1.'say'("\n.end # ", $S1, "\n")
20406  
-    getattribute $P19, self, 'localfun'
20407  
-    $P22 = WSubId_5("emit")
20408  
-    $P20 = WSubId_3($P22, __ARG_1)
20409  
-    if_null $P19, __label_35
20410  
-    iter $P30, $P19
20411  
-    set $P30, 0
  20445
+    getattribute $P20, self, 'localfun'
  20446
+    $P23 = WSubId_5("emit")
  20447
+    $P21 = WSubId_3($P23, __ARG_1)
  20448
+    if_null $P20, __label_35
  20449
+    iter $P31, $P20
  20450
+    set $P31, 0
20412 20451
   __label_34: # for iteration
20413  
-    unless $P30 goto __label_35
20414  
-    shift $P21, $P30
20415  
-    $P20($P21)
  20452
+    unless $P31 goto __label_35
  20453
+    shift $P22, $P31
  20454
+    $P21($P22)
20416 20455
     goto __label_34
20417 20456
   __label_35: # endfor
20418 20457
   __label_33:
@@ -21452,6 +21491,7 @@
21452 21491
         .param pmc __ARG_2
21453 21492
 .const 'Sub' WSubId_27 = "WSubId_27"
21454 21493
 .const 'Sub' WSubId_127 = "WSubId_127"
  21494
+    setattribute self, 'owner', __ARG_2
21455 21495
     $P1 = __ARG_1.'get'()
21456 21496
     $P4 = $P1.'isidentifier'()
21457 21497
     isfalse $I1, $P4
@@ -21484,31 +21524,79 @@
21484 21524
     $P7.'ParameterModifierList'(__ARG_1, self)
21485 21525
     set $P6, $P7
21486 21526
     setattribute self, 'modifiers', $P6
21487  
-    goto __label_5
21488  
-  __label_4: # else
  21527
+    $P2 = __ARG_1.'get'()
  21528
+  __label_4: # endif
  21529
+    $P4 = $P2.'isop'('=')
  21530
+    if_null $P4, __label_5
  21531
+    unless $P4 goto __label_5
  21532
+    new $P7, [ 'Winxed'; 'Compiler'; 'FunctionParameterDefault' ]
  21533
+    $P7.'FunctionParameterDefault'(__ARG_1, __ARG_2, self)
  21534
+    set $P6, $P7
  21535
+    setattribute self, 'defaultexpr', $P6
  21536
+    goto __label_6
  21537
+  __label_5: # else
21489 21538
     __ARG_1.'unget'($P2)
21490  
-  __label_5: # endif
  21539
+  __label_6: # endif
21491 21540
 
21492 21541
 .end # SigParameter
21493 21542
 
21494 21543
 
  21544
+.sub 'getvar' :method
  21545
+    getattribute $P1, self, 'owner'
  21546
+    getattribute $P3, self, 'name'
  21547
+    $P2 = $P3.'getidentifier'()
  21548
+    .tailcall $P1.'getvar'($P2)
  21549
+
  21550
+.end # getvar
  21551
+
  21552
+
  21553
+.sub 'optimize' :method
  21554
+    getattribute $P1, self, 'defaultexpr'
  21555
+    if_null $P1, __label_1
  21556
+    $P1.'optimize'()
  21557
+    getattribute $P3, self, 'owner'
  21558
+    $P2 = $P3.'createreg'('I')
  21559
+    $P1.'setoptflag'($P2)
  21560
+  __label_1: # endif
  21561
+    .return(self)
  21562
+
  21563
+.end # optimize
  21564
+
  21565
+
21495 21566
 .sub 'emit' :method
21496 21567
         .param pmc __ARG_1
21497  
-    getattribute $P3, self, 'reg'
21498  
-    __ARG_1.'print'($P3)
  21568
+    getattribute $P4, self, 'reg'
  21569
+    __ARG_1.'print'($P4)
21499 21570
     getattribute $P1, self, 'modifiers'
21500 21571
     if_null $P1, __label_1
21501 21572
     getattribute $P2, self, 'name'
21502 21573
     $P1.'emitmodifiers'(__ARG_1, $P2, $P2)
21503 21574
   __label_1: # endif
  21575
+    getattribute $P3, self, 'defaultexpr'
  21576
+    if_null $P3, __label_2
  21577
+    $P4 = $P3.'getoptflag'()
  21578
+    __ARG_1.'print'(" :optional, ", $P4, " :opt_flag")
  21579
+  __label_2: # endif
21504 21580
 
21505 21581
 .end # emit
21506 21582
 
  21583
+
  21584
+.sub 'emitdefault' :method
  21585
+        .param pmc __ARG_1
  21586
+    getattribute $P1, self, 'defaultexpr'
  21587
+    if_null $P1, __label_1
  21588
+    $P1.'emit'(__ARG_1)
  21589
+  __label_1: # endif
  21590
+
  21591
+.end # emitdefault
  21592
+
21507 21593
 .sub Winxed_class_init :anon :load :init
21508 21594
     newclass $P0, [ 'Winxed'; 'Compiler'; 'SigParameter' ]
  21595
+    addattribute $P0, 'owner'
21509 21596
     addattribute $P0, 'name'
21510 21597
     addattribute $P0, 'modifiers'
21511 21598
     addattribute $P0, 'reg'
  21599
+    addattribute $P0, 'defaultexpr'
21512 21600
 .end
21513 21601
 .namespace [ 'Winxed'; 'Compiler' ]
21514 21602
 
@@ -21535,6 +21623,29 @@
21535 21623
 .end # SigParameterList
21536 21624
 
21537 21625
 
  21626
+.sub 'optimize' :method
  21627
+    getattribute $P1, self, 'params'
  21628
+    if_null $P1, __label_3
  21629
+    elements $I1, $P1
  21630
+    goto __label_2
  21631
+  __label_3:
  21632
+    null $I1
  21633
+  __label_2:
  21634
+    null $I2
  21635
+  __label_6: # for condition
  21636
+    ge $I2, $I1, __label_5
  21637
+    $P3 = $P1[$I2]
  21638
+    $P2 = $P3.'optimize'()
  21639
+    $P1[$I2] = $P2
  21640
+  __label_4: # for iteration
  21641
+    inc $I2
  21642
+    goto __label_6
  21643
+  __label_5: # for end
  21644
+  __label_1:
  21645
+
  21646
+.end # optimize
  21647
+
  21648
+
21538 21649
 .sub 'emit' :method
21539 21650
         .param pmc __ARG_1
21540 21651
     __ARG_1.'print'('(')
@@ -21555,6 +21666,22 @@
21555 21666
 
21556 21667
 .end # emit
21557 21668
 
  21669
+
  21670
+.sub 'emitdefaults' :method
  21671
+        .param pmc __ARG_1
  21672
+    getattribute $P2, self, 'params'
  21673
+    if_null $P2, __label_2
  21674
+    iter $P3, $P2
  21675
+    set $P3, 0
  21676
+  __label_1: # for iteration
  21677
+    unless $P3 goto __label_2
  21678
+    shift $P1, $P3
  21679
+    $P1.'emitdefault'(__ARG_1)
  21680
+    goto __label_1
  21681
+  __label_2: # endfor
  21682
+
  21683
+.end # emitdefaults
  21684
+
21558 21685
 .sub Winxed_class_init :anon :load :init
21559 21686
     newclass $P0, [ 'Winxed'; 'Compiler'; 'SigParameterList' ]
21560 21687
     addattribute $P0, 'params'
@@ -21577,6 +21704,8 @@
21577 21704
     getattribute $P3, self, 'expr'
21578 21705
     $P2 = $P3.'optimize'()
21579 21706
     setattribute self, 'expr', $P2
  21707
+    getattribute $P1, self, 'params'
  21708
+    $P1.'optimize'()
21580 21709
     .return(self)
21581 21710
 
21582 21711
 .end # optimize
@@ -21593,12 +21722,13 @@
21593 21722
   __label_1: # endif
21594 21723
     $P2 = $P1.'emitcall'(__ARG_1)
21595 21724
     $P1.'prepareargs'(__ARG_1)
21596  
-    __ARG_1.'print'('    ')
21597 21725
     getattribute $P3, self, 'params'
  21726
+    __ARG_1.'print'('    ')
21598 21727
     $P3.'emit'(__ARG_1)
21599 21728
     __ARG_1.'print'(' = ', $P2)
21600 21729
     $P1.'emitargs'(__ARG_1)
21601 21730
     __ARG_1.'say'()
  21731
+    $P3.'emitdefaults'(__ARG_1)
21602 21732
 
21603 21733
 .end # emit
21604 21734
 

0 notes on commit 3e9ca81

Please sign in to comment.
Something went wrong with that request. Please try again.