Created
October 29, 2013 08:37
-
-
Save moritz/7210995 to your computer and use it in GitHub Desktop.
My attempt to implement "no strict;"
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/Perl6/Grammar.nqp b/src/Perl6/Grammar.nqp | |
index 83f1578..9ecaffc 100644 | |
--- a/src/Perl6/Grammar.nqp | |
+++ b/src/Perl6/Grammar.nqp | |
@@ -280,8 +280,11 @@ role STD { | |
my $name := $varast.name; | |
if $name ne '%_' && $name ne '@_' && !$*W.is_lexical($name) { | |
if $var<sigil> ne '&' { | |
- my @suggestions := $*W.suggest_lexicals($name); | |
- $*W.throw($var, ['X', 'Undeclared'], symbol => $varast.name(), suggestions => @suggestions); | |
+ my $decl := nqp::clone($varast); | |
+ $decl.decl('contvar'); | |
+ $*W.install_lexical_symbol($*UNIT, $name, $decl); | |
+# my @suggestions := $*W.suggest_lexicals($name); | |
+# $*W.throw($var, ['X', 'Undeclared'], symbol => $varast.name(), suggestions => @suggestions); | |
} | |
else { | |
$var.CURSOR.add_mystery($varast.name, $var.to, 'var'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ ./perl6-j -e '$blerg = 42' | |
Cannot modify an immutable value | |
in block at -e:1 | |
in any eval at gen/jvm/stage2/NQPHLL.nqp:1084 | |
in any command_eval at gen/jvm/stage2/NQPHLL.nqp:1184 | |
in any command_eval at src/Perl6/Compiler.nqp:17 | |
$ ./perl6-j --target=ast -e '$blerg = 42' | |
- QAST::CompUnit | |
- QAST::Block $blerg = 42 | |
- QAST::Var(local __args__ :decl(param)) | |
- QAST::Stmts | |
- QAST::Op(call) | |
- QAST::Block | |
- QAST::Stmts | |
- QAST::Var(lexical GLOBALish :decl(static)) | |
- QAST::Var(lexical EXPORT :decl(static)) | |
- QAST::Var(lexical $?PACKAGE :decl(static)) | |
- QAST::Var(lexical ::?PACKAGE :decl(static)) | |
- QAST::Var(lexical $_ :decl(contvar)) | |
- QAST::Var(lexical $/ :decl(contvar)) | |
- QAST::Var(lexical $! :decl(contvar)) | |
- QAST::Var(lexical $blerg :decl(static)) | |
- QAST::Var(lexical $=pod :decl(static)) | |
- QAST::Var(lexical !UNIT_MARKER :decl(static)) | |
- QAST::VM | |
[loadlibs] | |
- nqp_group nqp_ops perl6_ops bit_ops math_ops trans_ops io_ops obscure_ops os file sys_ops nqp_bigint_ops nqp_dyncall_ops | |
[jvm] | |
- QAST::Op(null) | |
- QAST::Stmt | |
- QAST::Op(bind) | |
- QAST::Var(local ctxsave :decl(var)) | |
- QAST::Var(contextual $*CTXSAVE) | |
- QAST::Op(unless) | |
- QAST::Op(isnull) | |
- QAST::Var(local ctxsave) | |
- QAST::Op(if) | |
- QAST::Op(can) | |
- QAST::Var(local ctxsave) | |
- QAST::SVal(ctxsave) | |
- QAST::Op(callmethod ctxsave) | |
- QAST::Var(local ctxsave) | |
- QAST::Stmts | |
- QAST::WVal(Array) | |
- QAST::Stmts $blerg = 42 | |
- QAST::Stmt | |
- QAST::Op(p6store) = | |
- QAST::Var(lexical $blerg) $blerg | |
- QAST::Want 42 | |
- QAST::WVal(Int) | |
- Ii | |
- QAST::IVal(42) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment