2004-12-11 Martin Baulig <martin@ximian.com>
authorMartin Baulig <martin@novell.com>
Sat, 11 Dec 2004 01:10:45 +0000 (01:10 -0000)
committerMartin Baulig <martin@novell.com>
Sat, 11 Dec 2004 01:10:45 +0000 (01:10 -0000)
* get.c (get_typespec): Added `gboolean is_def' argument; removed
the special case for MONO_TYPE_VAR/MVAR and pass `is_def' down to
dis_stringify_type().
(get_escaped_name): Allow `!'.

svn path=/trunk/mono/; revision=37621

mono/dis/ChangeLog
mono/dis/dump.c
mono/dis/get.c
mono/dis/get.h

index 4cf43d0b8012414290c2375eac87245775309141..f7b04525cfe2d65d6d9cd047b0ee02469b00dc3c 100644 (file)
@@ -1,3 +1,10 @@
+2004-12-11  Martin Baulig  <martin@ximian.com>
+
+       * get.c (get_typespec): Added `gboolean is_def' argument; removed
+       the special case for MONO_TYPE_VAR/MVAR and pass `is_def' down to
+       dis_stringify_type().
+       (get_escaped_name): Allow `!'.  
+
 2004-12-11  Martin Baulig  <martin@ximian.com>
 
        * get.c (get_token): Escape typedefs, typerefs and typespecs.
index 9aaed0ac180807eab7426fff9af4a1f58eaa198f..dce77a41adac41c67c29091b34421a5d67e7e94f 100644 (file)
@@ -102,7 +102,7 @@ dump_table_typespec (MonoImage *m)
        fprintf (output, "Typespec Table\n");
        
        for (i = 1; i <= t->rows; i++){         
-               char *typespec = get_typespec (m, i, NULL);
+               char *typespec = get_typespec (m, i, TRUE, NULL);
 
                fprintf (output, "%d: %s\n", i, typespec);
                g_free (typespec);
@@ -257,7 +257,7 @@ dump_table_memberref (MonoImage *m)
                        break;
                case 4:
                        ks = "TypeSpec";
-                       xx = get_typespec (m, idx, NULL);
+                       xx = get_typespec (m, idx, FALSE, NULL);
                        x = g_strconcat (xx, ".", mono_metadata_string_heap (m, cols [MONO_MEMBERREF_NAME]), NULL);
                        g_free (xx);
                        break;
@@ -1063,7 +1063,8 @@ dump_table_genericpar (MonoImage *m)
                 char *sig;
                mono_metadata_decode_row (t, i - 1, cols, MONO_GENERICPARAM_SIZE);
 
-                sig = get_type_or_methdef (m, cols [MONO_GENERICPARAM_OWNER]);
+                // sig = get_type_or_methdef (m, cols [MONO_GENERICPARAM_OWNER]);
+               sig = g_strdup_printf ("%x", cols [MONO_GENERICPARAM_OWNER]);
                fprintf (output, "%d: %d, flags=%d, owner=%s %s\n", i,
                         cols [MONO_GENERICPARAM_NUMBER],
                         cols [MONO_GENERICPARAM_FLAGS], sig,
@@ -1112,7 +1113,8 @@ dump_table_parconstraint (MonoImage *m)
                 char *sig;
                mono_metadata_decode_row (t, i - 1, cols, MONO_GENPARCONSTRAINT_SIZE);
 
-                sig = get_typedef_or_ref (m, cols [MONO_GENPARCONSTRAINT_CONSTRAINT], NULL);
+                // sig = get_typedef_or_ref (m, cols [MONO_GENPARCONSTRAINT_CONSTRAINT], NULL);
+               sig = g_strdup_printf ("%x", cols [MONO_GENPARCONSTRAINT_CONSTRAINT]);
                fprintf (output, "%d: gen-par=%d, Constraint=%s\n", i,
                         cols [MONO_GENPARCONSTRAINT_GENERICPAR], sig);
                 g_free (sig);
index 2ab9a9aa9a48d06c695eb7aa2f9595ff2ec701fd..392122305e569701a19888501b52a32ea6ff184e 100644 (file)
@@ -169,7 +169,7 @@ get_array_shape (MonoImage *m, const char *ptr, char **result)
  * Returns the stringified representation of a TypeSpec signature (22.2.17)
  */
 char *
-get_typespec (MonoImage *m, guint32 idx, MonoGenericContext *context)
+get_typespec (MonoImage *m, guint32 idx, gboolean is_def, MonoGenericContext *context)
 {
        guint32 cols [MONO_TYPESPEC_SIZE];
        const char *ptr;
@@ -234,15 +234,8 @@ get_typespec (MonoImage *m, guint32 idx, MonoGenericContext *context)
                g_free (s);
                break;
 
-       case MONO_TYPE_VAR:
-       case MONO_TYPE_MVAR:
-               ptr = get_type (m, ptr-1, &s, context);
-               g_string_append (res, s);
-               g_free (s);
-               break;
-               
        default:
-               s = dis_stringify_type (m, type, FALSE);
+               s = dis_stringify_type (m, type, is_def);
                g_string_append (res, s);
                g_free (s);
                break;
@@ -351,7 +344,7 @@ get_typedef_or_ref (MonoImage *m, guint32 dor_token, MonoGenericContext *context
                break;
                
        case 2: /* TypeSpec */
-               s = get_typespec (m, idx, context);
+               s = get_typespec (m, idx, FALSE, context);
                break;
 
        default:
@@ -476,7 +469,7 @@ dis_stringify_token (MonoImage *m, guint32 token)
        switch (token >> 24) {
        case MONO_TABLE_TYPEDEF: return get_typedef (m, idx);
        case MONO_TABLE_TYPEREF: return get_typeref (m, idx);
-       case MONO_TABLE_TYPESPEC: return get_typespec (m, idx, NULL);
+       case MONO_TABLE_TYPESPEC: return get_typespec (m, idx, FALSE, NULL);
        default:
                 break;
        }
@@ -1194,7 +1187,8 @@ get_escaped_name (const char *name)
        }
 
        for (s = name; *s; s++) {
-               if (isalnum (*s) || *s == '_' || *s == '$' || *s == '@' || *s == '?' || *s == '.' || *s == 0)
+               if (isalnum (*s) || *s == '_' || *s == '$' || *s == '@' ||
+                   *s == '?' || *s == '.' || *s == 0 || *s == '!')
                        continue;
 
                return g_strdup_printf ("'%s'", name);
@@ -1477,7 +1471,7 @@ get_memberref_parent (MonoImage *m, guint32 mrp_token, MonoGenericContext *conte
                return g_strdup ("TODO:MethodDef");
                
        case 4: /* TypeSpec */
-               return get_typespec (m, idx, context);
+               return get_typespec (m, idx, FALSE, context);
        }
        g_assert_not_reached ();
        return NULL;
@@ -1859,7 +1853,7 @@ get_token (MonoImage *m, guint32 token, MonoGenericContext *context)
                g_free (temp);
                return result;
        case MONO_TOKEN_TYPE_SPEC:
-               temp = get_typespec (m, idx, context);
+               temp = get_typespec (m, idx, TRUE, context);
                result = get_escaped_name (temp);
                g_free (temp);
                return result;
@@ -1917,7 +1911,7 @@ get_token_type (MonoImage *m, guint32 token, MonoGenericContext *context)
                break;
                
        case MONO_TOKEN_TYPE_SPEC:
-               s = get_typespec (m, idx, context);
+               s = get_typespec (m, idx, FALSE, context);
                break;
 
        default:
index 791d07158b1fddc504356a5686e47d9690a3e6c2..84f987c888cad7c3e0ea62bcdf65c4b9c94235d6 100644 (file)
@@ -23,7 +23,7 @@ char *get_methodspec          (MonoImage *m, int idx, guint32 token, const char
 char *get_constant            (MonoImage *m, MonoTypeEnum t, guint32 blob_index);
 char *get_token               (MonoImage *m, guint32 token, MonoGenericContext *context);
 char *get_token_type          (MonoImage *m, guint32 token, MonoGenericContext *context);
-char *get_typespec            (MonoImage *m, guint32 blob_idx, MonoGenericContext *context);
+char *get_typespec            (MonoImage *m, guint32 blob_idx, gboolean is_def, MonoGenericContext *context);
 char *get_methoddef           (MonoImage *m, guint32 idx);
 char *get_method              (MonoImage *m, guint32 token, MonoGenericContext *context);
 char *get_method_type_param   (MonoImage *m, guint32 blob_signature, MonoGenericContext *context);