[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[dotgnu-pnet-commits] pnet ChangeLog codegen/cg_decls.tc codegen/cg_n...
From: |
Klaus Treichel |
Subject: |
[dotgnu-pnet-commits] pnet ChangeLog codegen/cg_decls.tc codegen/cg_n... |
Date: |
Wed, 07 Nov 2007 16:39:42 +0000 |
CVSROOT: /cvsroot/dotgnu-pnet
Module name: pnet
Changes by: Klaus Treichel <ktreichel> 07/11/07 16:39:42
Modified files:
. : ChangeLog
codegen : cg_decls.tc cg_nodes.tc jv_decls.tc
cscc/csharp : cs_decls.tc cs_gather.c cs_lvalue.tc
cscc/java : java_decls.tc
csdoc : doc_sort.c il2doc.c
image : class.c meta_build.c
Log message:
Add support for generics in il2doc. Add support for nested types in
doc_sort.c.
Some bug fixes and changes in image and cscc.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/pnet/ChangeLog?cvsroot=dotgnu-pnet&r1=1.3513&r2=1.3514
http://cvs.savannah.gnu.org/viewcvs/pnet/codegen/cg_decls.tc?cvsroot=dotgnu-pnet&r1=1.58&r2=1.59
http://cvs.savannah.gnu.org/viewcvs/pnet/codegen/cg_nodes.tc?cvsroot=dotgnu-pnet&r1=1.90&r2=1.91
http://cvs.savannah.gnu.org/viewcvs/pnet/codegen/jv_decls.tc?cvsroot=dotgnu-pnet&r1=1.16&r2=1.17
http://cvs.savannah.gnu.org/viewcvs/pnet/cscc/csharp/cs_decls.tc?cvsroot=dotgnu-pnet&r1=1.44&r2=1.45
http://cvs.savannah.gnu.org/viewcvs/pnet/cscc/csharp/cs_gather.c?cvsroot=dotgnu-pnet&r1=1.58&r2=1.59
http://cvs.savannah.gnu.org/viewcvs/pnet/cscc/csharp/cs_lvalue.tc?cvsroot=dotgnu-pnet&r1=1.65&r2=1.66
http://cvs.savannah.gnu.org/viewcvs/pnet/cscc/java/java_decls.tc?cvsroot=dotgnu-pnet&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/pnet/csdoc/doc_sort.c?cvsroot=dotgnu-pnet&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/pnet/csdoc/il2doc.c?cvsroot=dotgnu-pnet&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/pnet/image/class.c?cvsroot=dotgnu-pnet&r1=1.41&r2=1.42
http://cvs.savannah.gnu.org/viewcvs/pnet/image/meta_build.c?cvsroot=dotgnu-pnet&r1=1.49&r2=1.50
Patches:
Index: ChangeLog
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/ChangeLog,v
retrieving revision 1.3513
retrieving revision 1.3514
diff -u -b -r1.3513 -r1.3514
--- ChangeLog 30 Oct 2007 17:35:22 -0000 1.3513
+++ ChangeLog 7 Nov 2007 16:39:40 -0000 1.3514
@@ -1,3 +1,43 @@
+2007-11-07 Klaus Treichel <address@hidden>
+
+ * codegen/cg_decls.tc: Add the GenDiscard operations for
+ ILNode_GenericTypeParameter and ILNode_GenericTypeParameters.
+
+ * codegen/cg_nodes.tc: Change the node types of
ILNode_GenericTypeParameter
+ and ILNode_GenericTypeParameters from ILNode_Dummy to
ILNode_Declaration.
+ Add the enum ILGenParamTarget to handle method- and cass generic type
+ parameters in the GenDiscard operation.
+
+ * codegen/jv_decls.tc: Add stubs of the JavaGenDiscard operations for
+ ILNode_GenericTypeParameter and ILNode_GenericTypeParameters.
+
+ * cscc/csharp/cs_decls.tc: Add semantic analysis of the generic
parameters
+ during semantic analysis of the class and methods. Move the semantic
+ analysis of ILNode_GenericTypeParameter and ILNode_GenericTypeParameters
+ to this file.
+ Add the stubs of the GatherStaticCtor operations for declarations for
+ ILNode_GenericTypeParameter and ILNode_GenericTypeParameters.
+
+ * cscc/csharp/cs_gather.c: Set the genParamTarget in the generic
parameter
+ during type gathering.
+
+ * cscc/csharp/cs_lvalue.tc: Remove the samantic analysis operations that
+ were moved to cs_decls.c.
+
+ * cscc/java/java_decls.tc: Add stubs of the GatherStaticCtor operations
+ for ILNode_GenericTypeParameter and ILNode_GenericTypeParameters.
+
+ * csdoc/doc_sort.c: Add support for nested types by using the part in
+ fullName before the name only part as namespace.
+
+ * csdoc/il2doc.c: Add support for generics.
+
+ * image/class.c: Return 0 instead of 1 in ILClassInheritable if a class
+ might inherit itself.
+
+ * image/meta_build.c: Fix a problem in Load_MemberRef with IL_DEBUG_META
+ set if the member owner has no className.
+
2007-10-30 Klaus Treichel <address@hidden>
* codegen/cg_gen.c: Add handling of with types in ILTypeToClass.
Index: codegen/cg_decls.tc
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/codegen/cg_decls.tc,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -b -r1.58 -r1.59
--- codegen/cg_decls.tc 20 Sep 2007 20:04:15 -0000 1.58
+++ codegen/cg_decls.tc 7 Nov 2007 16:39:41 -0000 1.59
@@ -1103,3 +1103,45 @@
}
#endif
}
+
+ILNode_GenDiscard(ILNode_GenericTypeParameter)
+{
+#if IL_VERSION_MAJOR > 1
+ if (info->asmOutput)
+ {
+ if(node->attrs)
+ {
+ if(node->target == ILGenParamTarget_Class)
+ {
+ fprintf(info->asmOutput, ".param [!%i]\n",
+ node->num + 1);
+ }
+ else
+ {
+ fprintf(info->asmOutput, ".param [!!%i]\n",
+ node->num + 1);
+ }
+ /* Output the attributes that are attached to the type
parameter */
+ ILGenOutputAttributes(info, info->asmOutput,
+
(ILProgramItem *)node->genPar);
+ }
+ }
+#endif /* IL_VERSION_MAJOR > 1 */
+}
+
+ILNode_GenDiscard(ILNode_GenericTypeParameters)
+{
+#if IL_VERSION_MAJOR > 1
+ if (info->asmOutput)
+ {
+ ILNode_ListIter iter;
+ ILNode *genPar;
+
+ ILNode_ListIter_Init(&iter, node->typeParams);
+ while((genPar = ILNode_ListIter_Next(&iter)) != 0)
+ {
+ ILNode_GenDiscard(genPar, info);
+ }
+ }
+#endif /* IL_VERSION_MAJOR > 1 */
+}
Index: codegen/cg_nodes.tc
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/codegen/cg_nodes.tc,v
retrieving revision 1.90
retrieving revision 1.91
diff -u -b -r1.90 -r1.91
--- codegen/cg_nodes.tc 23 Sep 2007 14:40:19 -0000 1.90
+++ codegen/cg_nodes.tc 7 Nov 2007 16:39:41 -0000 1.91
@@ -600,20 +600,6 @@
int baseAccess;
%nocreate long saveStack = {0};
}
-%node ILNode_GenericTypeParameter ILNode_Dummy =
-{
- ILUInt32 num;
- const char *name;
- ILUInt32 constraint;
- ILNode_List *typeConstraints;
- %nocreate ILVisitMode visited = {ILVisitMode_NotVisited};
-}
-%node ILNode_GenericTypeParameters ILNode_Dummy =
-{
- ILUInt32 numTypeParams;
- ILNode_List *typeParams;
- %nocreate ILVisitMode visited = {ILVisitMode_NotVisited};
-}
%output "cg_ainit.c"
@@ -815,6 +801,16 @@
/*
* Declarations.
*/
+
+/*
+ * Gereric parameter targets.
+ */
+%enum ILGenParamTarget =
+{
+ ILGenParamTarget_Class, /* generic class
parameter */
+ ILGenParamTarget_Method /* generic method
parameter */
+}
+
%node ILNode_Declaration ILNode_Statement %abstract
%node ILNode_ClassDefn ILNode_Declaration =
{
@@ -944,6 +940,29 @@
ILNode *name;
}
+/*
+ * Generic type parameter nodes
+ */
+%node ILNode_GenericTypeParameter ILNode_Declaration =
+{
+ ILUInt32 num;
+ const char *name;
+ ILUInt32 constraint;
+ ILNode_List *typeConstraints;
+ %nocreate ILNode *attrs = {0};
+ %nocreate ILType *mainType = {0};
+ %nocreate ILGenericPar *genPar = {0};
+ %nocreate ILGenParamTarget target = {ILGenParamTarget_Class};
+ %nocreate ILVisitMode visited = {ILVisitMode_NotVisited};
+}
+
+%node ILNode_GenericTypeParameters ILNode_Declaration =
+{
+ ILUInt32 numTypeParams;
+ ILNode_List *typeParams;
+ %nocreate ILVisitMode visited = {ILVisitMode_NotVisited};
+}
+
%output "cg_attrs.c"
/*
Index: codegen/jv_decls.tc
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/codegen/jv_decls.tc,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -b -r1.16 -r1.17
--- codegen/jv_decls.tc 27 Feb 2003 06:19:22 -0000 1.16
+++ codegen/jv_decls.tc 7 Nov 2007 16:39:41 -0000 1.17
@@ -120,3 +120,13 @@
{
/* TODO */
}
+
+JavaGenDiscard(ILNode_GenericTypeParameter)
+{
+ /* TODO */
+}
+
+JavaGenDiscard(ILNode_GenericTypeParameters)
+{
+ /* TODO */
+}
Index: cscc/csharp/cs_decls.tc
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/cscc/csharp/cs_decls.tc,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -b -r1.44 -r1.45
--- cscc/csharp/cs_decls.tc 30 Oct 2007 17:35:23 -0000 1.44
+++ cscc/csharp/cs_decls.tc 7 Nov 2007 16:39:41 -0000 1.45
@@ -132,6 +132,14 @@
}
node->visited = ILVisitMode_Processing;
+#if IL_VERSION_MAJOR > 1
+ /* perform the semantic analysis for the generic type parameters */
+ if(node->typeFormals)
+ {
+ ILNode_SemAnalysis(node->typeFormals, info,
&(node->typeFormals));
+ }
+#endif /* IL_VERSION_MAJOR > 1 */
+
/* Process the attributes for the class */
if(node->defaultMemberName)
{
@@ -947,6 +955,14 @@
}
node->visited = ILVisitMode_Processing;
+#if IL_VERSION_MAJOR > 1
+ /* perform the semantic analysis for the generic type parameters */
+ if(node->typeFormals)
+ {
+ ILNode_SemAnalysis(node->typeFormals, info,
&(node->typeFormals));
+ }
+#endif /* IL_VERSION_MAJOR > 1 */
+
/* Process the attributes on the method */
if(ILMethod_IsConstructor(node->methodInfo) ||
ILMethod_IsStaticConstructor(node->methodInfo))
@@ -1430,6 +1446,81 @@
return CSSemValueDefault;
}
+/*
+ * Perform semantic analysis for generic parameters.
+ */
+ILNode_SemAnalysis(ILNode_GenericTypeParameter)
+{
+#if IL_VERSION_MAJOR > 1
+ if(node->visited == ILVisitMode_NotVisited)
+ {
+ ILUInt32 first = 1;
+ ILNode_ListIter iter;
+ ILNode *constraint;
+
+ node->visited = ILVisitMode_Processing;
+ ILNode_ListIter_Init(&iter, (ILNode *)node->typeConstraints);
+ while((constraint = ILNode_ListIter_Next(&iter)) != 0)
+ {
+ ILType *constraintType;
+
+ constraintType = CSSemType(constraint, info,
&constraint);
+ if(constraintType)
+ {
+ ILClass *constraintClass =
ILClassFromType(info->image, 0, constraintType, 0);
+
+ if(first)
+ {
+
if(!ILClass_IsInterface(constraintClass))
+ {
+ if(node->constraint &
(IL_META_GENPARAM_CLASS_CONST |
+
IL_META_GENPARAM_VALUETYPE_CONST))
+ {
+
CCErrorOnLine(yygetfilename(constraint), yygetlinenum(constraint),
+
"either class or valuetype or a non interface class can be supplied");
+ }
+ }
+ first = 0;
+ }
+ else
+ {
+
if(!ILClass_IsInterface(constraintClass))
+ {
+
CCErrorOnLine(yygetfilename(constraint), yygetlinenum(constraint),
+ "only
one non interface class can be supplied");
+ }
+ }
+
+ /* Import the constraint class into the build
image. */
+ constraintClass = ILClassImport(info->image,
constraintClass);
+ }
+ }
+ node->visited = ILVisitMode_Done;
+ }
+#endif /* IL_VERSION_MAJOR > 1 */
+ return CSSemValueDefault;
+}
+
+ILNode_SemAnalysis(ILNode_GenericTypeParameters)
+{
+#if IL_VERSION_MAJOR > 1
+ if(node->visited == ILVisitMode_NotVisited)
+ {
+ ILNode_ListIter iter;
+ ILNode *genPar;
+
+ node->visited = ILVisitMode_Processing;
+ ILNode_ListIter_Init(&iter, (ILNode *)node->typeParams);
+ while((genPar = ILNode_ListIter_Next(&iter)) != 0)
+ {
+ ILNode_SemAnalysis(genPar, info, &(genPar));
+ }
+ node->visited = ILVisitMode_Done;
+ }
+#endif /* IL_VERSION_MAJOR > 1 */
+ return CSSemValueDefault;
+}
+
ILNode_Declaration_GatherStaticCtor(ILNode_EventDeclaration),
ILNode_Declaration_GatherStaticCtor(ILNode_EventDeclarator),
ILNode_Declaration_GatherStaticCtor(ILNode_MethodDeclaration),
@@ -1441,7 +1532,9 @@
ILNode_Declaration_GatherStaticCtor(ILNode_AttributeSection),
ILNode_Declaration_GatherStaticCtor(ILNode_Attribute),
ILNode_Declaration_GatherStaticCtor(ILNode_AttrArgs),
-ILNode_Declaration_GatherStaticCtor(ILNode_NamedArg)
+ILNode_Declaration_GatherStaticCtor(ILNode_NamedArg),
+ILNode_Declaration_GatherStaticCtor(ILNode_GenericTypeParameter),
+ILNode_Declaration_GatherStaticCtor(ILNode_GenericTypeParameters)
{
return;
}
Index: cscc/csharp/cs_gather.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/cscc/csharp/cs_gather.c,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -b -r1.58 -r1.59
--- cscc/csharp/cs_gather.c 30 Oct 2007 17:35:23 -0000 1.58
+++ cscc/csharp/cs_gather.c 7 Nov 2007 16:39:41 -0000 1.59
@@ -171,9 +171,7 @@
ILNode_ListIter iter;
ILNode_GenericTypeParameter *genParam;
ILNode_GenericTypeParameters *genParams;
-
- /* Perform the semantic analysis on the typeFormals */
- ILNode_SemAnalysis(typeFormals, info, &typeFormals);
+ ILMethod *method = ILProgramItemToMethod(owner);
genParams = (ILNode_GenericTypeParameters *)typeFormals;
ILNode_ListIter_Init(&iter, genParams->typeParams);
@@ -192,6 +190,11 @@
}
ILGenericParSetFlags(genPar, IL_MAX_UINT32,
genParam->constraint);
AddGenericConstraints(info, genPar,
genParam->typeConstraints);
+ genParam->genPar = genPar;
+ if(method)
+ {
+ genParam->target = ILGenParamTarget_Method;
+ }
}
}
}
Index: cscc/csharp/cs_lvalue.tc
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/cscc/csharp/cs_lvalue.tc,v
retrieving revision 1.65
retrieving revision 1.66
diff -u -b -r1.65 -r1.66
--- cscc/csharp/cs_lvalue.tc 30 Oct 2007 17:35:23 -0000 1.65
+++ cscc/csharp/cs_lvalue.tc 7 Nov 2007 16:39:41 -0000 1.66
@@ -1174,77 +1174,6 @@
}
}
-/*
- * Perform semantic analysis for generic parameters.
- */
-ILNode_SemAnalysis(ILNode_GenericTypeParameter)
-{
- if(node->visited == ILVisitMode_NotVisited)
- {
- ILUInt32 first = 1;
- ILNode_ListIter iter;
- ILNode *constraint;
-
- node->visited = ILVisitMode_Processing;
- ILNode_ListIter_Init(&iter, (ILNode *)node->typeConstraints);
- while((constraint = ILNode_ListIter_Next(&iter)) != 0)
- {
- ILType *constraintType;
-
- constraintType = CSSemType(constraint, info,
&constraint);
- if(constraintType)
- {
- ILClass *constraintClass =
ILClassFromType(info->image, 0, constraintType, 0);
-
- if(first)
- {
-
if(!ILClass_IsInterface(constraintClass))
- {
- if(node->constraint &
(IL_META_GENPARAM_CLASS_CONST |
-
IL_META_GENPARAM_VALUETYPE_CONST))
- {
-
CCErrorOnLine(yygetfilename(constraint), yygetlinenum(constraint),
-
"either class or valuetype or a non interface class can be supplied");
- }
- }
- first = 0;
- }
- else
- {
-
if(!ILClass_IsInterface(constraintClass))
- {
-
CCErrorOnLine(yygetfilename(constraint), yygetlinenum(constraint),
- "only
one non interface class can be supplied");
- }
- }
-
- /* Import the constraint class into the build
image. */
- constraintClass = ILClassImport(info->image,
constraintClass);
- }
- }
- node->visited = ILVisitMode_Done;
- }
- return CSSemValueDefault;
-}
-
-ILNode_SemAnalysis(ILNode_GenericTypeParameters)
-{
- if(node->visited == ILVisitMode_NotVisited)
- {
- ILNode_ListIter iter;
- ILNode *genPar;
-
- node->visited = ILVisitMode_Processing;
- ILNode_ListIter_Init(&iter, (ILNode *)node->typeParams);
- while((genPar = ILNode_ListIter_Next(&iter)) != 0)
- {
- ILNode_SemAnalysis(genPar, info, &(genPar));
- }
- node->visited = ILVisitMode_Done;
- }
- return CSSemValueDefault;
-}
-
ILNode_SemAnalysis(ILNode_GenericConstraint)
{
/* This should never be called because they are merged into the
Index: cscc/java/java_decls.tc
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/cscc/java/java_decls.tc,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- cscc/java/java_decls.tc 20 Sep 2007 20:04:17 -0000 1.3
+++ cscc/java/java_decls.tc 7 Nov 2007 16:39:41 -0000 1.4
@@ -803,7 +803,9 @@
ILNode_Declaration_GatherStaticCtor(ILNode_Attribute),
ILNode_Declaration_GatherStaticCtor(ILNode_AttrArgs),
ILNode_Declaration_GatherStaticCtor(ILNode_NamedArg),
-ILNode_Declaration_GatherStaticCtor(ILNode_ProxyDeclaration)
+ILNode_Declaration_GatherStaticCtor(ILNode_ProxyDeclaration),
+ILNode_Declaration_GatherStaticCtor(ILNode_GenericTypeParameter),
+ILNode_Declaration_GatherStaticCtor(ILNode_GenericTypeParameters)
{
return;
}
Index: csdoc/doc_sort.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/csdoc/doc_sort.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- csdoc/doc_sort.c 23 Sep 2001 06:26:23 -0000 1.1
+++ csdoc/doc_sort.c 7 Nov 2007 16:39:41 -0000 1.2
@@ -63,6 +63,18 @@
if(type->fullName)
{
int len = strlen(type->fullName);
+
+ if(type->name && (*(type->name) != '\0'))
+ {
+ int nameLen = strlen(type->name);
+
+ if((len > nameLen) && (type->fullName[len - nameLen -
1] == '.'))
+ {
+ *namespace = type->fullName;
+ *namespaceLen = len - nameLen - 1;
+ return;
+ }
+ }
while(len > 0 && type->fullName[len - 1] != '.')
{
--len;
Index: csdoc/il2doc.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/csdoc/il2doc.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- csdoc/il2doc.c 20 Sep 2007 20:04:17 -0000 1.6
+++ csdoc/il2doc.c 7 Nov 2007 16:39:41 -0000 1.7
@@ -134,7 +134,7 @@
static void usage(const char *progname)
{
fprintf(stdout, "IL2DOC " VERSION " - IL Image To Doc Conversion\n");
- fprintf(stdout, "Copyright (c) 2003 Southern Storm Software, Pty
Ltd.\n");
+ fprintf(stdout, "Copyright (c) 2003 2007 Southern Storm Software, Pty
Ltd.\n");
fprintf(stdout, "\n");
fprintf(stdout, "Usage: %s [options] input ...\n", progname);
fprintf(stdout, "\n");
@@ -222,10 +222,282 @@
{0, 0, 0},
};
+/*
+ * Flags for PrintStringWithFlags and PrintClassName
+ */
+#define DUMP_GENERIC_PARAMS IL_DUMP_GENERIC_PARAMS
+#define DUMP_OMIT_CONSTRAINTS 64
+#define DUMP_OMIT_ARITY 128
+#define DUMP_SP 256
+#define DUMP_NAME_ONLY 512
+#define DUMP_CS_STYLE 1024
+
+#define DUMP_STYLE_ILASM (0)
+#define DUMP_STYLE_ILASM_CLASS (IL_DUMP_GENERIC_PARAMS |
DUMP_NAME_ONLY)
+#define DUMP_STYLE_CSHARP (DUMP_OMIT_ARITY |
DUMP_CS_STYLE)
+#define DUMP_STYLE_CSHARP_CLASS (IL_DUMP_GENERIC_PARAMS |
DUMP_OMIT_ARITY \
+ |
DUMP_CS_STYLE | DUMP_NAME_ONLY)
+#define DUMP_STYLE_CSHARP_METHOD (IL_DUMP_GENERIC_PARAMS |
DUMP_OMIT_ARITY \
+ |
DUMP_CS_STYLE)
+#define DUMP_STYLE_NAME (IL_DUMP_GENERIC_PARAMS
| DUMP_OMIT_ARITY \
+ |
DUMP_OMIT_CONSTRAINTS | DUMP_NAME_ONLY)
+#define DUMP_STYLE_FULLNAME (IL_DUMP_GENERIC_PARAMS |
DUMP_OMIT_ARITY \
+ |
DUMP_OMIT_CONSTRAINTS)
+#define DUMP_STYLE_FULLNAMESP (IL_DUMP_GENERIC_PARAMS |
DUMP_OMIT_ARITY \
+ |
DUMP_OMIT_CONSTRAINTS | DUMP_SP)
+
static void _ILDumpMethodType(FILE *stream, ILImage *image, ILType *type,
int flags, ILClass
*info, const char *methodName,
ILMethod *methodInfo);
+static void PrintType(ILType *type, int csForm, ILParameter *parameter,
+ ILProgramItem *scope);
+
+#if IL_VERSION_MAJOR > 1
+static void _DumpGenericConstraintHeader(FILE *stream, ILGenericPar *genPar,
+
int flags)
+{
+ if((flags & DUMP_CS_STYLE) != 0)
+ {
+ fputs(" where ", stream);
+ fputs(ILGenericParGetName(genPar), stream);
+ fputs(": ", stream);
+ }
+}
+
+static void _DumpGenericConstraint(FILE *stream, ILGenericPar *genPar,
+
ILProgramItem *scope, int flags)
+{
+ ILUInt32 constraintFlags = ILGenericParGetFlags(genPar);
+ ILGenericConstraint *constraint = 0;
+
+ if((flags & DUMP_CS_STYLE) != 0)
+ {
+ ILUInt32 hasHeader = 0;
+
+ if((constraintFlags & IL_META_GENPARAM_CLASS_CONST) != 0)
+ {
+ if(!hasHeader)
+ {
+ _DumpGenericConstraintHeader(stream, genPar,
flags);
+ hasHeader = 1;
+ }
+ else
+ {
+ fputs(", ", stream);
+ }
+ fputs("class", stream);
+ }
+ else if((constraintFlags & IL_META_GENPARAM_VALUETYPE_CONST) !=
0)
+ {
+ if(!hasHeader)
+ {
+ _DumpGenericConstraintHeader(stream, genPar,
flags);
+ hasHeader = 1;
+ }
+ else
+ {
+ fputs(", ", stream);
+ }
+ fputs("struct", stream);
+ }
+
+ flags &= ~IL_DUMP_GENERIC_PARAMS;
+ while((constraint = ILGenericParNextConstraint(genPar,
constraint)) != 0)
+ {
+ ILClass *classInfo;
+ ILTypeSpec *typeSpec;
+ ILProgramItem *item = ILConstraintGetType(constraint);
+
+ if(!hasHeader)
+ {
+ _DumpGenericConstraintHeader(stream, genPar,
flags);
+ hasHeader = 1;
+ }
+ else
+ {
+ fputs(", ", stream);
+ }
+
+ if((classInfo = ILProgramItemToClass(item)) != 0)
+ {
+ PrintType(ILClassToType(classInfo), 0, 0,
scope);
+ }
+ else if((typeSpec = ILProgramItemToTypeSpec(item)) != 0)
+ {
+ PrintType(ILTypeSpecGetType(typeSpec), 0, 0,
scope);
+ }
+ }
+
+ if((constraintFlags & IL_META_GENPARAM_CTOR_CONST) != 0)
+ {
+ if(!hasHeader)
+ {
+ _DumpGenericConstraintHeader(stream, genPar,
flags);
+ hasHeader = 1;
+ }
+ else
+ {
+ fputs(", ", stream);
+ }
+ fputs("new()", stream);
+ }
+ }
+ else
+ {
+ ILUInt32 needSP = 0;
+ ILUInt32 numConstraints = 0;
+
+ if((constraintFlags & IL_META_GENPARAM_COVARIANT) != 0)
+ {
+ putc('+', stream);
+ needSP = 1;
+ }
+ if((constraintFlags & IL_META_GENPARAM_CONTRAVARIANT) != 0)
+ {
+ putc('-', stream);
+ needSP = 1;
+ }
+ if((constraintFlags & IL_META_GENPARAM_CLASS_CONST) != 0)
+ {
+ if(needSP)
+ {
+ putc(' ', stream);
+ }
+ fputs("class", stream);
+ needSP = 1;
+ }
+ if((constraintFlags & IL_META_GENPARAM_VALUETYPE_CONST) != 0)
+ {
+ if(needSP)
+ {
+ putc(' ', stream);
+ }
+ fputs("valuetype", stream);
+ needSP = 1;
+ }
+ if((constraintFlags & IL_META_GENPARAM_CTOR_CONST) != 0)
+ {
+ if(needSP)
+ {
+ putc(' ', stream);
+ }
+ fputs(".ctor", stream);
+ needSP = 1;
+ }
+ if(needSP)
+ {
+ putc(' ', stream);
+ }
+
+ flags &= ~IL_DUMP_GENERIC_PARAMS;
+ while((constraint = ILGenericParNextConstraint(genPar,
constraint)) != 0)
+ {
+ ILClass *classInfo;
+ ILTypeSpec *typeSpec;
+ ILProgramItem *item = ILConstraintGetType(constraint);
+
+ if(numConstraints == 0)
+ {
+ putc('(', stream);
+ }
+ else
+ {
+ fputs(", ", stream);
+ }
+
+ if((classInfo = ILProgramItemToClass(item)) != 0)
+ {
+ PrintType(ILClassToType(classInfo), 0, 0,
scope);
+ }
+ else if((typeSpec = ILProgramItemToTypeSpec(item)) != 0)
+ {
+ PrintType(ILTypeSpecGetType(typeSpec), 0, 0,
scope);
+ }
+ ++numConstraints;
+ }
+ if(numConstraints > 0)
+ {
+ fputs(") ", stream);
+ }
+ }
+}
+
+static void _ILDumpGenericConstraints(FILE *stream, ILProgramItem *scope,
+
ILUInt32 from, ILUInt32 to, int flags)
+{
+ ILUInt32 current = from;
+ ILGenericPar *genPar;
+
+ while((current < to) &&
+ (genPar = ILGenericParGetFromOwner(scope, current)) != 0)
+ {
+ _DumpGenericConstraint(stream, genPar, scope, flags);
+ ++current;
+ }
+}
+
+static void _ILDumpGenericClassConstraints(FILE *stream, ILClass *classInfo,
+
int flags)
+{
+ ILUInt32 numGenericPars = ILClassGetNumGenericPars(classInfo);
+
+ flags &= ~DUMP_GENERIC_PARAMS;
+ if(numGenericPars > 0)
+ {
+ if((flags & DUMP_CS_STYLE) != 0)
+ {
+ ILClass *nestedParent;
+ ILUInt32 numParentGenericPars = 0;
+
+ nestedParent = ILClass_NestedParent(classInfo);
+ if(nestedParent)
+ {
+ numParentGenericPars =
ILClassGetNumGenericPars(nestedParent);
+ }
+ _ILDumpGenericConstraints(stdout,
ILToProgramItem(classInfo),
+
numParentGenericPars, numGenericPars,
+
flags);
+ }
+ else
+ {
+ _ILDumpGenericConstraints(stdout,
ILToProgramItem(classInfo),
+ 0,
numGenericPars, flags);
+ }
+ }
+}
+
+static void _ILDumpGenericParms(FILE *stream, ILProgramItem *scope,
+ ILUInt32 from,
ILUInt32 to, int flags)
+{
+ ILUInt32 current = from;
+ ILGenericPar *genPar;
+
+ while((current < to) &&
+ (genPar = ILGenericParGetFromOwner(scope, current)) != 0)
+ {
+ if(current == from)
+ {
+ fputs("<", stream);
+ }
+ else
+ {
+ fputs(", ", stream);
+ }
+ if((flags & (DUMP_OMIT_CONSTRAINTS | DUMP_CS_STYLE)) == 0)
+ {
+ _DumpGenericConstraint(stream, genPar, scope, flags);
+ }
+ fputs(ILGenericParGetName(genPar), stream);
+ current++;
+ }
+ if(current > from)
+ {
+ fputs(">", stream);
+ }
+}
+#endif /* IL_VERSION_MAJOR > 1 */
+
static void _ILDumpType(FILE *stream, ILImage *image, ILType *type, int flags)
{
ILType *elem;
@@ -478,13 +750,14 @@
}
break;
+ #if IL_VERSION_MAJOR > 1
case IL_TYPE_COMPLEX_WITH:
{
unsigned long numParams;
unsigned long param;
_ILDumpType(stream, image,
ILTypeGetWithMainWithPrefixes(type), flags);
- putc('<', stream);
+ fputs("<", stream);
numParams = ILTypeNumWithParams(type);
for(param = 1; param <= numParams; ++param)
{
@@ -496,7 +769,7 @@
ILTypeGetWithParamWithPrefixes(type, param),
flags);
}
- putc('>', stream);
+ fputs(">", stream);
}
break;
@@ -511,6 +784,7 @@
fprintf(stream, "!%d", ILType_VarNum(type));
}
break;
+ #endif /* IL_VERSION_MAJOR > 1 */
default:
{
@@ -695,6 +969,7 @@
{
ILUInt32 callingConventions;
ILType *synType;
+#if IL_VERSION_MAJOR > 1
int dumpGenerics;
unsigned long numWithParams;
unsigned long withParam;
@@ -705,6 +980,7 @@
/* Strip off the "generic parameters" flag so that we don't
end up passing it down to the parameter types */
flags &= ~IL_DUMP_GENERIC_PARAMS;
+#endif /* IL_VERSION_MAJOR > 1 */
/* Dump the calling conventions for the method */
callingConventions = ILType_CallConv(type);
@@ -740,16 +1016,18 @@
putc('*', stream);
}
+#if IL_VERSION_MAJOR > 1
/* Dump the generic method parameters if necessary */
if(dumpGenerics && methodInfo)
{
- ILDAsmDumpGenericParams(image, stream,
-
ILToProgramItem(methodInfo), flags);
+ _ILDumpGenericParms(stream, ILToProgramItem(methodInfo),
+ 0,
ILType_NumGen(ILMethod_Signature(methodInfo)),
+ flags);
}
else if(withTypes)
{
/* Dump the instantiation types from a method specification */
- putc('<', stream);
+ fputs("<", stream);
numWithParams = ILTypeNumParams(withTypes);
for(withParam = 1; withParam <= numWithParams; ++withParam)
{
@@ -760,8 +1038,9 @@
_ILDumpType(stream, image,
ILTypeGetParam(withTypes,
withParam), flags);
}
- putc('>', stream);
+ fputs(">", stream);
}
+#endif /* IL_VERSION_MAJOR > 1 */
/* Dump the parameters */
putc('(', stream);
@@ -1198,9 +1477,9 @@
}
/*
- * Print a string with XML quoting and an optional SP flag.
+ * Print a string with XML quoting and an optional SP / omit arity flag.
*/
-static void PrintStringWithSP(const char *str, int sp)
+static void PrintStringWithFlags(const char *str, int flags)
{
int ch;
if(!str)
@@ -1209,7 +1488,7 @@
}
while((ch = *str) != '\0')
{
- if(ch == '.' && sp)
+ if(ch == '.' && ((flags & DUMP_SP) != 0))
{
putc('_', stdout);
}
@@ -1233,6 +1512,25 @@
{
fputs("'", stdout);
}
+ else if(ch == '`' && ((flags & DUMP_OMIT_ARITY) != 0))
+ {
+ /* Skip until the end of the string or a period is
encountered. */
+ ++str;
+ while((ch = *str) != '\0')
+ {
+ if(ch == '.')
+ {
+ --str;
+ break;
+ }
+ ++str;
+ }
+ if(ch == '\0')
+ {
+ /* We reached the end of the string */
+ break;
+ }
+ }
else
{
putc(ch, stdout);
@@ -1240,34 +1538,154 @@
++str;
}
}
-#define PrintString(str) PrintStringWithSP((str), 0)
+#define PrintString(str) PrintStringWithFlags((str), 0)
+
+#if IL_VERSION_MAJOR > 1
+static void PrintWithParams(ILType *withType, ILUInt32 from, ILUInt32 to,
+ ILProgramItem *scope,
int flags)
+{
+ ILUInt32 current = from;
+
+ while(current < to)
+ {
+ if(current == from)
+ {
+ fputs("<", stdout);
+ }
+ else
+ {
+ fputs(", ", stdout);
+ }
+ PrintType(ILTypeGetWithParamWithPrefixes(withType, current + 1),
+ (flags & DUMP_CS_STYLE), 0, scope);
+ current++;
+ }
+ if(current > from)
+ {
+ fputs(">", stdout);
+ }
+}
+#endif /* IL_VERSION_MAJOR > 1 */
/*
- * Print a full class name with an optional SP flag.
+ * Inner function for printing a class name
*/
-static void PrintClassNameWithSP(ILClass *classInfo, int sp)
+static void PrintClassNameInner(ILClass *classInfo, ILProgramItem *scope,
+ int flags,
ILType *withType)
{
+ if((flags & DUMP_NAME_ONLY) != 0)
+ {
+ PrintStringWithFlags(ILClass_Name(classInfo), flags);
+ }
+ else
+ {
ILClass *nestedParent;
- const char *nspace;
+
nestedParent = ILClass_NestedParent(classInfo);
if(nestedParent)
{
- PrintClassNameWithSP(nestedParent, sp);
- putc((sp ? '_' : '.'), stdout);
- PrintStringWithSP(ILClass_Name(classInfo), sp);
+ if((flags & DUMP_CS_STYLE) != 0)
+ {
+ PrintClassNameInner(nestedParent, scope, flags,
withType);
}
else
{
+ PrintClassNameInner(nestedParent, scope,
+ (flags
& ~DUMP_GENERIC_PARAMS), 0);
+ }
+ putc((((flags & DUMP_SP) != 0) ? '_' : '.'), stdout);
+ PrintStringWithFlags(ILClass_Name(classInfo), flags);
+ }
+ else
+ {
+ const char *nspace;
+
nspace = ILClass_Namespace(classInfo);
if(nspace)
{
- PrintStringWithSP(nspace, sp);
- putc((sp ? '_' : '.'), stdout);
+ PrintStringWithFlags(nspace, flags);
+ putc((((flags & DUMP_SP) != 0) ? '_' : '.'),
stdout);
+ }
+ PrintStringWithFlags(ILClass_Name(classInfo), flags);
+ }
+ }
+#if IL_VERSION_MAJOR > 1
+ if(withType)
+ {
+ ILUInt32 numGenericPars = ILClassGetNumGenericPars(classInfo);
+
+ flags &= ~DUMP_GENERIC_PARAMS;
+ if((flags & DUMP_CS_STYLE) != 0)
+ {
+ ILClass *nestedParent;
+ ILUInt32 numParentGenericPars = 0;
+
+ nestedParent = ILClass_NestedParent(classInfo);
+ if(nestedParent)
+ {
+ numParentGenericPars =
ILClassGetNumGenericPars(nestedParent);
+ }
+ PrintWithParams(withType, numParentGenericPars,
numGenericPars, scope, flags);
+ }
+ else
+ {
+ PrintWithParams(withType, 0, numGenericPars, scope,
flags);
+ }
+ }
+ else if((flags & DUMP_GENERIC_PARAMS) != 0)
+ {
+ ILUInt32 numGenericPars = ILClassGetNumGenericPars(classInfo);
+
+ flags &= ~DUMP_GENERIC_PARAMS;
+ if(numGenericPars > 0)
+ {
+ if((flags & DUMP_CS_STYLE) != 0)
+ {
+ ILClass *nestedParent;
+ ILUInt32 numParentGenericPars = 0;
+
+ nestedParent = ILClass_NestedParent(classInfo);
+ if(nestedParent)
+ {
+ numParentGenericPars =
ILClassGetNumGenericPars(nestedParent);
+ }
+ _ILDumpGenericParms(stdout, scope,
numParentGenericPars, numGenericPars, flags);
+ }
+ else
+ {
+ _ILDumpGenericParms(stdout, scope, 0,
numGenericPars, flags);
+ }
+ }
+ }
+#endif /* IL_VERSION_MAJOR > 1 */
+}
+
+#if IL_VERSION_MAJOR > 1
+static void PrintWithType(ILType *withType, ILProgramItem *scope, int flags)
+{
+ ILType *mainType = ILTypeGetWithMain(withType);
+
+ PrintClassNameInner(ILType_ToClass(mainType), scope, flags, withType);
+}
+#endif /* IL_VERSION_MAJOR > 1 */
+
+/*
+ * Print a full class name with an optional SP flag.
+ */
+static void PrintClassNameWithFlags(ILClass *classInfo, ILProgramItem *scope,
int flags)
+{
+ ILType *synType = ILClass_SynType(classInfo);
+
+ if(synType && ILType_IsWith(synType))
+ {
+ PrintClassNameInner(ILType_ToClass(ILTypeGetWithMain(synType)),
scope, flags, synType);
}
- PrintStringWithSP(ILClass_Name(classInfo), sp);
+ else
+ {
+ PrintClassNameInner(classInfo, scope, flags, 0);
}
}
-#define PrintClassName(classInfo)
PrintClassNameWithSP((classInfo), 0)
+#define PrintClassName(classInfo, scope)
PrintClassNameWithFlags((classInfo), (scope), 0)
/*
* Dump attribute information for a program item.
@@ -1288,7 +1706,8 @@
if(!name)
continue;
fputs("<Attribute><AttributeName>", stdout);
- fputs(name, stdout);
+ /* fputs(name, stdout); */
+ PrintString(name);
fputs("</AttributeName></Attribute>", stdout);
ILFree(name);
}
@@ -1304,19 +1723,12 @@
const char *extendsNoBase,
const char *implements,
const char *implementsSeparator,
- int nameOnly)
+ int flags)
{
if(baseClass)
{
fputs(extends, stdout);
- if(nameOnly)
- {
- PrintString(ILClass_Name(baseClass));
- }
- else
- {
- PrintClassName(baseClass);
- }
+ PrintClassNameWithFlags(baseClass, ILToProgramItem(classInfo),
flags);
if(!impl)
{
return;
@@ -1335,14 +1747,8 @@
{
return;
}
- if(nameOnly)
- {
- PrintString(ILClass_Name(ILImplementsGetInterface(impl)));
- }
- else
- {
- PrintClassName(ILImplementsGetInterface(impl));
- }
+ PrintClassNameWithFlags(ILImplementsGetInterface(impl),
+
ILToProgramItem(classInfo), flags);
while((impl = ILClassNextImplements(classInfo, impl)) != 0)
{
if(!ILClass_IsPublic(ILImplementsGetInterface(impl)))
@@ -1350,14 +1756,8 @@
continue;
}
fputs(implementsSeparator, stdout);
- if(nameOnly)
- {
-
PrintString(ILClass_Name(ILImplementsGetInterface(impl)));
- }
- else
- {
- PrintClassName(ILImplementsGetInterface(impl));
- }
+ PrintClassNameWithFlags(ILImplementsGetInterface(impl),
+
ILToProgramItem(classInfo), flags);
}
}
@@ -1415,7 +1815,8 @@
/*
* Print a type.
*/
-static void PrintType(ILType *type, int csForm, ILParameter *parameter)
+static void PrintType(ILType *type, int csForm, ILParameter *parameter,
+ ILProgramItem *scope)
{
type = ILTypeStripPrefixes(type);
if(ILType_IsPrimitive(type))
@@ -1570,7 +1971,8 @@
}
else if(ILType_IsClass(type) || ILType_IsValueType(type))
{
- PrintClassName(ILType_ToClass(type));
+ PrintClassNameWithFlags(ILType_ToClass(type), scope,
+ csForm ?
DUMP_STYLE_CSHARP : 0);
}
else if(type != 0 && ILType_IsComplex(type))
{
@@ -1588,11 +1990,11 @@
{
fputs("ref ", stdout);
}
- PrintType(ILType_Ref(type), csForm, 0);
+ PrintType(ILType_Ref(type), csForm, 0,
scope);
}
else
{
- PrintType(ILType_Ref(type), csForm, 0);
+ PrintType(ILType_Ref(type), csForm, 0,
scope);
fputs("&", stdout);
}
}
@@ -1600,7 +2002,7 @@
case IL_TYPE_COMPLEX_PTR:
{
- PrintType(ILType_Ref(type), csForm, 0);
+ PrintType(ILType_Ref(type), csForm, 0, scope);
if(csForm)
{
putc(' ', stdout);
@@ -1630,7 +2032,7 @@
}
}
}
- PrintType(ILTypeGetElemType(type), csForm, 0);
+ PrintType(ILTypeGetElemType(type), csForm, 0,
scope);
putc('[', stdout);
while(rank > 1)
{
@@ -1640,6 +2042,86 @@
putc(']', stdout);
}
break;
+
+ #if IL_VERSION_MAJOR > 1
+ case IL_TYPE_COMPLEX_WITH:
+ {
+ PrintWithType(type, scope, csForm ?
DUMP_STYLE_CSHARP : DUMP_STYLE_ILASM);
+ }
+ break;
+
+ case IL_TYPE_COMPLEX_MVAR:
+ {
+ if(!csForm)
+ {
+ ILUInt32 paramNum = ILType_VarNum(type);
+
+ fprintf(stdout, "!!%i", paramNum);
+ }
+ else
+ {
+ ILMethod *method =
ILProgramItemToMethod(scope);
+
+ if(method)
+ {
+ ILUInt32 paramNum =
ILType_VarNum(type);
+ ILGenericPar *genPar;
+
+ genPar =
ILGenericParGetFromOwner(scope, paramNum);
+ if(genPar)
+ {
+
fputs(ILGenericParGetName(genPar), stdout);
+ }
+ }
+ }
+ }
+ break;
+
+ case IL_TYPE_COMPLEX_VAR:
+ {
+ if(!csForm)
+ {
+ ILUInt32 paramNum = ILType_VarNum(type);
+
+ fprintf(stdout, "!%i", paramNum);
+ }
+ else
+ {
+ ILMethod *method =
ILProgramItemToMethod(scope);
+
+ if(method)
+ {
+ ILUInt32 paramNum =
ILType_VarNum(type);
+ ILGenericPar *genPar;
+
+ genPar =
ILGenericParGetFromOwner
+
(ILToProgramItem(ILMethod_Owner(method)),
+
paramNum);
+ if(genPar)
+ {
+
fputs(ILGenericParGetName(genPar), stdout);
+ }
+ }
+ else
+ {
+ ILClass *classInfo =
ILProgramItemToClass(scope);
+
+ if(classInfo)
+ {
+ ILUInt32 paramNum =
ILType_VarNum(type);
+ ILGenericPar *genPar;
+
+ genPar =
ILGenericParGetFromOwner(scope, paramNum);
+ if(genPar)
+ {
+
fputs(ILGenericParGetName(genPar), stdout);
+ }
+ }
+ }
+ }
+ }
+ break;
+ #endif /* IL_VERSION_MAJOR > 1 */
}
}
}
@@ -1674,7 +2156,8 @@
}
if(csForm)
{
- PrintType(ILTypeGetParam(signature, param), csForm,
parameter);
+ PrintType(ILTypeGetParam(signature, param), 1,
parameter,
+ ILToProgramItem(method));
putc(' ', stdout);
if(parameter && ILParameter_Name(parameter))
{
@@ -1697,7 +2180,8 @@
printf("_p%ld", param);
}
fputs("\" Type=\"", stdout);
- PrintType(ILTypeGetParam(signature, param), csForm,
parameter);
+ PrintType(ILTypeGetParam(signature, param), 1,
parameter,
+ ILToProgramItem(method));
fputs("\"/>\n", stdout);
}
}
@@ -1746,7 +2230,8 @@
}
if(csForm)
{
- PrintType(ILTypeGetParam(signature, param), csForm,
parameter);
+ PrintType(ILTypeGetParam(signature, param), csForm,
parameter,
+ ILToProgramItem(method));
putc(' ', stdout);
if(parameter && ILParameter_Name(parameter))
{
@@ -1769,7 +2254,8 @@
printf("_p%ld", param);
}
fputs("\" Type=\"", stdout);
- PrintType(ILTypeGetParam(signature, param), csForm,
parameter);
+ PrintType(ILTypeGetParam(signature, param), csForm,
parameter,
+ ILToProgramItem(method));
fputs("\"/>\n", stdout);
}
}
@@ -1796,13 +2282,19 @@
/* Dump the signature information */
fputs("<MemberSignature Language=\"ILASM\" Value=\"", stdout);
ILDumpFlags(stdout, ILMethod_Attrs(method), ILMethodDefinitionFlags, 0);
+#if IL_VERSION_MAJOR > 1
+ _ILDumpMethodType(stdout, ILProgramItem_Image(method),
+ ILMethod_Signature(method),
IL_DUMP_GENERIC_PARAMS, 0,
+ ILMethod_Name(method), method);
+#else /* IL_VERSION_MAJOR == 1 */
_ILDumpMethodType(stdout, ILProgramItem_Image(method),
ILMethod_Signature(method), 0, 0,
ILMethod_Name(method), method);
+#endif /* IL_VERSION_MAJOR == 1 */
fputs("\"/>\n", stdout);
fputs("<MemberSignature Language=\"C#\" Value=\"", stdout);
ILDumpFlags(stdout, ILMethod_Attrs(method), CSharpMethodFlags, 0);
- PrintString(ILClass_Name(classInfo));
+ PrintStringWithFlags(ILClass_Name(classInfo), DUMP_OMIT_ARITY);
PrintParams(method, ILMethod_Signature(method), 1);
fputs(";\"/>\n", stdout);
@@ -1859,14 +2351,20 @@
/* Dump the signature information */
fputs("<MemberSignature Language=\"ILASM\" Value=\".method ", stdout);
ILDumpFlags(stdout, ILMethod_Attrs(method), ILMethodDefinitionFlags, 0);
+#if IL_VERSION_MAJOR > 1
+ _ILDumpMethodType(stdout, ILProgramItem_Image(method),
+ ILMethod_Signature(method),
IL_DUMP_GENERIC_PARAMS, 0,
+ ILMethod_Name(method), method);
+#else /* IL_VERSION_MAJOR == 1 */
_ILDumpMethodType(stdout, ILProgramItem_Image(method),
ILMethod_Signature(method), 0, 0,
ILMethod_Name(method), method);
+#endif /* IL_VERSION_MAJOR == 1 */
fputs("\"/>\n", stdout);
if(IsFinalizer(method))
{
fputs("<MemberSignature Language=\"C#\" Value=\"~", stdout);
- PrintString(ILClass_Name(ILMethod_Owner(method)));
+ PrintStringWithFlags(ILClass_Name(ILMethod_Owner(method)),
DUMP_OMIT_ARITY);
fputs("()", stdout);
}
else
@@ -1876,10 +2374,21 @@
{
ILDumpFlags(stdout, ILMethod_Attrs(method),
CSharpMethodFlags, 0);
}
- PrintType(ILTypeGetReturn(ILMethod_Signature(method)), 1, 0);
+ PrintType(ILTypeGetReturn(ILMethod_Signature(method)), 1, 0,
+ ILToProgramItem(method));
putc(' ', stdout);
PrintString(ILMethod_Name(method));
+ #if IL_VERSION_MAJOR > 1
+ _ILDumpGenericParms(stdout, ILToProgramItem(method),
+ 0,
ILType_NumGen(ILMethod_Signature(method)),
+
DUMP_STYLE_CSHARP_METHOD);
+ #endif /* IL_VERSION_MAJOR > 1 */
PrintParams(method, ILMethod_Signature(method), 1);
+ #if IL_VERSION_MAJOR > 1
+ _ILDumpGenericConstraints(stdout, ILToProgramItem(method),
+ 0,
ILType_NumGen(ILMethod_Signature(method)),
+
DUMP_STYLE_CSHARP);
+ #endif /* IL_VERSION_MAJOR > 1 */
}
fputs(";\"/>\n", stdout);
@@ -1888,7 +2397,8 @@
/* Dump the return type and parameters in XML */
fputs("<ReturnValue><ReturnType>", stdout);
- PrintType(ILTypeGetReturn(ILMethod_Signature(method)), 0, 0);
+ PrintType(ILTypeGetReturn(ILMethod_Signature(method)), 1, 0,
+ ILToProgramItem(method));
fputs("</ReturnType></ReturnValue>\n", stdout);
PrintParams(method, ILMethod_Signature(method), 0);
@@ -1929,7 +2439,8 @@
{
ILDumpFlags(stdout, ILField_Attrs(field), CSharpFieldFlags, 0);
}
- PrintType(ILField_Type(field), 1, 0);
+ PrintType(ILField_Type(field), 1, 0,
+ ILToProgramItem(ILField_Owner(field)));
putc(' ', stdout);
PrintString(ILField_Name(field));
/* TODO: constant value */
@@ -1937,7 +2448,8 @@
/* Dump the field type */
fputs("<ReturnValue><ReturnType>", stdout);
- PrintType(ILField_Type(field), 0, 0);
+ PrintType(ILField_Type(field), 1, 0,
+ ILToProgramItem(ILField_Owner(field)));
fputs("</ReturnType></ReturnValue>\n", stdout);
/* Dump the member type */
@@ -1998,18 +2510,30 @@
putc(' ', stdout);
ILDumpFlags(stdout, ILMethod_Attrs(getter),
ILMethodDefinitionFlags, 0);
+ #if IL_VERSION_MAJOR > 1
+ _ILDumpMethodType(stdout, ILProgramItem_Image(getter),
+ ILMethod_Signature(getter),
IL_DUMP_GENERIC_PARAMS, 0,
+ ILMethod_Name(getter), getter);
+ #else /* IL_VERSION_MAJOR == 1 */
_ILDumpMethodType(stdout, ILProgramItem_Image(getter),
ILMethod_Signature(getter), 0, 0,
ILMethod_Name(getter), getter);
+ #endif /* IL_VERSION_MAJOR == 1 */
}
if(setter)
{
putc(' ', stdout);
ILDumpFlags(stdout, ILMethod_Attrs(setter),
ILMethodDefinitionFlags, 0);
+ #if IL_VERSION_MAJOR > 1
+ _ILDumpMethodType(stdout, ILProgramItem_Image(setter),
+ ILMethod_Signature(setter),
IL_DUMP_GENERIC_PARAMS, 0,
+ ILMethod_Name(setter), setter);
+ #else /* IL_VERSION_MAJOR == 1 */
_ILDumpMethodType(stdout, ILProgramItem_Image(setter),
ILMethod_Signature(setter), 0, 0,
ILMethod_Name(setter), setter);
+ #endif /* IL_VERSION_MAJOR == 1 */
}
fputs(" }\"/>\n", stdout);
fputs("<MemberSignature Language=\"C#\" Value=\"", stdout);
@@ -2017,7 +2541,7 @@
{
ILDumpFlags(stdout, ILMethod_Attrs(either), CSharpMethodFlags,
0);
}
- PrintType(type, 1, 0);
+ PrintType(type, 1, 0, ILToProgramItem(ILProperty_Owner(property)));
putc(' ', stdout);
if(isIndexer)
{
@@ -2045,7 +2569,7 @@
/* Dump the property type and indexer parameters */
fputs("<ReturnValue><ReturnType>", stdout);
- PrintType(type, 0, 0);
+ PrintType(type, 1, 0, ILToProgramItem(ILProperty_Owner(property)));
fputs("</ReturnType></ReturnValue>\n", stdout);
if(isIndexer)
{
@@ -2094,7 +2618,7 @@
{
ILDumpFlags(stdout, ILMethod_Attrs(method), CSharpMethodFlags,
0);
}
- PrintType(ILEvent_Type(event), 1, 0);
+ PrintType(ILEvent_Type(event), 1, 0,
ILToProgramItem(ILEvent_Owner(event)));
putc(' ', stdout);
PrintString(ILEvent_Name(event));
fputs("\"/>\n", stdout);
@@ -2154,11 +2678,11 @@
/* Print the header information */
fputs("<Type Name=\"", stdout);
- PrintString(ILClass_Name(classInfo));
+ PrintClassNameWithFlags(classInfo, ILToProgramItem(classInfo),
DUMP_STYLE_NAME);
fputs("\" FullName=\"", stdout);
- PrintClassName(classInfo);
+ PrintClassNameWithFlags(classInfo, ILToProgramItem(classInfo),
DUMP_STYLE_FULLNAME);
fputs("\" FullNameSP=\"", stdout);
- PrintClassNameWithSP(classInfo, 1);
+ PrintClassNameWithFlags(classInfo, ILToProgramItem(classInfo),
DUMP_STYLE_FULLNAMESP);
fputs("\">\n", stdout);
/* Need to do something different if this is a delegate */
@@ -2169,11 +2693,11 @@
ILDumpFlags(stdout, ILClass_Attrs(classInfo), ILTypeDefinitionFlags, 0);
baseClass = ILClass_Parent(classInfo);
impl = ILClassNextImplements(classInfo, 0);
- PrintString(ILClass_Name(classInfo));
+ PrintClassNameWithFlags(classInfo, ILToProgramItem(classInfo),
DUMP_STYLE_ILASM_CLASS);
if(baseClass || impl)
{
DumpBases(classInfo, baseClass, impl, " extends ", " implements
",
- " implements ", ", ", 0);
+ " implements ", ", ", DUMP_STYLE_ILASM);
}
fputs("\"/>\n", stdout);
fputs("<TypeSignature Language=\"C#\" Value=\"", stdout);
@@ -2184,10 +2708,13 @@
fputs("delegate ", stdout);
delegateMethod =
ILTypeGetDelegateMethod(ILClassToType(classInfo));
delegateSignature = ILMethod_Signature(delegateMethod);
- PrintType(ILTypeGetReturn(delegateSignature), 1, 0);
+ PrintType(ILTypeGetReturn(delegateSignature), 1, 0,
ILToProgramItem(classInfo));
putc(' ', stdout);
- PrintString(ILClass_Name(classInfo));
+ PrintClassNameWithFlags(classInfo, ILToProgramItem(classInfo),
DUMP_STYLE_CSHARP_CLASS);
PrintParams(delegateMethod, delegateSignature, 1);
+ #if IL_VERSION_MAJOR > 1
+ _ILDumpGenericClassConstraints(stdout, classInfo,
DUMP_STYLE_CSHARP);
+ #endif /* IL_VERSION_MAJOR > 1 */
putc(';', stdout);
}
else
@@ -2218,11 +2745,14 @@
ILDumpFlags(stdout, ILClass_Attrs(classInfo),
CSharpTypeFlags, 0);
fputs("class ", stdout);
}
- PrintString(ILClass_Name(classInfo));
+ PrintClassNameWithFlags(classInfo, ILToProgramItem(classInfo),
DUMP_STYLE_CSHARP_CLASS);
if(baseClass || impl)
{
- DumpBases(classInfo, baseClass, impl, " : ", " : ", ",
", ", ", 1);
+ DumpBases(classInfo, baseClass, impl, " : ", " : ", ",
", ", ", DUMP_STYLE_CSHARP);
}
+ #if IL_VERSION_MAJOR > 1
+ _ILDumpGenericClassConstraints(stdout, classInfo,
DUMP_STYLE_CSHARP);
+ #endif /* IL_VERSION_MAJOR > 1 */
}
fputs("\"/>\n", stdout);
@@ -2241,7 +2771,7 @@
if(baseClass)
{
fputs("<Base><BaseTypeName>", stdout);
- PrintClassName(baseClass);
+ PrintClassNameWithFlags(baseClass, ILToProgramItem(classInfo),
DUMP_STYLE_CSHARP);
fputs("</BaseTypeName></Base>\n", stdout);
}
else
@@ -2259,7 +2789,9 @@
continue;
}
fputs("<Interface><InterfaceName>", stdout);
- PrintClassName(ILImplementsGetInterface(impl));
+ PrintClassNameWithFlags(ILImplementsGetInterface(impl),
+
ILToProgramItem(classInfo),
+
DUMP_STYLE_CSHARP);
fputs("</InterfaceName></Interface>\n", stdout);
}
while((impl = ILClassNextImplements(classInfo, impl)) != 0);
Index: image/class.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/image/class.c,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -b -r1.41 -r1.42
--- image/class.c 30 Oct 2007 17:35:23 -0000 1.41
+++ image/class.c 7 Nov 2007 16:39:41 -0000 1.42
@@ -1384,8 +1384,8 @@
}
if(info == scope)
{
- /* A class is always accessible to itself */
- return 1;
+ /* A class can never inherit itself */
+ return 0;
}
switch(info->attributes & IL_META_TYPEDEF_VISIBILITY_MASK)
{
Index: image/meta_build.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/image/meta_build.c,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -b -r1.49 -r1.50
--- image/meta_build.c 19 Aug 2007 00:41:14 -0000 1.49
+++ image/meta_build.c 7 Nov 2007 16:39:42 -0000 1.50
@@ -2685,7 +2685,7 @@
if(!member)
{
#if IL_DEBUG_META
- if(classInfo)
+ if(classInfo && classInfo->className)
{
if(classInfo->className->namespace &&
!strcmp(classInfo->className->namespace,
"$Synthetic"))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [dotgnu-pnet-commits] pnet ChangeLog codegen/cg_decls.tc codegen/cg_n...,
Klaus Treichel <=