develooper Front page | perl.cvs.parrot | Postings from December 2008

[svn:parrot] r34573 - trunk/compilers/pirc/new

From:
kjs
Date:
December 29, 2008 05:58
Subject:
[svn:parrot] r34573 - trunk/compilers/pirc/new
Message ID:
20081229135812.7833DCB9FA@x12.develooper.com
Author: kjs
Date: Mon Dec 29 05:58:11 2008
New Revision: 34573

Modified:
   trunk/compilers/pirc/new/bcgen.c
   trunk/compilers/pirc/new/bcgen.h

Log:
[pirc] bits for namespace stuff in PMC_sub.

Modified: trunk/compilers/pirc/new/bcgen.c
==============================================================================
--- trunk/compilers/pirc/new/bcgen.c	(original)
+++ trunk/compilers/pirc/new/bcgen.c	Mon Dec 29 05:58:11 2008
@@ -494,19 +494,17 @@
 */
 static PMC *
 create_lexinfo(bytecode * const bc, PMC * sub, lexical * const lexicals, int lexflag) {
-    lexical *lexiter;
+    lexical      * lexiter     = lexicals;
+    INTVAL   const lex_info_id = Parrot_get_ctx_HLL_type(bc->interp, enum_class_LexInfo);
+    STRING * const method      = string_from_literal(bc->interp, "declare_lex_preg");
 
     int      outer = 0; /* change type of this */
 
-
-    INTVAL const lex_info_id      = Parrot_get_ctx_HLL_type(bc->interp, enum_class_LexInfo);
-
-    STRING * const method         = string_from_literal(bc->interp, "declare_lex_preg");
-
-    PMC * lex_info                = pmc_new_noinit(bc->interp, lex_info_id);
+    /* create a lexinfo PMC */
+    PMC * lex_info             = pmc_new_noinit(bc->interp, lex_info_id);
     VTABLE_init_pmc(bc->interp, lex_info, sub);
 
-    lexiter = lexicals;
+    /* walk through the list of lexicals and register them */
     while (lexiter) {
         STRING *lexname = string_from_cstring(bc->interp, lexiter->name, strlen(lexiter->name));
 
@@ -569,6 +567,19 @@
 }
 
 
+
+/*
+
+Get the namespace PMC.
+
+*/
+static PMC *
+get_namespace_pmc(bytecode * const bc, multi_type * const ns) {
+
+    return NULL;
+}
+
+
 /*
 
 =item C<void
@@ -604,14 +615,10 @@
     sub->start_offs       = info->startoffset;
     sub->end_offs         = info->endoffset;
 
-    /* XXX fix namespace stuff */
-    sub->namespace_name   = NULL;
+    sub->namespace_name   = get_namespace_pmc(bc, info->name_space);
 
-    /* XXX does this work properly? is "current_HLL" really "current"? */
     sub->HLL_id           = CONTEXT(bc->interp)->current_HLL;
-
     sub->lex_info         = create_lexinfo(bc, sub_pmc, info->lexicals, needlex);
-
     sub->outer_sub        = find_outer_sub(bc, info->outersub);
 
     /* Set the vtable index; if this .sub was declared as :vtable, its vtable

Modified: trunk/compilers/pirc/new/bcgen.h
==============================================================================
--- trunk/compilers/pirc/new/bcgen.h	(original)
+++ trunk/compilers/pirc/new/bcgen.h	Mon Dec 29 05:58:11 2008
@@ -64,6 +64,7 @@
     unsigned             num_multi_types;
     multi_type         * multi_types;   /* data types of parameters if this is a multi sub */
     lexical            * lexicals;
+    multi_type         * name_space; /* can be a string or key */
 
 } sub_info;
 



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About