Ticket #1357 (closed patch: fixed)
[patch]changed capture.pmc to use GET_ATTR syntax
| Reported by: | jimmy | Owned by: | jkeenan |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | core | Version: | 1.8.0 |
| Severity: | medium | Keywords: | |
| Cc: | Language: | ||
| Patch status: | applied | Platform: |
Description
changed capture.pmc to use GET_ATTR syntax
Index: src/pmc/capture.pmc
===================================================================
--- src/pmc/capture.pmc (版本 42868)
+++ src/pmc/capture.pmc (工作副本)
@@ -18,13 +18,6 @@
*/
-#define CAPTURE_array_CREATE(i, obj) \
- if (!PARROT_CAPTURE(obj)->array) \
- PARROT_CAPTURE(obj)->array = pmc_new((i), enum_class_ResizablePMCArray);
-#define CAPTURE_hash_CREATE(i, obj) \
- if (!PARROT_CAPTURE(obj)->hash) \
- PARROT_CAPTURE(obj)->hash = pmc_new((i), enum_class_Hash);
-
pmclass Capture auto_attrs {
ATTR PMC *array;
ATTR PMC *hash;
@@ -40,6 +33,9 @@
*/
VTABLE void init() {
+ SET_ATTR_array(interp, SELF,
+ pmc_new(INTERP, enum_class_ResizablePMCArray));
+ SET_ATTR_hash(INTERP, SELF, pmc_new(INTERP, enum_class_Hash));
PObj_custom_mark_SET(SELF);
}
@@ -85,27 +81,31 @@
*/
VTABLE void set_number_keyed_int(INTVAL key, FLOATVAL value) {
- CAPTURE_array_CREATE(INTERP, SELF);
- VTABLE_set_number_keyed_int(INTERP, PARROT_CAPTURE(SELF)->array,
- key, value);
+ PMC *array;
+
+ GET_ATTR_array(INTERP, SELF, array);
+ VTABLE_set_number_keyed_int(INTERP, array, key, value);
}
VTABLE void set_integer_keyed_int(INTVAL key, INTVAL value) {
- CAPTURE_array_CREATE(INTERP, SELF);
- VTABLE_set_integer_keyed_int(INTERP, PARROT_CAPTURE(SELF)->array,
- key, value);
+ PMC *array;
+
+ GET_ATTR_array(INTERP, SELF, array);
+ VTABLE_set_integer_keyed_int(INTERP, array, key, value);
}
VTABLE void set_pmc_keyed_int(INTVAL key, PMC *value) {
- CAPTURE_array_CREATE(INTERP, SELF);
- VTABLE_set_pmc_keyed_int(INTERP, PARROT_CAPTURE(SELF)->array,
- key, value);
+ PMC *array;
+
+ GET_ATTR_array(INTERP, SELF, array);
+ VTABLE_set_pmc_keyed_int(INTERP, array, key, value);
}
VTABLE void set_string_keyed_int(INTVAL key, STRING *value) {
- CAPTURE_array_CREATE(INTERP, SELF);
- VTABLE_set_string_keyed_int(INTERP, PARROT_CAPTURE(SELF)->array,
- key, value);
+ PMC *array;
+
+ GET_ATTR_array(INTERP, SELF, array);
+ VTABLE_set_string_keyed_int(INTERP, array, key, value);
}
/*
@@ -125,31 +125,47 @@
*/
VTABLE FLOATVAL get_number_keyed_int(INTVAL key) {
- if (!(PARROT_CAPTURE(SELF)->array))
+ PMC *array;
+
+ GET_ATTR_array(INTERP, SELF, array);
+
+ if (!array)
return 0.0;
- return VTABLE_get_number_keyed_int(INTERP, PARROT_CAPTURE(SELF)->array,
- key);
+
+ return VTABLE_get_number_keyed_int(INTERP, array, key);
}
VTABLE INTVAL get_integer_keyed_int(INTVAL key) {
- if (!(PARROT_CAPTURE(SELF)->array))
+ PMC *array;
+
+ GET_ATTR_array(INTERP, SELF, array);
+
+ if (!array)
return 0;
- return VTABLE_get_integer_keyed_int(INTERP, PARROT_CAPTURE(SELF)->array,
- key);
+
+ return VTABLE_get_integer_keyed_int(INTERP, array, key);
}
VTABLE PMC *get_pmc_keyed_int(INTVAL key) {
- if (!(PARROT_CAPTURE(SELF)->array))
+ PMC *array;
+
+ GET_ATTR_array(INTERP, SELF, array);
+
+ if (!array)
return PMCNULL;
- return VTABLE_get_pmc_keyed_int(INTERP, PARROT_CAPTURE(SELF)->array,
- key);
+
+ return VTABLE_get_pmc_keyed_int(INTERP, array, key);
}
VTABLE STRING *get_string_keyed_int(INTVAL key) {
- if (!(PARROT_CAPTURE(SELF)->array))
+ PMC *array;
+
+ GET_ATTR_array(INTERP, SELF, array);
+
+ if (!array)
return CONST_STRING(INTERP, "");
- return VTABLE_get_string_keyed_int(INTERP, PARROT_CAPTURE(SELF)->array,
- key);
+
+ return VTABLE_get_string_keyed_int(INTERP, array, key);
}
/*
@@ -179,43 +195,66 @@
*/
VTABLE void push_float(FLOATVAL value) {
- CAPTURE_array_CREATE(INTERP, SELF);
- VTABLE_push_float(INTERP, PARROT_CAPTURE(SELF)->array, value);
+ PMC *array;
+
+ GET_ATTR_array(INTERP, SELF, array);
+
+ VTABLE_push_float(INTERP, array, value);
}
VTABLE void push_integer(INTVAL value) {
- CAPTURE_array_CREATE(INTERP, SELF);
- VTABLE_push_integer(INTERP, PARROT_CAPTURE(SELF)->array, value);
+ PMC *array;
+
+ GET_ATTR_array(INTERP, SELF, array);
+
+ VTABLE_push_integer(INTERP, array, value);
}
VTABLE void push_pmc(PMC *value) {
- CAPTURE_array_CREATE(INTERP, SELF);
- VTABLE_push_pmc(INTERP, PARROT_CAPTURE(SELF)->array, value);
+ PMC *array;
+
+ GET_ATTR_array(INTERP, SELF, array);
+
+ VTABLE_push_pmc(INTERP, array, value);
}
VTABLE void push_string(STRING *value) {
- CAPTURE_array_CREATE(INTERP, SELF);
- VTABLE_push_string(INTERP, PARROT_CAPTURE(SELF)->array, value);
+ PMC *array;
+
+ GET_ATTR_array(INTERP, SELF, array);
+
+ VTABLE_push_string(INTERP, array, value);
}
+ VTABLE void unshift_float(FLOATVAL value) {
+ PMC *array;
- VTABLE void unshift_float(FLOATVAL value) {
- CAPTURE_array_CREATE(INTERP, SELF);
- VTABLE_unshift_float(INTERP, PARROT_CAPTURE(SELF)->array, value);
+ GET_ATTR_array(INTERP, SELF, array);
+
+ VTABLE_unshift_float(INTERP, array, value);
}
VTABLE void unshift_integer(INTVAL value) {
- CAPTURE_array_CREATE(INTERP, SELF);
- VTABLE_unshift_integer(INTERP, PARROT_CAPTURE(SELF)->array, value);
+ PMC *array;
+
+ GET_ATTR_array(INTERP, SELF, array);
+
+ VTABLE_unshift_integer(INTERP, array, value);
}
VTABLE void unshift_pmc(PMC *value) {
- CAPTURE_array_CREATE(INTERP, SELF);
- VTABLE_unshift_pmc(INTERP, PARROT_CAPTURE(SELF)->array, value);
+ PMC *array;
+
+ GET_ATTR_array(INTERP, SELF, array);
+
+ VTABLE_unshift_pmc(INTERP, array, value);
}
VTABLE void unshift_string(STRING *value) {
- CAPTURE_array_CREATE(INTERP, SELF);
- VTABLE_unshift_string(INTERP, PARROT_CAPTURE(SELF)->array, value);
+ PMC *array;
+
+ GET_ATTR_array(INTERP, SELF, array);
+
+ VTABLE_unshift_string(INTERP, array, value);
}
/*
@@ -245,43 +284,67 @@
*/
VTABLE FLOATVAL pop_float() {
- CAPTURE_array_CREATE(INTERP, SELF);
- return VTABLE_pop_float(INTERP, PARROT_CAPTURE(SELF)->array);
+ PMC *array;
+
+ GET_ATTR_array(INTERP, SELF, array);
+
+ return VTABLE_pop_float(INTERP, array);
}
VTABLE INTVAL pop_integer() {
- CAPTURE_array_CREATE(INTERP, SELF);
- return VTABLE_pop_integer(INTERP, PARROT_CAPTURE(SELF)->array);
+ PMC *array;
+
+ GET_ATTR_array(INTERP, SELF, array);
+
+ return VTABLE_pop_integer(INTERP, array);
}
VTABLE PMC *pop_pmc() {
- CAPTURE_array_CREATE(INTERP, SELF);
- return VTABLE_pop_pmc(INTERP, PARROT_CAPTURE(SELF)->array);
+ PMC *array;
+
+ GET_ATTR_array(INTERP, SELF, array);
+
+ return VTABLE_pop_pmc(INTERP, array);
}
VTABLE STRING *pop_string() {
- CAPTURE_array_CREATE(INTERP, SELF);
- return VTABLE_pop_string(INTERP, PARROT_CAPTURE(SELF)->array);
+ PMC *array;
+
+ GET_ATTR_array(INTERP, SELF, array);
+
+ return VTABLE_pop_string(INTERP, array);
}
VTABLE FLOATVAL shift_float() {
- CAPTURE_array_CREATE(INTERP, SELF);
- return VTABLE_shift_float(INTERP, PARROT_CAPTURE(SELF)->array);
+ PMC *array;
+
+ GET_ATTR_array(INTERP, SELF, array);
+
+ return VTABLE_shift_float(INTERP, array);
}
VTABLE INTVAL shift_integer() {
- CAPTURE_array_CREATE(INTERP, SELF);
- return VTABLE_shift_integer(INTERP, PARROT_CAPTURE(SELF)->array);
+ PMC *array;
+
+ GET_ATTR_array(INTERP, SELF, array);
+
+ return VTABLE_shift_integer(INTERP, array);
}
VTABLE PMC *shift_pmc() {
- CAPTURE_array_CREATE(INTERP, SELF);
- return VTABLE_shift_pmc(INTERP, PARROT_CAPTURE(SELF)->array);
+ PMC *array;
+
+ GET_ATTR_array(INTERP, SELF, array);
+
+ return VTABLE_shift_pmc(INTERP, array);
}
VTABLE STRING *shift_string() {
- CAPTURE_array_CREATE(INTERP, SELF);
- return VTABLE_shift_string(INTERP, PARROT_CAPTURE(SELF)->array);
+ PMC *array;
+
+ GET_ATTR_array(INTERP, SELF, array);
+
+ return VTABLE_shift_string(INTERP, array);
}
/*
@@ -307,29 +370,45 @@
*/
VTABLE INTVAL elements() {
- if (!PARROT_CAPTURE(SELF)->array) return 0;
- return VTABLE_elements(INTERP, PARROT_CAPTURE(SELF)->array);
+ PMC *array;
+
+ GET_ATTR_array(INTERP, SELF, array);
+
+ if (!array)
+ return 0;
+
+ return VTABLE_elements(INTERP, array);
}
VTABLE INTVAL defined_keyed_int(INTVAL key) {
- if (!PARROT_CAPTURE(SELF)->array)
+ PMC *array;
+
+ GET_ATTR_array(INTERP, SELF, array);
+
+ if (!array)
return 0;
- return VTABLE_defined_keyed_int(INTERP, PARROT_CAPTURE(SELF)->array,
- key);
+ return VTABLE_defined_keyed_int(INTERP, array, key);
}
VTABLE INTVAL exists_keyed_int(INTVAL key) {
- if (!PARROT_CAPTURE(SELF)->array)
+ PMC *array;
+
+ GET_ATTR_array(INTERP, SELF, array);
+
+ if (!array)
return 0;
- return VTABLE_exists_keyed_int(INTERP, PARROT_CAPTURE(SELF)->array,
- key);
+ return VTABLE_exists_keyed_int(INTERP, array, key);
}
VTABLE void delete_keyed_int(INTVAL key) {
- if (PARROT_CAPTURE(SELF)->array)
- VTABLE_delete_keyed_int(INTERP, PARROT_CAPTURE(SELF)->array, key);
+ PMC *array;
+
+ GET_ATTR_array(INTERP, SELF, array);
+
+ if (array)
+ VTABLE_delete_keyed_int(INTERP, array, key);
}
/*
@@ -349,24 +428,35 @@
*/
VTABLE void set_number_keyed(PMC *key, FLOATVAL value) {
- CAPTURE_hash_CREATE(INTERP, SELF);
- VTABLE_set_number_keyed(INTERP, PARROT_CAPTURE(SELF)->hash, key, value);
+ PMC *hash;
+
+ GET_ATTR_hash(INTERP, SELF, hash);
+
+ VTABLE_set_number_keyed(INTERP, hash, key, value);
}
VTABLE void set_integer_keyed(PMC *key, INTVAL value) {
- CAPTURE_hash_CREATE(INTERP, SELF);
- VTABLE_set_integer_keyed(INTERP, PARROT_CAPTURE(SELF)->hash,
- key, value);
+ PMC *hash;
+
+ GET_ATTR_hash(INTERP, SELF, hash);
+
+ VTABLE_set_integer_keyed(INTERP, hash, key, value);
}
VTABLE void set_pmc_keyed(PMC *key, PMC *value) {
- CAPTURE_hash_CREATE(INTERP, SELF);
- VTABLE_set_pmc_keyed(INTERP, PARROT_CAPTURE(SELF)->hash, key, value);
+ PMC *hash;
+
+ GET_ATTR_hash(INTERP, SELF, hash);
+
+ VTABLE_set_pmc_keyed(INTERP, hash, key, value);
}
VTABLE void set_string_keyed(PMC *key, STRING *value) {
- CAPTURE_hash_CREATE(INTERP, SELF);
- VTABLE_set_string_keyed(INTERP, PARROT_CAPTURE(SELF)->hash, key, value);
+ PMC *hash;
+
+ GET_ATTR_hash(INTERP, SELF, hash);
+
+ VTABLE_set_string_keyed(INTERP, hash, key, value);
}
/*
@@ -386,28 +476,47 @@
*/
VTABLE FLOATVAL get_number_keyed(PMC *key) {
- if (!(PARROT_CAPTURE(SELF)->hash))
+ PMC *hash;
+
+ GET_ATTR_hash(INTERP, SELF, hash);
+
+ if (!hash)
return 0.0;
- return VTABLE_get_number_keyed(INTERP, PARROT_CAPTURE(SELF)->hash, key);
+
+ return VTABLE_get_number_keyed(INTERP, hash, key);
}
VTABLE INTVAL get_integer_keyed(PMC *key) {
- if (!(PARROT_CAPTURE(SELF)->hash))
+ PMC *hash;
+
+ GET_ATTR_hash(INTERP, SELF, hash);
+
+ if (!hash)
return 0;
- return VTABLE_get_integer_keyed(INTERP, PARROT_CAPTURE(SELF)->hash,
- key);
+
+ return VTABLE_get_integer_keyed(INTERP, hash, key);
}
VTABLE PMC *get_pmc_keyed(PMC *key) {
- if (!(PARROT_CAPTURE(SELF)->hash))
+ PMC *hash;
+
+ GET_ATTR_hash(INTERP, SELF, hash);
+
+ if (!hash)
return PMCNULL;
- return VTABLE_get_pmc_keyed(INTERP, PARROT_CAPTURE(SELF)->hash, key);
+
+ return VTABLE_get_pmc_keyed(INTERP, hash, key);
}
VTABLE STRING *get_string_keyed(PMC *key) {
- if (!(PARROT_CAPTURE(SELF)->hash))
+ PMC *hash;
+
+ GET_ATTR_hash(INTERP, SELF, hash);
+
+ if (!hash)
return CONST_STRING(INTERP, "");
- return VTABLE_get_string_keyed(INTERP, PARROT_CAPTURE(SELF)->hash, key);
+
+ return VTABLE_get_string_keyed(INTERP, hash, key);
}
/*
@@ -427,27 +536,35 @@
*/
VTABLE void set_number_keyed_str(STRING *key, FLOATVAL value) {
- CAPTURE_hash_CREATE(INTERP, SELF);
- VTABLE_set_number_keyed_str(INTERP, PARROT_CAPTURE(SELF)->hash,
- key, value);
+ PMC *hash;
+
+ GET_ATTR_hash(INTERP, SELF, hash);
+
+ VTABLE_set_number_keyed_str(INTERP, hash, key, value);
}
VTABLE void set_integer_keyed_str(STRING *key, INTVAL value) {
- CAPTURE_hash_CREATE(INTERP, SELF);
- VTABLE_set_integer_keyed_str(INTERP, PARROT_CAPTURE(SELF)->hash,
- key, value);
+ PMC *hash;
+
+ GET_ATTR_hash(INTERP, SELF, hash);
+
+ VTABLE_set_integer_keyed_str(INTERP, hash, key, value);
}
VTABLE void set_pmc_keyed_str(STRING *key, PMC *value) {
- CAPTURE_hash_CREATE(INTERP, SELF);
- VTABLE_set_pmc_keyed_str(INTERP, PARROT_CAPTURE(SELF)->hash,
- key, value);
+ PMC *hash;
+
+ GET_ATTR_hash(INTERP, SELF, hash);
+
+ VTABLE_set_pmc_keyed_str(INTERP, hash, key, value);
}
VTABLE void set_string_keyed_str(STRING *key, STRING *value) {
- CAPTURE_hash_CREATE(INTERP, SELF);
- VTABLE_set_string_keyed_str(INTERP, PARROT_CAPTURE(SELF)->hash,
- key, value);
+ PMC *hash;
+
+ GET_ATTR_hash(INTERP, SELF, hash);
+
+ VTABLE_set_string_keyed_str(INTERP, hash, key, value);
}
/*
@@ -467,31 +584,46 @@
*/
VTABLE FLOATVAL get_number_keyed_str(STRING *key) {
- if (!(PARROT_CAPTURE(SELF)->hash))
+ PMC *hash;
+
+ GET_ATTR_hash(INTERP, SELF, hash);
+
+ if (!hash)
return 0.0;
- return VTABLE_get_number_keyed_str(INTERP, PARROT_CAPTURE(SELF)->hash,
- key);
+
+ return VTABLE_get_number_keyed_str(INTERP, hash, key);
}
VTABLE INTVAL get_integer_keyed_str(STRING *key) {
- if (!(PARROT_CAPTURE(SELF)->hash))
+ PMC *hash;
+
+ GET_ATTR_hash(INTERP, SELF, hash);
+
+ if (!hash)
return 0;
- return VTABLE_get_integer_keyed_str(INTERP, PARROT_CAPTURE(SELF)->hash,
- key);
+
+ return VTABLE_get_integer_keyed_str(INTERP, hash, key);
}
VTABLE PMC *get_pmc_keyed_str(STRING *key) {
- if (!(PARROT_CAPTURE(SELF)->hash))
+ PMC *hash;
+
+ GET_ATTR_hash(INTERP, SELF, hash);
+
+ if (!hash)
return PMCNULL;
- return VTABLE_get_pmc_keyed_str(INTERP, PARROT_CAPTURE(SELF)->hash,
- key);
+
+ return VTABLE_get_pmc_keyed_str(INTERP, hash, key);
}
VTABLE STRING *get_string_keyed_str(STRING *key) {
- if (!(PARROT_CAPTURE(SELF)->hash))
+ PMC *hash;
+
+ GET_ATTR_hash(INTERP, SELF, hash);
+
+ if (!hash)
return CONST_STRING(INTERP, "");
- return VTABLE_get_string_keyed_str(INTERP, PARROT_CAPTURE(SELF)->hash,
- key);
+ return VTABLE_get_string_keyed_str(INTERP, hash, key);
}
/*
@@ -513,18 +645,34 @@
*/
VTABLE INTVAL defined_keyed(PMC *key) {
- if (!PARROT_CAPTURE(SELF)->hash) return 0;
- return VTABLE_defined_keyed(INTERP, PARROT_CAPTURE(SELF)->hash, key);
+ PMC *hash;
+
+ GET_ATTR_hash(INTERP, SELF, hash);
+
+ if (!hash)
+ return 0;
+
+ return VTABLE_defined_keyed(INTERP, hash, key);
}
VTABLE INTVAL exists_keyed(PMC *key) {
- if (!PARROT_CAPTURE(SELF)->hash) return 0;
- return VTABLE_exists_keyed(INTERP, PARROT_CAPTURE(SELF)->hash, key);
+ PMC *hash;
+
+ GET_ATTR_hash(INTERP, SELF, hash);
+
+ if (!hash)
+ return 0;
+
+ return VTABLE_exists_keyed(INTERP, hash, key);
}
VTABLE void delete_keyed(PMC *key) {
- if (PARROT_CAPTURE(SELF)->hash)
- VTABLE_delete_keyed(INTERP, PARROT_CAPTURE(SELF)->hash, key);
+ PMC *hash;
+
+ GET_ATTR_hash(INTERP, SELF, hash);
+
+ if (hash)
+ VTABLE_delete_keyed(INTERP, hash, key);
}
/*
@@ -546,18 +694,32 @@
*/
VTABLE INTVAL defined_keyed_str(STRING *key) {
- if (!PARROT_CAPTURE(SELF)->hash) return 0;
- return VTABLE_defined_keyed_str(INTERP, PARROT_CAPTURE(SELF)->hash, key);
+ PMC *hash;
+
+ GET_ATTR_hash(INTERP, SELF, hash);
+
+ if (!hash)
+ return 0;
+ return VTABLE_defined_keyed_str(INTERP, hash, key);
}
VTABLE INTVAL exists_keyed_str(STRING *key) {
- if (!PARROT_CAPTURE(SELF)->hash) return 0;
- return VTABLE_exists_keyed_str(INTERP, PARROT_CAPTURE(SELF)->hash, key);
+ PMC *hash;
+
+ GET_ATTR_hash(INTERP, SELF, hash);
+
+ if (!hash)
+ return 0;
+ return VTABLE_exists_keyed_str(INTERP, hash, key);
}
VTABLE void delete_keyed_str(STRING *key) {
- if (PARROT_CAPTURE(SELF)->hash)
- VTABLE_delete_keyed_str(INTERP, PARROT_CAPTURE(SELF)->hash, key);
+ PMC *hash;
+
+ GET_ATTR_hash(INTERP, SELF, hash);
+
+ if (hash)
+ VTABLE_delete_keyed_str(INTERP, hash, key);
}
/*
@@ -573,12 +735,15 @@
VTABLE void set_pmc(PMC *capture) {
if (PMC_IS_NULL(capture)) {
- PARROT_CAPTURE(SELF)->array = NULL;
- PARROT_CAPTURE(SELF)->hash = NULL;
+ SET_ATTR_array(INTERP, SELF, NULL);
+ SET_ATTR_hash(INTERP, SELF, NULL);
}
else if (VTABLE_isa(INTERP, capture, CONST_STRING(INTERP, "Capture"))) {
- PARROT_CAPTURE(SELF)->array = PARROT_CAPTURE(capture)->array;
- PARROT_CAPTURE(SELF)->hash = PARROT_CAPTURE(capture)->hash;
+ PMC *array, *hash;
+ GET_ATTR_array(INTERP, capture, array);
+ GET_ATTR_hash(INTERP, capture, hash);
+ SET_ATTR_array(INTERP, SELF, array);
+ SET_ATTR_hash(INTERP, SELF, hash);
}
else
Parrot_ex_throw_from_c_args(INTERP, NULL, EXCEPTION_INVALID_OPERATION,
@@ -597,7 +762,7 @@
*/
VTABLE STRING *get_string() {
- STRING *classname = VTABLE_name(INTERP, SELF);
+ const STRING * const classname = VTABLE_name(INTERP, SELF);
return Parrot_sprintf_c(INTERP, "%S[0x%x]", classname, SELF);
}
@@ -612,11 +777,13 @@
*/
VTABLE void mark() {
- Parrot_Capture_attributes * const data = PARROT_CAPTURE(SELF);
- if (!data)
- return;
- Parrot_gc_mark_PMC_alive(INTERP, data->array);
- Parrot_gc_mark_PMC_alive(INTERP, data->hash);
+ PMC *array, *hash;
+
+ GET_ATTR_array(INTERP, SELF, array);
+ GET_ATTR_hash(INTERP, SELF, hash);
+
+ Parrot_gc_mark_PMC_alive(INTERP, array);
+ Parrot_gc_mark_PMC_alive(INTERP, hash);
}
/*
@@ -634,20 +801,21 @@
METHOD list() {
PMC *capt_array;
PMC *capt = SELF;
+
/* XXX: This workaround is for when we get here as
part of a subclass of Capture */
if (PObj_is_object_TEST(SELF)) {
- STRING *attribute = CONST_STRING(interp, "proxy");
PMC *classobj;
- PMC *ns = INTERP->root_namespace;
- ns = Parrot_get_namespace_keyed_str(INTERP, ns, CONST_STRING(INTERP, "parrot"));
- ns = Parrot_get_namespace_keyed_str(INTERP, ns, CONST_STRING(INTERP, "Capture"));
- classobj = Parrot_oo_get_class(INTERP, ns);
- capt = VTABLE_get_attr_keyed(interp, SELF, classobj, attribute);
+ PMC *ns = INTERP->root_namespace;
+ STRING *attribute = CONST_STRING(INTERP, "proxy");
+
+ ns = Parrot_get_namespace_keyed_str(INTERP, ns, CONST_STRING(INTERP, "parrot"));
+ ns = Parrot_get_namespace_keyed_str(INTERP, ns, CONST_STRING(INTERP, "Capture"));
+ classobj = Parrot_oo_get_class(INTERP, ns);
+ capt = VTABLE_get_attr_keyed(INTERP, SELF, classobj, attribute);
}
- CAPTURE_array_CREATE(INTERP, capt);
- capt_array = PARROT_CAPTURE(capt)->array;
+ GET_ATTR_array(INTERP, capt, capt_array);
RETURN(PMC *capt_array);
}
@@ -658,13 +826,15 @@
/* XXX: This workaround is for when we get here as
part of a subclass of Capture */
if (PObj_is_object_TEST(SELF)) {
- STRING *classname = CONST_STRING(INTERP, "Capture");
- PMC *classobj = Parrot_oo_get_class_str(INTERP, classname);
- STRING *attribute = CONST_STRING(interp, "proxy");
- capt = VTABLE_get_attr_keyed(interp, SELF, classobj, attribute);
+ STRING * const classname = CONST_STRING(INTERP, "Capture");
+ STRING *attribute = CONST_STRING(INTERP, "proxy");
+ PMC *classobj = Parrot_oo_get_class_str(INTERP, classname);
+
+ capt = VTABLE_get_attr_keyed(INTERP, SELF, classobj, attribute);
}
- CAPTURE_hash_CREATE(INTERP, capt);
- capt_hash = PARROT_CAPTURE(capt)->hash;
+
+ GET_ATTR_hash(INTERP, capt, capt_hash);
+
RETURN(PMC *capt_hash);
}
Index: t/pmc/capture.t
===================================================================
--- t/pmc/capture.t (版本 42868)
+++ t/pmc/capture.t (工作副本)
@@ -8,7 +8,7 @@
=head1 SYNOPSIS
- % prove t/pmc/capture.t
+ % parrot t/pmc/capture.t
=head1 DESCRIPTION
Attachments
Change History
Note: See
TracTickets for help on using
tickets.

