New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rakudo doesn't implement 'handles' (but used to) #1790
Comments
From @masak<masak> rakudo: class A { has @.contents handles <elems> }; say |
From maxim4d@gmail.comcreated during today's hackmeet with Jonathan Worthington. |
From maxim4d@gmail.comhandles.diffdiff --git a/build/Makefile.in b/build/Makefile.in
index 62606c0..a3330ee 100644
--- a/build/Makefile.in
+++ b/build/Makefile.in
@@ -170,6 +170,7 @@ CORE_SOURCES = \
src/core/metaops.pm \
src/core/operators.pm \
src/glue/subset.pm \
+ src/glue/handles.pm \
src/cheats/trait-export.pm \
src/cheats/num.pm \
src/cheats/eval.pm \
diff --git a/src/Perl6/Actions.pm b/src/Perl6/Actions.pm
index 011230d..6f8428a 100644
--- a/src/Perl6/Actions.pm
+++ b/src/Perl6/Actions.pm
@@ -919,6 +919,11 @@ sub declare_variable($/, $past, $sigil, $twigil, $desigilname, $trait_list) {
%attr_info<accessor> := $twigil eq '.' ?? 1 !! 0;
%attr_info<rw> := $trait_list && has_compiler_trait_with_val($trait_list, '&trait_mod:<is>', 'rw') ?? 1 !! 0;
@PACKAGE[0].attributes.push(%attr_info);
+ my $has_handles := has_compiler_trait($trait_list, '&trait_mod:<handles>');
+ if $has_handles {
+ %attr_info<handles> := $has_handles[0];
+ }
+
# If no twigil, note $foo is an alias to $!foo.
if $twigil eq '' {
diff --git a/src/Perl6/Compiler/Package.pm b/src/Perl6/Compiler/Package.pm
index c8b7149..0e1fa67 100644
--- a/src/Perl6/Compiler/Package.pm
+++ b/src/Perl6/Compiler/Package.pm
@@ -177,6 +177,10 @@ method finish($block) {
$_<build>.named('build');
$attr.push($_<build>);
}
+ if $_<handles> {
+ $_<handles>.named('handles');
+ $attr.push($_<handles>);
+ }
$decl.push(PAST::Op.new(
:pasttype('callmethod'),
:name('add_attribute'),
diff --git a/src/metamodel/Attribute.nqp b/src/metamodel/Attribute.nqp
index cfe96ca..ef48aa3 100644
--- a/src/metamodel/Attribute.nqp
+++ b/src/metamodel/Attribute.nqp
@@ -71,6 +71,9 @@ method compose($package) {
}
# XXX Handles...
+ if $!handles {
+ add_handles_method($package, $!name, $!handles);
+ }
}
# vim: ft=perl6
|
From maxim4d@gmail.comuse v6; #use Test; #plan 20; class Foo { class Bar { sub add_handles_method_helper($metaclass, $attr, $meth-name, $meth-rename = $meth-name) { sub add_handles_method($metaclass, $attr_name, $expr) { say "String:"; say "Parcel:"; say "Pair:"; say "List:"; |
From maxim4d@gmail.comuse v6; #use Test; #plan 20; class Foo { class Bar { say "String:"; say "Parcel:"; say "Pair:"; say "List:"; |
The RT System itself - Status changed from 'new' to 'open' |
From @jnthnOn Sat Jun 12 13:42:18 2010, maard wrote:
Thanks, after a couple of tweaks I have applied the patch. We now pass Thanks, Jonathan |
From @jnthnOn Thu May 27 10:52:50 2010, masak wrote:
Now:
And:
Plus we pass all the other cases alpha did for handles now, and the Jonathan |
@jnthn - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#75386 (status was 'resolved')
Searchable as RT75386$
The text was updated successfully, but these errors were encountered: