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
make CPPStruct accept unmapped attributes. #5517
Comments
From vlmarek@volny.czclass A is repr<CPPStruct>{ I don't want $x mapped to C++ object attribute, I want it to be only part of it's perl 6 representation. I was thinking about adding a trait, something like. multi sub trait_mod:<is>(Attribute $r, :$native-private!) is export(:DEFAULT){} But I'm not enough skilled to implement it :) I was not able to find in CPPStruct.c how to detect that attribute has given trait. So I have tried to disable the warnings Inline Patchdiff --git a/src/6model/reprs/CPPStruct.c b/src/6model/reprs/CPPStruct.c
index f987734..5c0d6a5 100644
--- a/src/6model/reprs/CPPStruct.c
+++ b/src/6model/reprs/CPPStruct.c
@@ -235,8 +235,8 @@ static void compute_allocation_strategy(MVMThreadContext *tc, MVMObject *repr_in
repr_data->member_types[i] = type;
}
else {
- MVM_exception_throw_adhoc(tc,
- "CPPStruct representation only handles int, num, CArray, CPointer, CStruct, CPPStruct and CUnion");
+// MVM_exception_throw_adhoc(tc,
+// "CPPStruct representation only handles int, num, CArray, CPointer, CStruct, CPPStruct and CUnion");
}
}
else {
@@ -393,8 +393,8 @@ static void get_attribute(MVMThreadContext *tc, MVMSTable *st, MVMObject *root,
MVMint32 real_slot = repr_data->attribute_locations[slot] >> MVM_CPPSTRUCT_ATTR_SHIFT;
if (type == MVM_CPPSTRUCT_ATTR_IN_STRUCT) {
- MVM_exception_throw_adhoc(tc,
- "CPPStruct can't perform boxed get on flattened attributes yet");
+// MVM_exception_throw_adhoc(tc,
+// "CPPStruct can't perform boxed get on flattened attributes yet");
}
else {
MVMObject *typeobj = repr_data->member_types[slot];
class A is repr<CPPStruct>{ method m() { my $x=A.new(); But now my method does not return Supply.new, but rather A.new; If I replace 'has $x' by 'my $x', it returns what I would expect - Supply.new And I got stuck :) Thank you |
From vlmarek@volny.czAlso if the class A is not repr<CPPStruct>, $x.m() returns Supply.new. |
Migrated from rt.perl.org#128815 (status was 'new')
Searchable as RT128815$
The text was updated successfully, but these errors were encountered: