Skip to content

Instantly share code, notes, and snippets.

View jnthn's full-sized avatar

Jonathan Worthington jnthn

View GitHub Profile
C:\consulting\rakudo>echo foo > bar
C:\consulting\rakudo>attrib +R bar
C:\consulting\rakudo>perl6.exe -e "unlink 'bar'"
Failed to remove the file 'bar': unlink failed: Access is denied.
in block at src\gen\CORE.setting:11714
in sub unlink at src\gen\CORE.setting:11710
in block at -e:1
diff --git a/src/TclList.pm b/src/TclList.pm
index 7d36929..14f9107 100644
--- a/src/TclList.pm
+++ b/src/TclList.pm
@@ -165,15 +165,16 @@ class TclList {
#
# Add a vtable override for get_string
#
-sub static($code) {
- $code.get_lexinfo().get_static_code()
diff --git a/src/core/EnumMap.pm b/src/core/EnumMap.pm
index 4d28d09..e748ca4 100644
--- a/src/core/EnumMap.pm
+++ b/src/core/EnumMap.pm
@@ -75,10 +75,10 @@ my class EnumMap does Associative {
}
}
- method at_key($key is copy) is rw {
- $key = $key.Str;
diff --git a/src/core/Scalar.pm b/src/core/Scalar.pm
index 5589caa..f4ba820 100644
--- a/src/core/Scalar.pm
+++ b/src/core/Scalar.pm
@@ -4,4 +4,8 @@ my class Scalar {
my $d := $!descriptor;
nqp::isnull($d) ?? Str !! $d.name()
}
+ method of() {
+ my $d := $!descriptor;
diff --git a/src/Perl6/Actions.nqp b/src/Perl6/Actions.nqp
index e00478d..bf54764 100644
--- a/src/Perl6/Actions.nqp
+++ b/src/Perl6/Actions.nqp
@@ -151,7 +151,7 @@ class Perl6::Actions is HLL::Actions does STDActions {
%info<container_base> := $*W.find_symbol(['Hash']);
%info<bind_constraint> := $*W.find_symbol(['Associative']);
if $shape {
- @value_type[0] := $*W.find_symbol(['Mu']) unless +@value_type;
+ @value_type[0] := $*W.find_symbol(['Any']) unless +@value_type;
diff --git a/src/core/Hash.pm b/src/core/Hash.pm
index 54d7881..0aaced6 100644
--- a/src/core/Hash.pm
+++ b/src/core/Hash.pm
@@ -114,7 +114,7 @@ my class Hash {
}
my role TypedHash[::TValue] does Associative[TValue] {
- method at_key($key is copy, TValue $v? is copy) is rw {
+ method at_key(::?CLASS:D: $key is copy, TValue $v? is copy) is rw {
diff --git a/src/core/Any.pm b/src/core/Any.pm
index d22ccfb..0d11246 100644
--- a/src/core/Any.pm
+++ b/src/core/Any.pm
@@ -306,25 +306,25 @@ my class Any {
multi method postcircumfix:<{ }>(:$BIND!) {
X::Bind::ZenSlice.new(type => self.WHAT).throw
}
- multi method postcircumfix:<{ }>(\SELF: $key) is rw {
+ multi method postcircumfix:<{ }>(\SELF: Mu $key) is rw {
C:\consulting\git-bug>git init
Initialized empty Git repository in C:/consulting/git-bug/.git/
C:\consulting\git-bug>echo foo > x
C:\consulting\git-bug>git add x
C:\consulting\git-bug>git commit -m "Initial commit"
[master (root-commit) 2da6949] Initial commit
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/src/vm/parrot/QAST/Compiler.nqp b/src/vm/parrot/QAST/Compiler.nqp
index ae729d0..becfebe 100644
--- a/src/vm/parrot/QAST/Compiler.nqp
+++ b/src/vm/parrot/QAST/Compiler.nqp
@@ -988,6 +988,10 @@ class QAST::Compiler is HLL::Compiler {
multi method as_post(QAST::WVal $node, :$want) {
my $val := $node.value;
my $sc := nqp::getobjsc($val);
+ if nqp::isnull($sc) {
+ nqp::die("Object of type " ~ $val.HOW.name($val) ~
@jnthn
jnthn / gist:5354193
Last active December 16, 2015 01:19

nqp::flip(...)

  • Should flip a string. A bit tricky as you got to do code-gen to make a Parrot string, call .reverse() on that, and unbox the result.
  • Add a test for it in the nqpop test file
  • Use it in Rakudo's Cool.flip method