Permalink
Browse files

Perlito5 - javascript: add GLOB references

  • Loading branch information...
1 parent 62d9c24 commit b8def8ac37752ea8ceea490ed62eb8363f45dccb @fglock committed May 9, 2012
Showing with 11 additions and 1 deletion.
  1. +2 −1 ChangeLog
  2. +3 −0 html/perlito5.js
  3. +3 −0 perlito5.pl
  4. +3 −0 src5/lib/Perlito5/Javascript/Emitter.pm
View
@@ -20,10 +20,11 @@ dev 2012-04-12
-- control functions: next, last, redo, break
-- more functions: rand, printf, sprintf
-- "continue" blocks
+-- GLOB references
- perl5 backend:
--- require v5.10
+-- requires v5.10
* Perlito6 (Perl 6 compiler):
View
@@ -2952,6 +2952,9 @@ var p5100 = p5pkg['main'];
if ( (p5str(p5call(v_arg, "sigil", [], 0)) == '%') ) {
throw(p5context([('(new p5HashRef(' + p5str(p5call(v_arg, "emit_javascript", [v_level], 0)) + '))')], p5want));
};
+ if ( (p5str(p5call(v_arg, "sigil", [], 0)) == '*') ) {
+ throw(p5context([('(new p5GlobRef(' + p5str(p5call(v_arg, "emit_javascript", [v_level], 0)) + '))')], p5want));
+ };
if ( (p5str(p5call(v_arg, "sigil", [], 0)) == '&') ) {
if ( p5bool((v_arg || (v_arg = new p5HashRef({})))._hash_['namespace']) ) {
throw(p5context([('p5pkg["' + p5str((v_arg || (v_arg = new p5HashRef({})))._hash_['namespace']) + '"].' + p5str((v_arg || (v_arg = new p5HashRef({})))._hash_['name']))], p5want));
View
@@ -8658,6 +8658,9 @@ package Perlito5::AST::Apply;
if (($arg->sigil() eq '%')) {
return (('(new p5HashRef(' . $arg->emit_javascript($level) . '))'))
};
+ if (($arg->sigil() eq '*')) {
+ return (('(new p5GlobRef(' . $arg->emit_javascript($level) . '))'))
+ };
if (($arg->sigil() eq '&')) {
if ($arg->{'namespace'}) {
return (('p5pkg["' . $arg->{'namespace'} . '"].' . $arg->{'name'}))
@@ -1250,6 +1250,9 @@ package Perlito5::AST::Apply;
if ( $arg->sigil eq '%' ) {
return '(new p5HashRef(' . $arg->emit_javascript($level) . '))';
}
+ if ( $arg->sigil eq '*' ) {
+ return '(new p5GlobRef(' . $arg->emit_javascript($level) . '))';
+ }
if ( $arg->sigil eq '&' ) {
if ( $arg->{namespace} ) {
return 'p5pkg["' . $arg->{namespace} . '"].' . $arg->{name};

0 comments on commit b8def8a

Please sign in to comment.