[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[dotgnu-pnet-commits] pnet ChangeLog codegen/cg_genattr.c
From: |
Klaus Treichel |
Subject: |
[dotgnu-pnet-commits] pnet ChangeLog codegen/cg_genattr.c |
Date: |
Sun, 19 Apr 2009 16:12:53 +0000 |
CVSROOT: /cvsroot/dotgnu-pnet
Module name: pnet
Changes by: Klaus Treichel <ktreichel> 09/04/19 16:12:53
Modified files:
. : ChangeLog
codegen : cg_genattr.c
Log message:
Add check for AllowMultiple == 0 and handling of the
IndexerNameAttribute.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/pnet/ChangeLog?cvsroot=dotgnu-pnet&r1=1.3618&r2=1.3619
http://cvs.savannah.gnu.org/viewcvs/pnet/codegen/cg_genattr.c?cvsroot=dotgnu-pnet&r1=1.1&r2=1.2
Patches:
Index: ChangeLog
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/ChangeLog,v
retrieving revision 1.3618
retrieving revision 1.3619
diff -u -b -r1.3618 -r1.3619
--- ChangeLog 19 Apr 2009 11:43:43 -0000 1.3618
+++ ChangeLog 19 Apr 2009 16:12:52 -0000 1.3619
@@ -10,7 +10,7 @@
ILGenInfo structure.
* codegen/cg_genattr.c, codegen/cg_genattr.h: Add handling of custom
- attributes.
+ attributes. Add check for AllowMultiple and the IndexerNameAttribute.
* codegen/cg_intl.h: Add include for internationalization.
Index: codegen/cg_genattr.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/codegen/cg_genattr.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- codegen/cg_genattr.c 19 Apr 2009 11:43:43 -0000 1.1
+++ codegen/cg_genattr.c 19 Apr 2009 16:12:53 -0000 1.2
@@ -1812,6 +1812,20 @@
}
/*
+ * Process an "IndexerName" attribute on a property (or better indexer).
+ */
+static int IndexerNameAttribute(ILGenInfo *info,
+ CGAttributeInfo
*attributeInfo)
+{
+ /*
+ * We do nothing here.
+ * The reason for this function is that no custom attribute has to be
+ * created because this attribute should have been processed before.
+ */
+ return 1;
+}
+
+/*
* Process a "MethodImpl" attribute on a method.
*/
static int MethodImplAttribute(ILGenInfo *info,
@@ -2069,6 +2083,7 @@
{0, 0}
};
static CGAttrConvertInfo const compilerAttrs[] = {
+ {"IndexerNameAttribute", IndexerNameAttribute},
{"MethodImplAttribute", MethodImplAttribute},
{0, 0}
};
@@ -2265,6 +2280,30 @@
}
/*
+ * Check if there is allready an instance of the given attribute class
+ * collected for the owner. (Check for AllowMultiple).
+ * Returns the attributeInfo of the instance found or 0 if none was found.
+ */
+CGAttributeInfo *AttributeExistsForOwner(CGAttributeInfos *attributeInfos,
+
ILProgramItem *owner,
+
ILClass *attribute)
+{
+ CGAttributeInfo *attributeInfo;
+
+ attributeInfo = attributeInfos->attributes;
+ while(attributeInfo)
+ {
+ if(attributeInfo->owner == owner &&
+ ILMethod_Owner(attributeInfo->ctor) == attribute)
+ {
+ return attributeInfo;
+ }
+ attributeInfo = attributeInfo->next;
+ }
+ return 0;
+}
+
+/*
* Add an attribute to the attribute infos.
*/
int CGAttributeInfosAddAttribute(CGAttributeInfos *attributeInfos,
@@ -2306,6 +2345,22 @@
return 1;
}
allowMultiple =
ILAttributeUsageAttributeGetAllowMultiple(attributeUsage);
+ if(allowMultiple == 0)
+ {
+ CGAttributeInfo *checkInfo;
+
+ checkInfo = AttributeExistsForOwner(attributeInfos, owner,
+
ILMethod_Owner(ctor));
+ if(checkInfo)
+ {
+ CGErrorForNode(attributeInfos->info, node,
+ _("The `%s' must not be applied multiple times
to an owner."
+ " The previous application was in line %lu"),
+ CGClassToName(attribute),
+ yygetlinenum(checkInfo->node));
+ return 1;
+ }
+ }
attributeInfo = ILMemStackAlloc(&(attributeInfos->memstack),
CGAttributeInfo);
- [dotgnu-pnet-commits] pnet ChangeLog codegen/cg_genattr.c,
Klaus Treichel <=