Author: jisom
Date: Mon Mar  6 00:43:10 2006
New Revision: 11800

Modified:
   trunk/src/ops/experimental.ops

Log:
Add a new_p_s_p op to experimental.ops
No tests, don't know where
Only one test exists which tests the new_p_i_p opcode...
So not sure where to test it.


Modified: trunk/src/ops/experimental.ops
==============================================================================
--- trunk/src/ops/experimental.ops      (original)
+++ trunk/src/ops/experimental.ops      Mon Mar  6 00:43:10 2006
@@ -313,6 +313,30 @@
     goto NEXT();
 }
 
+=item B<new>(out PMC, inconst STR, in PMC)
+
+Create a new PMC of class $2;
+
+ new P0, "Foo", P1
+
+The PMC in $3 is passed to the constructor. It's up to the class what to do
+with the intializer.
+
+=cut
+
+op new(out PMC, in STR, in PMC) {
+       STRING *class = $2;
+       INTVAL type = pmc_type(interpreter, class);
+       if (!type) {
+               Parrot_autoload_class(interpreter, class);
+               type = pmc_type(interpreter, class);
+       }
+       if (type <= 0)
+               real_exception(interpreter, NULL, NO_CLASS,
+                               "Class '%Ss' not found", class);
+       $1 = pmc_new_init(interpreter, type, $3);
+       goto NEXT();
+}
 
 =back
 

Reply via email to