Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

implement $?LINE and $?FILE

  • Loading branch information...
commit 7836d2f277efcb3eab6a614de3b1e8d8f490463c 1 parent 4c241c8
@moritz moritz authored
Showing with 17 additions and 0 deletions.
  1. +1 −0  docs/ChangeLog
  2. +15 −0 src/Perl6/Actions.pm
  3. +1 −0  t/spectest.data
View
1  docs/ChangeLog
@@ -5,6 +5,7 @@ New in 2012.05
+ %*ENV now propagates into subprocesses
+ RAKUDOLIB env variable supported in addition to PERL6LIB
+ -I command line option
++ $?LINE and $?FILE variables
New in 2012.04.1
+ autvivification for arrays and hashes
View
15 src/Perl6/Actions.pm
@@ -1152,6 +1152,21 @@ class Perl6::Actions is HLL::Actions {
:full_name($past.name()));
}
}
+ elsif $past.name() eq '$?LINE' || $past.name eq '$?FILE' {
+ if $*IN_DECL eq 'variable' {
+ $*W.throw('X::Syntax::Variable::Twigil',
+ twigil => '?',
+ scope => $*SCOPE,
+ );
+ }
+ if $past.name() eq '$?LINE' {
+ $past := $*W.add_constant('Int', 'int',
+ HLL::Compiler.lineof($/.orig, $/.from ));
+ }
+ else {
+ $past := $*W.add_string_constant(pir::find_caller_lex__ps('$?FILES') // '<unknown file>');
+ }
+ }
elsif +@name > 1 {
$past := $*W.symbol_lookup(@name, $/, :lvalue(1));
}
View
1  t/spectest.data
@@ -78,6 +78,7 @@ S02-magicals/config.t
S02-magicals/dollar_bang.t
S02-magicals/dollar-underscore.t
S02-magicals/env.t
+S02-magicals/file_line.t
S02-magicals/pid.t
S02-magicals/progname.t
S02-magicals/sub.t
Please sign in to comment.
Something went wrong with that request. Please try again.