[svn:parrot] r47413 - trunk/compilers/pct/src/PAST

pmichaud at svn.parrot.org pmichaud at svn.parrot.org
Sun Jun 6 01:08:28 UTC 2010


Author: pmichaud
Date: Sun Jun  6 01:08:28 2010
New Revision: 47413
URL: https://trac.parrot.org/parrot/changeset/47413

Log:
[pct]: Refactor internals of PAST::Val pasm constant handling a bit.

Modified:
   trunk/compilers/pct/src/PAST/Compiler.pir

Modified: trunk/compilers/pct/src/PAST/Compiler.pir
==============================================================================
--- trunk/compilers/pct/src/PAST/Compiler.pir	Sun Jun  6 01:08:23 2010	(r47412)
+++ trunk/compilers/pct/src/PAST/Compiler.pir	Sun Jun  6 01:08:28 2010	(r47413)
@@ -126,16 +126,13 @@
     valflags['String']   = 's~*:e'
     valflags['Integer']  = 'i+*:'
     valflags['Float']    = 'n+*:'
-    valflags['!cconst']          = 'i+*:c'
-    valflags['!exception_types'] = 'i+*:c'
+    valflags['!cconst']             = 'i+*:c'
+    valflags['!exception_severity'] = 'i+*:c'
+    valflags['!exception_types']    = 'i+*:c'
+    valflags['!iterator']           = 'i+*:c'
+    valflags['!socket']             = 'i+*:c'
     set_global '%valflags', valflags
 
-    .local pmc valconst
-    valconst = new ['Hash']
-    valconst['!cconst']          = '.include "cclass.pasm"'
-    valconst['!exception_types'] = '.include "exception_types.pasm"'
-    set_global '%valconst', valconst
-
     ##  %!controltypes holds the list of exception types for each
     ##  type of exception handler we support
     .local pmc controltypes
@@ -2477,21 +2474,21 @@
     $P0 = get_global '%valflags'
     valflags = $P0[returns]
   
-    .local string valconst 
-    $P0 = get_global '%valconst'
-    valconst = $P0[returns]
-    unless valconst > '' goto valconst_done
-    $P0 = find_dynamic_lex '$*SUB'
-    $P0.'add_directive'(valconst)
-  valconst_done:
-
     $I0 = index valflags, 'e'
     if $I0 < 0 goto escape_done
     value = self.'escape'(value)
   escape_done:
 
+    # See if this is a pasm constant type
     $I0 = index valflags, 'c'
     if $I0 < 0 goto const_done
+    # Add the directive for the appropriate .include statement.
+    $S0 = returns
+    $S0 = replace $S0, 0, 1, '.include "'
+    $S0 = concat $S0, '.pasm"'
+    $P0 = find_dynamic_lex '$*SUB'
+    $P0.'add_directive'($S0)
+    # Add a leading dot to the value if one isn't already there.
     $S0 = substr value, 0, 1
     if $S0 == '.' goto const_done
     $P0 = box '.'


More information about the parrot-commits mailing list