Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Perlito5 - add more "use strict"

  • Loading branch information...
commit dcde2e3dd3931cab2753439c19dcf3cc087807d4 1 parent daea592
@fglock authored
View
2  html/perlito5.js
@@ -3387,8 +3387,6 @@ var p5100 = p5pkg['main'];
}, [0], false, "");
var p5140 = p5make_package("Perlito5::AST::Apply");
p5for_lex(function () {
- // no strict
-;
p5make_sub("Perlito5::AST::Apply", "emit_regex_javascript2", function (List__, p5want) {
try {
var v_op;
View
9 perlito5.pl
@@ -8651,9 +8651,6 @@ package Perlito5::AST::Call;
}};
package Perlito5::AST::Apply;
do {{
-
- # no strict
-;
sub Perlito5::AST::Apply::emit_regex_javascript2 {
((my $op) = shift());
((my $var) = shift());
@@ -10324,15 +10321,19 @@ package Perlito5::AST::Apply;
return (('(new p5ScalarRef(' . $arg->emit_javascript3($level) . '))'))
}, 'postfix:<++>', sub {
((my $self) = $_[0]);
+ ((my $level) = $_[1]);
(Perlito5::Javascript3::emit_javascript3_autovivify($self->{'arguments'}->[0], $level, 'lvalue') . '.p5postincr()')
}, 'postfix:<-->', sub {
((my $self) = $_[0]);
+ ((my $level) = $_[1]);
(Perlito5::Javascript3::emit_javascript3_autovivify($self->{'arguments'}->[0], $level, 'lvalue') . '.p5postdecr()')
}, 'prefix:<++>', sub {
((my $self) = $_[0]);
+ ((my $level) = $_[1]);
(Perlito5::Javascript3::emit_javascript3_autovivify($self->{'arguments'}->[0], $level, 'lvalue') . '.p5incr()')
}, 'prefix:<-->', sub {
((my $self) = $_[0]);
+ ((my $level) = $_[1]);
(Perlito5::Javascript3::emit_javascript3_autovivify($self->{'arguments'}->[0], $level, 'lvalue') . '.p5decr()')
}, 'infix:<x>', sub {
((my $self) = $_[0]);
@@ -10351,6 +10352,7 @@ package Perlito5::AST::Apply;
('(delete ' . $self->{'arguments'}->[0]->emit_javascript3() . ')')
}, 'scalar', sub {
((my $self) = $_[0]);
+ ((my $level) = $_[1]);
Perlito5::Javascript3::to_scalar($self->{'arguments'}, ($level + 1))
}, 'ternary:<? :>', sub {
((my $self) = shift());
@@ -10745,6 +10747,7 @@ package Perlito5::AST::When;
((my $cond) = $self->{'cond'});
((my $body) = Perlito5::Javascript3::LexicalBlock->new('block', $self->{'body'}->stmts(), 'needs_return', 0, 'create_context', 1));
((my $expr) = Perlito5::AST::Apply->new('code', 'infix:<==>', 'arguments', [Perlito5::AST::Var->new('sigil', '$', 'namespace', '', 'name', '_'), $cond]));
+ ((my $label) = '');
((my $s) = ('if ( ' . Perlito5::Javascript3::to_bool($expr, ($level + 1)) . ' ) {' . chr(10) . $body->emit_javascript3(($level + 1)) . chr(10) . Perlito5::Javascript3::tab(($level + 1)) . 'throw(new p5_error("next", "' . $label . '"))' . Perlito5::Javascript3::tab($level) . '}'));
return ($s)
}
View
4 src5/lib/Perlito5/Javascript2/Emitter.pm
@@ -1256,10 +1256,6 @@ package Perlito5::AST::Call;
package Perlito5::AST::Apply;
{
- no strict; # TODO - FIXME:
- # Global symbol "$level" requires explicit package name
- # make: *** [build-5js]
-
sub emit_regex_javascript2 {
my $op = shift;
my $var = shift;
View
7 src5/lib/Perlito5/Javascript3/Emitter.pm
@@ -1428,21 +1428,25 @@ package Perlito5::AST::Apply;
'postfix:<++>' => sub {
my $self = $_[0];
+ my $level = $_[1];
Perlito5::Javascript3::emit_javascript3_autovivify( $self->{arguments}[0], $level, 'lvalue' )
. '.p5postincr()';
},
'postfix:<-->' => sub {
my $self = $_[0];
+ my $level = $_[1];
Perlito5::Javascript3::emit_javascript3_autovivify( $self->{arguments}[0], $level, 'lvalue' )
. '.p5postdecr()';
},
'prefix:<++>' => sub {
my $self = $_[0];
+ my $level = $_[1];
Perlito5::Javascript3::emit_javascript3_autovivify( $self->{arguments}[0], $level, 'lvalue' )
. '.p5incr()';
},
'prefix:<-->' => sub {
my $self = $_[0];
+ my $level = $_[1];
Perlito5::Javascript3::emit_javascript3_autovivify( $self->{arguments}[0], $level, 'lvalue' )
. '.p5decr()';
},
@@ -1473,6 +1477,7 @@ package Perlito5::AST::Apply;
'scalar' => sub {
my $self = $_[0];
+ my $level = $_[1];
Perlito5::Javascript3::to_scalar($self->{arguments}, $level+1);
},
@@ -2123,6 +2128,8 @@ package Perlito5::AST::When;
# TODO - use a "next" exception inside a "for", but use a "break" exception inside a "given"
+ my $label = ''; # TODO
+
my $s = 'if ( ' . Perlito5::Javascript3::to_bool($expr, $level + 1) . ' ) {' . "\n"
. $body->emit_javascript3( $level + 1 ) . "\n"
Please sign in to comment.
Something went wrong with that request. Please try again.