File tree Expand file tree Collapse file tree 3 files changed +31
-9
lines changed
src5/lib/Perlito5/Javascript3 Expand file tree Collapse file tree 3 files changed +31
-9
lines changed Load Diff Large diffs are not rendered by default.
Original file line number Diff line number Diff line change @@ -1417,19 +1417,19 @@ package Perlito5::AST::Apply;
1417
1417
1418
1418
' postfix:<++>' => sub {
1419
1419
my $self = $_ [0];
1420
- ' ( ' . join ( ' ' , map ( $_ -> emit_javascript3, @{ $ self-> {arguments } } ) ) . ' )++ ' ;
1420
+ $ self-> {arguments }[0] -> emit_javascript3() . ' .p5postincr() ' ;
1421
1421
},
1422
1422
' postfix:<-->' => sub {
1423
1423
my $self = $_ [0];
1424
- ' ( ' . join ( ' ' , map ( $_ -> emit_javascript3, @{ $ self-> {arguments } } ) ) . ' )-- ' ;
1424
+ $ self-> {arguments }[0] -> emit_javascript3() . ' .p5postdecr() ' ;
1425
1425
},
1426
1426
' prefix:<++>' => sub {
1427
1427
my $self = $_ [0];
1428
- ' ++( ' . join ( ' ' , map ( $_ -> emit_javascript3, @{ $ self-> {arguments } } ) ) . ' )' ;
1428
+ $ self-> {arguments }[0] -> emit_javascript3() . ' .p5incr( )' ;
1429
1429
},
1430
1430
' prefix:<-->' => sub {
1431
1431
my $self = $_ [0];
1432
- ' --( ' . join ( ' ' , map ( $_ -> emit_javascript3, @{ $ self-> {arguments } } ) ) . ' )' ;
1432
+ $ self-> {arguments }[0] -> emit_javascript3() . ' .p5decr( )' ;
1433
1433
},
1434
1434
1435
1435
' infix:<x>' => sub {
Original file line number Diff line number Diff line change @@ -455,6 +455,28 @@ function p5Scalar(o) {
455
455
this.p5code = function() {
456
456
return p5code(this._v_);
457
457
};
458
+ this.p5incr = function() {
459
+ // TODO - string increment with p5str_inc()
460
+ this._v_++;
461
+ return this._v_;
462
+ };
463
+ this.p5postincr = function() {
464
+ // TODO - string increment with p5str_inc()
465
+ var v = this._v_;
466
+ this._v_++;
467
+ return v;
468
+ };
469
+ this.p5decr = function() {
470
+ // TODO - numify before decrement
471
+ this._v_--;
472
+ return this._v_;
473
+ };
474
+ this.p5postdecr = function() {
475
+ // TODO - numify before decrement
476
+ var v = this._v_;
477
+ this._v_--;
478
+ return v;
479
+ };
458
480
459
481
// be a scalar ref
460
482
this.sderef = function(i) {
You can’t perform that action at this time.
0 commit comments