[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Dotgnu-pnet-commits] CVS: pnet/cscc/csharp cs_semantics.tc,1.10,1.11 c
From: |
Gopal.V <address@hidden> |
Subject: |
[Dotgnu-pnet-commits] CVS: pnet/cscc/csharp cs_semantics.tc,1.10,1.11 cs_attrs.c,1.12,1.13 |
Date: |
Tue, 17 Dec 2002 12:31:30 -0500 |
Update of /cvsroot/dotgnu-pnet/pnet/cscc/csharp
In directory subversions:/tmp/cvs-serv4235/cscc/csharp
Modified Files:
cs_semantics.tc cs_attrs.c
Log Message:
double lookups for attribute names to ensure correct resolution between
XmlAttribute and XmlAttributeAttribute
Index: cs_semantics.tc
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/cscc/csharp/cs_semantics.tc,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -r1.10 -r1.11
*** cs_semantics.tc 18 Nov 2002 22:12:31 -0000 1.10
--- cs_semantics.tc 17 Dec 2002 17:31:28 -0000 1.11
***************
*** 100,103 ****
--- 100,109 ----
/*
+ * Perform semantic analysis on a node and expect a type.
+ * Returns non-zero if a value, or zero on error.
+ */
+ int CSSemExpectType (ILNode *type, ILGenInfo *info, ILNode **parent);
+
+ /*
* Perform semantic analysis on the node corresponding to a
* program item. This is used to finialize semantic analysis
***************
*** 178,181 ****
--- 184,194 ----
return CSSemValidate(type, value);
+ }
+
+ int CSSemExpectType (ILNode *type, ILGenInfo *info, ILNode **parent)
+ {
+ CSSemValue value;
+ value = ILNode_SemAnalysisType(type, info, parent);
+ return CSSemIsType(value);
}
Index: cs_attrs.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/cscc/csharp/cs_attrs.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -r1.12 -r1.13
*** cs_attrs.c 21 Nov 2002 05:25:38 -0000 1.12
--- cs_attrs.c 17 Dec 2002 17:31:28 -0000 1.13
***************
*** 117,125 ****
* Modify an attribute name so that it ends in "Attribute".
*/
! static void ModifyAttrName(ILNode_Identifier *ident)
{
char *name = ident->name;
int namelen = strlen(name);
! if(namelen < 9 || strcmp(name + namelen - 9, "Attribute") != 0)
{
ident->name = ILInternAppendedString
--- 117,125 ----
* Modify an attribute name so that it ends in "Attribute".
*/
! static void ModifyAttrName(ILNode_Identifier *ident,int force)
{
char *name = ident->name;
int namelen = strlen(name);
! if(force || (namelen < 9 || strcmp(name + namelen - 9, "Attribute") !=
0))
{
ident->name = ILInternAppendedString
***************
*** 245,262 ****
unsigned long blobLen;
ILAttribute *attribute;
/* Make sure that the attribute type name ends in "Attribute" */
if(yyisa(attr->name, ILNode_Identifier))
{
! ModifyAttrName((ILNode_Identifier *)(attr->name));
}
else if(yyisa(attr->name, ILNode_QualIdent))
{
ModifyAttrName
! ((ILNode_Identifier *)(((ILNode_QualIdent
*)(attr->name))->right));
}
/* Perform semantic analysis on the attribute type */
type = CSSemType(attr->name, info, &(attr->name));
/* The type must inherit from "System.Attribute" and not be abstract */
--- 245,304 ----
unsigned long blobLen;
ILAttribute *attribute;
+ ILNode *nameNode=NULL;
+ int alreadySeen=0;
/* Make sure that the attribute type name ends in "Attribute" */
if(yyisa(attr->name, ILNode_Identifier))
{
! ModifyAttrName((ILNode_Identifier *)(attr->name),0);
}
else if(yyisa(attr->name, ILNode_QualIdent))
{
ModifyAttrName
! ((ILNode_Identifier *)(((ILNode_QualIdent
*)(attr->name))->right),0);
}
+ nameNode=attr->name;
+ if(!CSSemExpectType(attr->name,info,&(attr->name)))
+ {
+ /* restore and rename */
+ attr->name=nameNode;
+ /* Make sure that the attribute type name ends in "Attribute" */
+ if(yyisa(attr->name, ILNode_Identifier))
+ {
+ ModifyAttrName((ILNode_Identifier *)(attr->name),1);
+ }
+ else if(yyisa(attr->name, ILNode_QualIdent))
+ {
+ ModifyAttrName((ILNode_Identifier *)(((ILNode_QualIdent
*)
+
(attr->name))->right),1);
+ }
+ alreadySeen=1;
+ }
+
/* Perform semantic analysis on the attribute type */
type = CSSemType(attr->name, info, &(attr->name));
+
+ /* To handle stuff like System.Xml.XmlAttribute which is not an
+ * attribute, but there is
System.Xml.Serialization.XmlAttributeAttribute
+ * which is also [XmlAttribute]
+ */
+ if((!alreadySeen) && (!ILTypeAssignCompatible
+ (info->image, type, ILFindSystemType(info,
"Attribute"))))
+ {
+ attr->name=nameNode;
+ /* Make sure that the attribute type name ends in "Attribute" */
+ if(yyisa(attr->name, ILNode_Identifier))
+ {
+ ModifyAttrName((ILNode_Identifier *)(attr->name),1);
+ }
+ else if(yyisa(attr->name, ILNode_QualIdent))
+ {
+ ModifyAttrName((ILNode_Identifier *)(((ILNode_QualIdent
*)
+
(attr->name))->right),1);
+ }
+ /* Perform semantic analysis on the attribute type */
+ type = CSSemType(attr->name, info, &(attr->name));
+ }
/* The type must inherit from "System.Attribute" and not be abstract */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Dotgnu-pnet-commits] CVS: pnet/cscc/csharp cs_semantics.tc,1.10,1.11 cs_attrs.c,1.12,1.13,
Gopal.V <address@hidden> <=