Skip to content
This repository
Browse code

Borrow Signature.clone

  • Loading branch information...
commit c8f90a28143534d15ed34b5b790773088ce364d6 1 parent bb88aec
Vasily Chekalkin authored March 29, 2012

Showing 1 changed file with 20 additions and 1 deletion. Show diff stats Hide diff stats

  1. 21  src/call/signature.c
21  src/call/signature.c
@@ -204,7 +204,26 @@ PARROT_CANNOT_RETURN_NULL
204 204
 Parrot_Signature *
205 205
 Parrot_pcc_signature_clone(PARROT_INTERP, ARGIN(Parrot_Signature *self))
206 206
 {
207  
-    PARROT_ASSERT(!"NYI");
  207
+    Parrot_Signature *dest = Parrot_pcc_signature_new(interp);
  208
+
  209
+    /* Copy positionals */
  210
+    ensure_positionals_storage(interp, dest, self->num_positionals);
  211
+    memcpy(dest->positionals, self->positionals, self->num_positionals * sizeof (Pcc_cell));
  212
+    dest->num_positionals = self->num_positionals;
  213
+
  214
+    dest->type_tuple    = VTABLE_clone(interp, self->type_tuple);
  215
+    dest->short_sig     = interp, self->short_sig;
  216
+    dest->arg_flags     = VTABLE_clone(interp, self->arg_flags);
  217
+    dest->return_flags  = VTABLE_clone(interp, self->return_flags);
  218
+
  219
+    if (self->hash) {
  220
+        Hash *dest_hash = get_hash(interp, dest);
  221
+        Parrot_hash_clone(interp, hash, dest_hash);
  222
+        parrot_hash_iterate(dest_hash,
  223
+            Pcc_cell *tmp;
  224
+            CLONE_CELL(INTERP, (Pcc_cell *)_bucket->value, tmp);
  225
+            _bucket->value = tmp;);
  226
+    }
208 227
 }
209 228
 
210 229
 /*

0 notes on commit c8f90a2

Please sign in to comment.
Something went wrong with that request. Please try again.