[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Dotgnu-pnet-commits] CVS: pnet/cscc/csharp cs_lookup.c,1.23,1.24 cs_lv
From: |
Rhys Weatherley <address@hidden> |
Subject: |
[Dotgnu-pnet-commits] CVS: pnet/cscc/csharp cs_lookup.c,1.23,1.24 cs_lvalue.tc,1.38,1.39 |
Date: |
Wed, 26 Feb 2003 22:21:27 -0500 |
Update of /cvsroot/dotgnu-pnet/pnet/cscc/csharp
In directory subversions:/tmp/cvs-serv24265/cscc/csharp
Modified Files:
cs_lookup.c cs_lvalue.tc
Log Message:
Remove the trial lookup for properties and replace with a filter in
CSResolveSimpleName to remove non-static members during quiet
lookups in static methods.
Index: cs_lookup.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/cscc/csharp/cs_lookup.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -r1.23 -r1.24
*** cs_lookup.c 27 Feb 2003 00:59:53 -0000 1.23
--- cs_lookup.c 27 Feb 2003 03:21:24 -0000 1.24
***************
*** 982,985 ****
--- 982,1148 ----
/*
+ * Filter a member lookup results list to include only static entries.
+ */
+ static int FilterStatic(CSMemberLookupInfo *results, int kind)
+ {
+ ILProgramItem *first = results->members->member;
+ ILMethod *method;
+ CSMemberLookupIter iter;
+ CSMemberInfo *member;
+
+ switch(kind)
+ {
+ case CS_SEMKIND_TYPE:
+ {
+ /* Nested types are always static members */
+ }
+ break;
+
+ case CS_SEMKIND_FIELD:
+ {
+ /* Bail out if the field is not static */
+ if(!ILField_IsStatic((ILField *)first))
+ {
+ return CS_SEMKIND_VOID;
+ }
+ }
+ break;
+
+ case CS_SEMKIND_METHOD_GROUP:
+ {
+ /* Remove all non-static methods from the group */
+ MemberIterInit(&iter, results);
+ while((member = MemberIterNext(&iter)) != 0)
+ {
+ if(member->kind == IL_META_MEMBERKIND_METHOD &&
+ !ILMethod_IsStatic((ILMethod
*)(member->member)))
+ {
+ MemberIterRemove(&iter);
+ }
+ }
+ if(!(results->num))
+ {
+ return CS_SEMKIND_VOID;
+ }
+ }
+ break;
+
+ case CS_SEMKIND_PROPERTY:
+ {
+ /* Bail out if the property is not static */
+ method = ILProperty_Getter((ILProperty *)first);
+ if(!method)
+ {
+ method = ILProperty_Setter((ILProperty *)first);
+ }
+ if(!method || !ILMethod_IsStatic(method))
+ {
+ return CS_SEMKIND_VOID;
+ }
+ }
+ break;
+
+ case CS_SEMKIND_EVENT:
+ {
+ /* Bail out if the event is not static */
+ method = ILEvent_AddOn((ILEvent *)first);
+ if(!method)
+ {
+ method = ILEvent_RemoveOn((ILEvent *)first);
+ }
+ if(!method || !ILMethod_IsStatic(method))
+ {
+ return CS_SEMKIND_VOID;
+ }
+ }
+ break;
+ }
+
+ return kind;
+ }
+
+ /*
+ * Filter a member lookup results list to include only non-static entries.
+ */
+ static int FilterNonStatic(CSMemberLookupInfo *results, int kind)
+ {
+ ILProgramItem *first = results->members->member;
+ ILMethod *method;
+ CSMemberLookupIter iter;
+ CSMemberInfo *member;
+
+ switch(kind)
+ {
+ case CS_SEMKIND_TYPE:
+ {
+ /* Nested types are always static members */
+ return CS_SEMKIND_VOID;
+ }
+ /* Not reached */
+
+ case CS_SEMKIND_FIELD:
+ {
+ /* Bail out if the field is static */
+ if(ILField_IsStatic((ILField *)first))
+ {
+ return CS_SEMKIND_VOID;
+ }
+ }
+ break;
+
+ case CS_SEMKIND_METHOD_GROUP:
+ {
+ /* Remove all static methods from the group */
+ MemberIterInit(&iter, results);
+ while((member = MemberIterNext(&iter)) != 0)
+ {
+ if(member->kind == IL_META_MEMBERKIND_METHOD &&
+ ILMethod_IsStatic((ILMethod
*)(member->member)))
+ {
+ MemberIterRemove(&iter);
+ }
+ }
+ if(!(results->num))
+ {
+ return CS_SEMKIND_VOID;
+ }
+ }
+ break;
+
+ case CS_SEMKIND_PROPERTY:
+ {
+ /* Bail out if the property is static */
+ method = ILProperty_Getter((ILProperty *)first);
+ if(!method)
+ {
+ method = ILProperty_Setter((ILProperty *)first);
+ }
+ if(!method || ILMethod_IsStatic(method))
+ {
+ return CS_SEMKIND_VOID;
+ }
+ }
+ break;
+
+ case CS_SEMKIND_EVENT:
+ {
+ /* Bail out if the event is static */
+ method = ILEvent_AddOn((ILEvent *)first);
+ if(!method)
+ {
+ method = ILEvent_RemoveOn((ILEvent *)first);
+ }
+ if(!method || ILMethod_IsStatic(method))
+ {
+ return CS_SEMKIND_VOID;
+ }
+ }
+ break;
+ }
+
+ return kind;
+ }
+
+ /*
* Inner version of CSResolveSimpleName and CSResolveSimpleNameQuiet.
*/
***************
*** 1000,1003 ****
--- 1163,1167 ----
ILType *formalType;
CSSemValue value;
+ ILMethod *caller;
/* If we are within type gathering, then search the nesting
***************
*** 1052,1055 ****
--- 1216,1233 ----
if(result != CS_SEMKIND_VOID)
{
+ if(genInfo->currentMethod && !reportErrors)
+ {
+ caller = ((ILNode_MethodDeclaration
*)(genInfo->currentMethod))
+ ->methodInfo;
+ if(caller && ILMethod_IsStatic(caller))
+ {
+ /* We are in a static context, so
filter out
+ non-static members */
+ result = FilterStatic(&results, result);
+ }
+ }
+ }
+ if(result != CS_SEMKIND_VOID)
+ {
return LookupToSem(node, name, &results, result);
}
***************
*** 1157,1323 ****
{
return ResolveSimpleName(genInfo, node, name, literalType, 0);
- }
-
- /*
- * Filter a member lookup results list to include only static entries.
- */
- static int FilterStatic(CSMemberLookupInfo *results, int kind)
- {
- ILProgramItem *first = results->members->member;
- ILMethod *method;
- CSMemberLookupIter iter;
- CSMemberInfo *member;
-
- switch(kind)
- {
- case CS_SEMKIND_TYPE:
- {
- /* Nested types are always static members */
- }
- break;
-
- case CS_SEMKIND_FIELD:
- {
- /* Bail out if the field is not static */
- if(!ILField_IsStatic((ILField *)first))
- {
- return CS_SEMKIND_VOID;
- }
- }
- break;
-
- case CS_SEMKIND_METHOD_GROUP:
- {
- /* Remove all non-static methods from the group */
- MemberIterInit(&iter, results);
- while((member = MemberIterNext(&iter)) != 0)
- {
- if(member->kind == IL_META_MEMBERKIND_METHOD &&
- !ILMethod_IsStatic((ILMethod
*)(member->member)))
- {
- MemberIterRemove(&iter);
- }
- }
- if(!(results->num))
- {
- return CS_SEMKIND_VOID;
- }
- }
- break;
-
- case CS_SEMKIND_PROPERTY:
- {
- /* Bail out if the property is not static */
- method = ILProperty_Getter((ILProperty *)first);
- if(!method)
- {
- method = ILProperty_Setter((ILProperty *)first);
- }
- if(!method || !ILMethod_IsStatic(method))
- {
- return CS_SEMKIND_VOID;
- }
- }
- break;
-
- case CS_SEMKIND_EVENT:
- {
- /* Bail out if the event is not static */
- method = ILEvent_AddOn((ILEvent *)first);
- if(!method)
- {
- method = ILEvent_RemoveOn((ILEvent *)first);
- }
- if(!method || !ILMethod_IsStatic(method))
- {
- return CS_SEMKIND_VOID;
- }
- }
- break;
- }
-
- return kind;
- }
-
- /*
- * Filter a member lookup results list to include only non-static entries.
- */
- static int FilterNonStatic(CSMemberLookupInfo *results, int kind)
- {
- ILProgramItem *first = results->members->member;
- ILMethod *method;
- CSMemberLookupIter iter;
- CSMemberInfo *member;
-
- switch(kind)
- {
- case CS_SEMKIND_TYPE:
- {
- /* Nested types are always static members */
- return CS_SEMKIND_VOID;
- }
- /* Not reached */
-
- case CS_SEMKIND_FIELD:
- {
- /* Bail out if the field is static */
- if(ILField_IsStatic((ILField *)first))
- {
- return CS_SEMKIND_VOID;
- }
- }
- break;
-
- case CS_SEMKIND_METHOD_GROUP:
- {
- /* Remove all static methods from the group */
- MemberIterInit(&iter, results);
- while((member = MemberIterNext(&iter)) != 0)
- {
- if(member->kind == IL_META_MEMBERKIND_METHOD &&
- ILMethod_IsStatic((ILMethod
*)(member->member)))
- {
- MemberIterRemove(&iter);
- }
- }
- if(!(results->num))
- {
- return CS_SEMKIND_VOID;
- }
- }
- break;
-
- case CS_SEMKIND_PROPERTY:
- {
- /* Bail out if the property is static */
- method = ILProperty_Getter((ILProperty *)first);
- if(!method)
- {
- method = ILProperty_Setter((ILProperty *)first);
- }
- if(!method || ILMethod_IsStatic(method))
- {
- return CS_SEMKIND_VOID;
- }
- }
- break;
-
- case CS_SEMKIND_EVENT:
- {
- /* Bail out if the event is static */
- method = ILEvent_AddOn((ILEvent *)first);
- if(!method)
- {
- method = ILEvent_RemoveOn((ILEvent *)first);
- }
- if(!method || ILMethod_IsStatic(method))
- {
- return CS_SEMKIND_VOID;
- }
- }
- break;
- }
-
- return kind;
}
--- 1335,1338 ----
Index: cs_lvalue.tc
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/cscc/csharp/cs_lvalue.tc,v
retrieving revision 1.38
retrieving revision 1.39
diff -C2 -r1.38 -r1.39
*** cs_lvalue.tc 27 Feb 2003 02:57:43 -0000 1.38
--- cs_lvalue.tc 27 Feb 2003 03:21:24 -0000 1.39
***************
*** 1041,1046 ****
ILEvalValue evalue;
ILNode *save1;
- ILProperty *property;
- ILType *type;
/* PART I - Try it in the usual fashion */
--- 1041,1044 ----
***************
*** 1049,1071 ****
save1 = node->expr1;
- /* Hack: check for properties with enumerated types in the left
- part of the member reference. If we find one, then this is
- an enumerated constant value, not a property */
- if(yyisa(node->expr1, ILNode_Identifier))
- {
- value = CSResolveSimpleNameQuiet
- (info, node->expr1, ((ILNode_Identifier
*)(node->expr1))->name, 0);
- if(CSSemIsProperty(value))
- {
- property = CSSemGetProperty(value);
- type = ILTypeGetReturn(ILProperty_Signature(property));
- if(ILTypeIsEnum(type))
- {
- CSSemSetType(value, type);
- goto skipLeft;
- }
- }
- }
-
/* Get the semantic value for the left part of the identifier */
value = ILNode_SemAnalysis(node->expr1, info, &(node->expr1));
--- 1047,1050 ----
***************
*** 1088,1092 ****
}
- skipLeft:
/* Convert the second subexpression into a name */
name = ILQualIdentName(node->expr2, 0);
--- 1067,1070 ----
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Dotgnu-pnet-commits] CVS: pnet/cscc/csharp cs_lookup.c,1.23,1.24 cs_lvalue.tc,1.38,1.39,
Rhys Weatherley <address@hidden> <=