Skip to content

Instantly share code, notes, and snippets.

Created June 10, 2011 13:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/1018826 to your computer and use it in GitHub Desktop.
Save anonymous/1018826 to your computer and use it in GitHub Desktop.
diff --git a/src/Perl6/Metamodel/BOOTSTRAP.pm b/src/Perl6/Metamodel/BOOTSTRAP.pm
index 9d5958c..d30cc85 100644
--- a/src/Perl6/Metamodel/BOOTSTRAP.pm
+++ b/src/Perl6/Metamodel/BOOTSTRAP.pm
@@ -363,6 +363,7 @@ my stub Scalar metaclass Perl6::Metamodel::ClassHOW { ... };
Scalar.HOW.add_parent(Scalar, Any);
Scalar.HOW.add_attribute(Scalar, BOOTSTRAPATTR.new(:name<$!descriptor>, :type(Mu)));
Scalar.HOW.add_attribute(Scalar, BOOTSTRAPATTR.new(:name<$!value>, :type(Mu)));
+Scalar.HOW.add_attribute(Scalar, BOOTSTRAPATTR.new(:name<$!whence>, :type(Mu)));
pir::set_scalar_container_type__vP(Scalar);
# Scalar needs to be registered as a container type.
diff --git a/src/binder/container.c b/src/binder/container.c
index dc968c7..ed63e7f 100644
--- a/src/binder/container.c
+++ b/src/binder/container.c
@@ -64,6 +64,12 @@ void Rakudo_cont_store(PARROT_INTERP, PMC *cont, PMC *value,
"Type check failed in assignment");
}
}
+
+ if (!PMC_IS_NULL(scalar->whence)) {
+ PMC *cappy = Parrot_pmc_new(interp, enum_class_CallContext);
+ Parrot_pcc_invoke_from_sig_object(interp, scalar->whence, cappy);
+ scalar->whence = PMCNULL;
+ }
/* If we get here, all is fine; store the value. */
scalar->value = value;
diff --git a/src/binder/container.h b/src/binder/container.h
index bdf92ae..081982b 100644
--- a/src/binder/container.h
+++ b/src/binder/container.h
@@ -15,6 +15,7 @@ typedef struct {
PMC *spill; /* Attribute spill storage. */
PMC *descriptor; /* Container descriptor. */
PMC *value; /* The currently held value. */
+ PMC *whence; /* Any whence property */
} Rakudo_Scalar;
/* Various functions related to container manipulations. */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment