[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[dotgnu-pnet-commits] pnet ChangeLog codegen/cg_lvalue.tc codegen/cg_...
From: |
Klaus Treichel |
Subject: |
[dotgnu-pnet-commits] pnet ChangeLog codegen/cg_lvalue.tc codegen/cg_... |
Date: |
Sun, 19 Oct 2008 16:45:19 +0000 |
CVSROOT: /cvsroot/dotgnu-pnet
Module name: pnet
Changes by: Klaus Treichel <ktreichel> 08/10/19 16:45:19
Modified files:
. : ChangeLog
codegen : cg_lvalue.tc cg_nodes.tc cg_scope.c
jv_lvalue.tc
cscc/c : c_grammar.y c_lvalue.tc c_name.tc c_types.c
cscc/csharp : cs_attrs.c cs_defs.tc cs_gather.c cs_grammar.y
cs_internal.h cs_lvalue.tc cs_types.tc
cscc/java : java_gather.c java_grammar.y java_lvalue.tc
cscc/vb : vb_grammar.y
Log message:
Simplify ILNode_QualIdent by replacing right by the name directly.
Add ILNode_GenericQualIdent for generic identifier parts in codegen.
Fix declaration of generic methods (not explicit interface member
overrides).
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/pnet/ChangeLog?cvsroot=dotgnu-pnet&r1=1.3575&r2=1.3576
http://cvs.savannah.gnu.org/viewcvs/pnet/codegen/cg_lvalue.tc?cvsroot=dotgnu-pnet&r1=1.27&r2=1.28
http://cvs.savannah.gnu.org/viewcvs/pnet/codegen/cg_nodes.tc?cvsroot=dotgnu-pnet&r1=1.91&r2=1.92
http://cvs.savannah.gnu.org/viewcvs/pnet/codegen/cg_scope.c?cvsroot=dotgnu-pnet&r1=1.22&r2=1.23
http://cvs.savannah.gnu.org/viewcvs/pnet/codegen/jv_lvalue.tc?cvsroot=dotgnu-pnet&r1=1.13&r2=1.14
http://cvs.savannah.gnu.org/viewcvs/pnet/cscc/c/c_grammar.y?cvsroot=dotgnu-pnet&r1=1.83&r2=1.84
http://cvs.savannah.gnu.org/viewcvs/pnet/cscc/c/c_lvalue.tc?cvsroot=dotgnu-pnet&r1=1.25&r2=1.26
http://cvs.savannah.gnu.org/viewcvs/pnet/cscc/c/c_name.tc?cvsroot=dotgnu-pnet&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/pnet/cscc/c/c_types.c?cvsroot=dotgnu-pnet&r1=1.50&r2=1.51
http://cvs.savannah.gnu.org/viewcvs/pnet/cscc/csharp/cs_attrs.c?cvsroot=dotgnu-pnet&r1=1.29&r2=1.30
http://cvs.savannah.gnu.org/viewcvs/pnet/cscc/csharp/cs_defs.tc?cvsroot=dotgnu-pnet&r1=1.20&r2=1.21
http://cvs.savannah.gnu.org/viewcvs/pnet/cscc/csharp/cs_gather.c?cvsroot=dotgnu-pnet&r1=1.59&r2=1.60
http://cvs.savannah.gnu.org/viewcvs/pnet/cscc/csharp/cs_grammar.y?cvsroot=dotgnu-pnet&r1=1.85&r2=1.86
http://cvs.savannah.gnu.org/viewcvs/pnet/cscc/csharp/cs_internal.h?cvsroot=dotgnu-pnet&r1=1.26&r2=1.27
http://cvs.savannah.gnu.org/viewcvs/pnet/cscc/csharp/cs_lvalue.tc?cvsroot=dotgnu-pnet&r1=1.67&r2=1.68
http://cvs.savannah.gnu.org/viewcvs/pnet/cscc/csharp/cs_types.tc?cvsroot=dotgnu-pnet&r1=1.13&r2=1.14
http://cvs.savannah.gnu.org/viewcvs/pnet/cscc/java/java_gather.c?cvsroot=dotgnu-pnet&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/pnet/cscc/java/java_grammar.y?cvsroot=dotgnu-pnet&r1=1.7&r2=1.8
http://cvs.savannah.gnu.org/viewcvs/pnet/cscc/java/java_lvalue.tc?cvsroot=dotgnu-pnet&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/pnet/cscc/vb/vb_grammar.y?cvsroot=dotgnu-pnet&r1=1.6&r2=1.7
Patches:
Index: ChangeLog
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/ChangeLog,v
retrieving revision 1.3575
retrieving revision 1.3576
diff -u -b -r1.3575 -r1.3576
--- ChangeLog 5 Oct 2008 16:35:40 -0000 1.3575
+++ ChangeLog 19 Oct 2008 16:45:17 -0000 1.3576
@@ -1,3 +1,60 @@
+2008-10-19 Klaus Treichel <address@hidden>
+
+ * codegen/cg_lvalue.tc (ILQualIdentGetName): Add function to get the
name
+ component of an identifier node.
+ (ILQualIdentTwo, ILQualIdentName): Adjust for new layout of
+ ILNode_OualIdent.
+ (ILIsQualIdent): Adjust for new layout of ILNode_OualIdent and add
+ handling of ILNode_Generic_QualIdent.
+
+ * codegen/cg_nodes.tc: Replace the right node by a name in
+ ILNode_QualIdent. Add ILNode_GenericQualIdent.
+
+ * codegen/cg_scope.c (ResolveQualIdent, ILScopeResolveType): Adjust for
+ new layout of ILNode_OualIdent.
+
+ * codegen/jv_lvalue.tc: Add dummy operations for
ILNode_GenericQualIdent.
+
+ * cscc/c/c_grammar.y: Adjust creation of an ILNode_QualIdent for the new
+ layout.
+
+ * cscc/c/c_lvalue.tc: Add dummy operation ILNode_CSemAnalysis for
+ ILNode_GenericQualIdent.
+
+ * cscc/c/c_name.tc: Add dummy operation ILNode_CName for
+ ILNode_GenericQualIdent.
+
+ * cscc/c/c_types.c (CTypeFromCSharp): Adjust for new layout of
+ ILNode_OualIdent.
+
+ * cscc/csharp/cs_attrs.c (ModifyAttrName): Adjust for new layout of
+ ILNode_OualIdent.
+
+ * cscc/csharp/cs_defs.tc: Remove now obsolete ILNode_GenericReference.
+
+ * cscc/csharp/cs_gather.c (GetFullAndBasicNames): Adjust for new layout
of
+ ILNode_OualIdent and add dummy handling of ILNode_GenericQualIdent.
+ (CreateMethod, CreateProperty, CreateEventDecl): Replace
+ ILNode_GenericReference by ILNode_GenericQualIdent.
+
+ * cscc/csharp/cs_grammar.y: Adjust for new layout of ILNode_OualIdent.
+ Fix generic method declaration. Replace ILNode_GenericReference by
+ ILNode_GenericQualIdent.
+
+ * cscc/csharp/cs_internal.h: Change the member identifier in
+ struct MemberName to const char *.
+
+ * cscc/csharp/cs_lvalue.tc: Adjust for new layout of ILNode_OualIdent
and
+ add the operations ILNode_SemAnalysis and ILNode_SemAnalysisType for
+ ILNode_GenericQualIdent.
+
+ * cscc/csharp/cs_types.tc: Remove the operations ILNode_SemAnalysis and
+ ILNode_SemAnalysisType for ILNode_GenericReference.
+
+ * cscc/java/java_gather.c, cscc/java/java_grammar.y,
+ cscc/java/java_lvalue.tc, cscc/vb/vb_grammar.y: Adjust for new layout of
+ ILNode_OualIdent.
+
2008-10-05 Klaus Treichel <address@hidden>
* cscc/csharp/cs_grammar.y: Handle the implied constructor constraint
Index: codegen/cg_lvalue.tc
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/codegen/cg_lvalue.tc,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -b -r1.27 -r1.28
--- codegen/cg_lvalue.tc 5 May 2007 15:56:41 -0000 1.27
+++ codegen/cg_lvalue.tc 19 Oct 2008 16:45:17 -0000 1.28
@@ -31,21 +31,27 @@
*/
ILNode_GetType(ILNode_Identifier),
ILNode_GetType(ILNode_QualIdent),
+ILNode_GetType(ILNode_GenericQualIdent),
ILNode_GenValue(ILNode_Identifier),
-ILNode_GenValue(ILNode_QualIdent)
+ILNode_GenValue(ILNode_QualIdent),
+ILNode_GenValue(ILNode_GenericQualIdent)
{
return ILMachineType_Void;
}
ILNode_GenDiscard(ILNode_Identifier),
ILNode_GenDiscard(ILNode_QualIdent),
+ILNode_GenDiscard(ILNode_GenericQualIdent),
ILNode_GenThen(ILNode_Identifier),
ILNode_GenThen(ILNode_QualIdent),
+ILNode_GenThen(ILNode_GenericQualIdent),
ILNode_GenElse(ILNode_Identifier),
-ILNode_GenElse(ILNode_QualIdent)
+ILNode_GenElse(ILNode_QualIdent),
+ILNode_GenElse(ILNode_GenericQualIdent)
{
}
ILNode_EvalConst(ILNode_Identifier),
-ILNode_EvalConst(ILNode_QualIdent)
+ILNode_EvalConst(ILNode_QualIdent),
+ILNode_EvalConst(ILNode_GenericQualIdent)
{
return 0;
}
@@ -1540,6 +1546,12 @@
%decls %end %{
/*
+ * Get the name item of a qualified identifier part.
+ * Returns NULL if the identifier node is no identifier part.
+ */
+const char *ILQualIdentGetName(ILNode *identifier);
+
+/*
* Create a simple identifier node. "name" must be intern'ed.
*/
ILNode *ILQualIdentSimple(const char *name);
@@ -1584,6 +1596,28 @@
*/
%end %{
+const char *ILQualIdentGetName(ILNode *identifier)
+{
+ if(identifier)
+ {
+ if(yykind(identifier) == yykindof(ILNode_Identifier))
+ {
+ return ((ILNode_Identifier *)identifier)->name;
+ }
+ else if(yykind(identifier) == yykindof(ILNode_QualIdent))
+ {
+ return ((ILNode_QualIdent *)identifier)->name;
+ }
+ #if IL_VERSION_MAJOR > 1
+ else if(yykind(identifier) == yykindof(ILNode_GenericQualIdent))
+ {
+ return ((ILNode_GenericQualIdent *)identifier)->name;
+ }
+ #endif /* IL_VERSION_MAJOR > 1 */
+ }
+ return 0;
+}
+
ILNode *ILQualIdentSimple(const char *name)
{
return ILNode_Identifier_create(name);
@@ -1593,8 +1627,7 @@
{
const char *intern1 = ILInternString((char *)name1, -1).string;
const char *intern2 = ILInternString((char *)name2, -1).string;
- return ILNode_QualIdent_create(ILNode_Identifier_create(intern1),
-
ILNode_Identifier_create(intern2));
+ return ILNode_QualIdent_create(ILNode_Identifier_create(intern1),
intern2);
}
const char *ILQualIdentName(ILNode *node, int asmForm)
@@ -1624,8 +1657,19 @@
{
/* Qualified name */
ILNode_QualIdent *qident = (ILNode_QualIdent *)node;
+ if(asmForm && qident->name[0] >= 'a' && qident->name[0] <= 'z')
+ {
+ /* The name might clash with an assembler keyword
+ or instruction name, so we must quote it */
+ ILIntString quote = ILInternString("'", 1);
+ ILIntString name;
+ name.string = qident->name;
+ name.len = strlen(qident->name);
+ return (ILInternStringConcat3
+ (quote, name, quote)).string;
+ }
return ILQualIdentAppend(ILQualIdentName(qident->left, asmForm),
-
ILQualIdentName(qident->right, asmForm));
+ qident->name);
}
else
{
@@ -1685,8 +1729,19 @@
}
else if(yykind(node) == yykindof(ILNode_QualIdent))
{
- return ILIsQualIdent(((ILNode_QualIdent *)node)->left) &&
- ILIsQualIdent(((ILNode_QualIdent *)node)->right);
+ if(((ILNode_QualIdent *)node)->left)
+ {
+ return ILIsQualIdent(((ILNode_QualIdent *)node)->left);
+ }
+ return 1;
+ }
+ else if(yykind(node) == yykindof(ILNode_GenericQualIdent))
+ {
+ if(((ILNode_GenericQualIdent *)node)->left)
+ {
+ return ILIsQualIdent(((ILNode_GenericQualIdent
*)node)->left);
+ }
+ return 1;
}
else
{
Index: codegen/cg_nodes.tc
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/codegen/cg_nodes.tc,v
retrieving revision 1.91
retrieving revision 1.92
diff -u -b -r1.91 -r1.92
--- codegen/cg_nodes.tc 7 Nov 2007 16:39:41 -0000 1.91
+++ codegen/cg_nodes.tc 19 Oct 2008 16:45:17 -0000 1.92
@@ -521,7 +521,14 @@
%node ILNode_QualIdent ILNode =
{
ILNode *left;
- ILNode *right;
+ const char *name;
+}
+%node ILNode_GenericQualIdent ILNode =
+{
+ ILNode *left;
+ const char *name;
+ ILUInt32 numTypeArgs;
+ ILNode *typeArgs;
}
%node ILNode_LocalVar ILNode_LValue =
{
Index: codegen/cg_scope.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/codegen/cg_scope.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -b -r1.22 -r1.23
--- codegen/cg_scope.c 28 May 2007 15:28:37 -0000 1.22
+++ codegen/cg_scope.c 19 Oct 2008 16:45:17 -0000 1.23
@@ -693,27 +693,21 @@
{
/* Qualified identifier */
ILNode_QualIdent *ident = (ILNode_QualIdent *)identifier;
- ILNode_Identifier *right;
data = ResolveQualIdent(scope, ident->left);
if(!data)
{
return 0;
}
- if(yykind(ident->right) != yykindof(ILNode_Identifier))
- {
- return 0;
- }
- right = (ILNode_Identifier *)(ident->right);
if(data->rbnode.kind == IL_SCOPE_SUBSCOPE)
{
/* Search for the name within a namespace */
- return ILScopeLookup((ILScope *)(data->data),
right->name, 0);
+ return ILScopeLookup((ILScope *)(data->data),
ident->name, 0);
}
else if(data->rbnode.kind == IL_SCOPE_IMPORTED_TYPE ||
data->rbnode.kind == IL_SCOPE_DECLARED_TYPE)
{
/* Search for a nested type */
- return ILScopeLookup((ILScope *)(data->data),
right->name, 0);
+ return ILScopeLookup((ILScope *)(data->data),
ident->name, 0);
}
else
{
@@ -794,13 +788,11 @@
{
ILNode_QualIdent *qident = (ILNode_QualIdent *)identifier;
if(qident->left != 0 &&
- yykind(qident->left) == yykindof(ILNode_Identifier) &&
- qident->right != 0 &&
- yykind(qident->right) == yykindof(ILNode_Identifier))
+ yykind(qident->left) == yykindof(ILNode_Identifier))
{
*classInfo = ILClassLookup
(ILClassGlobalScope(scope->info->libImage),
- ((ILNode_Identifier
*)(qident->right))->name,
+ qident->name,
((ILNode_Identifier
*)(qident->left))->name);
if((*classInfo) != 0)
{
Index: codegen/jv_lvalue.tc
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/codegen/jv_lvalue.tc,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -b -r1.13 -r1.14
--- codegen/jv_lvalue.tc 21 May 2002 10:41:47 -0000 1.13
+++ codegen/jv_lvalue.tc 19 Oct 2008 16:45:17 -0000 1.14
@@ -23,16 +23,20 @@
* be replaced with real l-value nodes prior to code generation.
*/
JavaGenValue(ILNode_Identifier),
-JavaGenValue(ILNode_QualIdent)
+JavaGenValue(ILNode_QualIdent),
+JavaGenValue(ILNode_GenericQualIdent)
{
return ILMachineType_Void;
}
JavaGenDiscard(ILNode_Identifier),
JavaGenDiscard(ILNode_QualIdent),
+JavaGenDiscard(ILNode_GenericQualIdent),
JavaGenThen(ILNode_Identifier),
JavaGenThen(ILNode_QualIdent),
+JavaGenThen(ILNode_GenericQualIdent),
JavaGenElse(ILNode_Identifier),
-JavaGenElse(ILNode_QualIdent)
+JavaGenElse(ILNode_QualIdent),
+JavaGenElse(ILNode_GenericQualIdent)
{
}
Index: cscc/c/c_grammar.y
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/cscc/c/c_grammar.y,v
retrieving revision 1.83
retrieving revision 1.84
diff -u -b -r1.83 -r1.84
--- cscc/c/c_grammar.y 5 May 2007 15:56:41 -0000 1.83
+++ cscc/c/c_grammar.y 19 Oct 2008 16:45:17 -0000 1.84
@@ -2423,7 +2423,7 @@
QualifiedIdentifier
: AnyIdentifier { $$ = ILQualIdentSimple($1); }
| QualifiedIdentifier '.' AnyIdentifier {
- $$ = ILNode_QualIdent_create($1,
ILQualIdentSimple($3));
+ $$ = ILNode_QualIdent_create($1, $3);
}
;
@@ -3460,7 +3460,7 @@
TypeOrNamespaceDesignator
: AnyIdentifier { $$ = ILQualIdentSimple($1); }
| TypeOrNamespaceDesignator COLON_COLON_OP AnyIdentifier {
- $$ = ILNode_QualIdent_create($1,
ILQualIdentSimple($3));
+ $$ = ILNode_QualIdent_create($1, $3);
}
;
Index: cscc/c/c_lvalue.tc
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/cscc/c/c_lvalue.tc,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -b -r1.25 -r1.26
--- cscc/c/c_lvalue.tc 20 Sep 2007 20:04:16 -0000 1.25
+++ cscc/c/c_lvalue.tc 19 Oct 2008 16:45:17 -0000 1.26
@@ -29,6 +29,15 @@
}
/*
+ * Perform semantic analysis for a generic qualified identifier.
+ */
+ILNode_CSemAnalysis(ILNode_GenericQualIdent)
+{
+ /* This is not used in C */
+ return CSemValueError;
+}
+
+/*
* Perform semantic analysis for generic parameters.
*/
ILNode_CSemAnalysis(ILNode_GenericTypeParameter),
Index: cscc/c/c_name.tc
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/cscc/c/c_name.tc,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- cscc/c/c_name.tc 6 Mar 2004 09:47:37 -0000 1.1
+++ cscc/c/c_name.tc 19 Oct 2008 16:45:18 -0000 1.2
@@ -233,6 +233,7 @@
ILNode_CName(ILNode_NonStaticInit),
ILNode_CName(ILNode_Identifier),
ILNode_CName(ILNode_QualIdent),
+ILNode_CName(ILNode_GenericQualIdent),
ILNode_CName(ILNode_ArrayInit),
ILNode_CName(ILNode_CDeclarator),
ILNode_CName(ILNode_VaStart),
Index: cscc/c/c_types.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/cscc/c/c_types.c,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -b -r1.50 -r1.51
--- cscc/c/c_types.c 28 May 2007 14:40:35 -0000 1.50
+++ cscc/c/c_types.c 19 Oct 2008 16:45:18 -0000 1.51
@@ -2330,7 +2330,7 @@
}
else
{
- name = ILQualIdentName(((ILNode_QualIdent *)node)->right, 0);
+ name = ((ILNode_QualIdent *)node)->name;
namespace = ILQualIdentName(((ILNode_QualIdent *)node)->left,
0);
}
Index: cscc/csharp/cs_attrs.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/cscc/csharp/cs_attrs.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -b -r1.29 -r1.30
--- cscc/csharp/cs_attrs.c 5 May 2007 15:56:41 -0000 1.29
+++ cscc/csharp/cs_attrs.c 19 Oct 2008 16:45:18 -0000 1.30
@@ -124,7 +124,7 @@
{
newNode = ILNode_AttrQualIdent_create
(((ILNode_QualIdent *)node)->left,
- ((ILNode_QualIdent *)node)->right);
+ ((ILNode_QualIdent *)node)->name);
}
else if(yyisa(node, ILNode_Identifier))
{
Index: cscc/csharp/cs_defs.tc
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/cscc/csharp/cs_defs.tc,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -b -r1.20 -r1.21
--- cscc/csharp/cs_defs.tc 23 Oct 2007 18:32:20 -0000 1.20
+++ cscc/csharp/cs_defs.tc 19 Oct 2008 16:45:18 -0000 1.21
@@ -92,13 +92,6 @@
ILNode *left;
ILNode *right;
}
-%node ILNode_GenericReference ILNode_Dummy =
-{
- ILNode *left;
- ILNode *identifier;
- ILUInt32 numArgs;
- ILNode *typeArguments;
-}
%node ILNode_GenericConstraint ILNode_Dummy =
{
const char *name;
Index: cscc/csharp/cs_gather.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/cscc/csharp/cs_gather.c,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -b -r1.59 -r1.60
--- cscc/csharp/cs_gather.c 7 Nov 2007 16:39:41 -0000 1.59
+++ cscc/csharp/cs_gather.c 19 Oct 2008 16:45:18 -0000 1.60
@@ -84,30 +84,37 @@
*/
static const char *GetFullAndBasicNames(ILNode *name, const char **basicName)
{
+ /*
+ * TODO: This doesn't work with explicit implementations of
+ * generic interface methods.
+ */
const char *result;
const char *basic;
const char *left;
+
if(yyisa(name, ILNode_Identifier))
{
- result = ILQualIdentName(name, 0);
+ result = ILQualIdentGetName(name);
basic = result;
}
- else if(yyisa(name, ILNode_GenericReference))
+ else if(yyisa(name, ILNode_GenericQualIdent))
{
char buffer[261];
- left = GetFullAndBasicNames(((ILNode_GenericReference
*)name)->left, 0);
- result = ILQualIdentName(((ILNode_GenericReference
*)name)->identifier, 0);
- sprintf(buffer, "%s`%i", result, ((ILNode_GenericReference
*)name)->numArgs);
+ result = ((ILNode_GenericQualIdent *)name)->name;
+ sprintf(buffer, "%s`%i", result, ((ILNode_GenericQualIdent
*)name)->numTypeArgs);
+ if(((ILNode_GenericQualIdent *)name)->left)
+ {
+ left = GetFullAndBasicNames(((ILNode_GenericQualIdent
*)name)->left, 0);
result = ILQualIdentAppend(left, buffer);
+ }
basic = result;
}
else if(yyisa(name, ILNode_QualIdent))
{
left = GetFullAndBasicNames(((ILNode_QualIdent *)name)->left,
0);
- result = GetFullAndBasicNames
- (((ILNode_QualIdent *)name)->right, &basic);
- result = ILQualIdentAppend(left, result);
+ result = ILQualIdentAppend(left, ((ILNode_QualIdent
*)name)->name);
+ basic = ((ILNode_QualIdent *)name)->name;
}
else
{
@@ -1337,7 +1344,7 @@
interface = 0;
interfaceMember = 0;
if(yykind(method->name) == yykindof(ILNode_Identifier) ||
- yykind(method->name) == yykindof(ILNode_GenericReference))
+ yykind(method->name) == yykindof(ILNode_GenericQualIdent))
{
/* Simple method name */
name = GetFullAndBasicNames(method->name, &basicName);
@@ -1854,7 +1861,7 @@
/* Get the name of the property */
if(yykind(property->name) == yykindof(ILNode_Identifier) ||
- yykind(property->name) == yykindof(ILNode_GenericReference))
+ yykind(property->name) == yykindof(ILNode_GenericQualIdent))
{
/* Simple property name */
name = GetFullAndBasicNames(property->name, &basicName);
@@ -2124,7 +2131,7 @@
/* Get the name of the event */
eventName = ((ILNode_FieldDeclarator
*)(eventDecl->fieldDeclarator))->name;
if(yykind(eventName) == yykindof(ILNode_Identifier) ||
- yykind(eventName) == yykindof(ILNode_GenericReference))
+ yykind(eventName) == yykindof(ILNode_GenericQualIdent))
{
/* Simple event name */
name = GetFullAndBasicNames(eventName, &basicName);
Index: cscc/csharp/cs_grammar.y
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/cscc/csharp/cs_grammar.y,v
retrieving revision 1.85
retrieving revision 1.86
diff -u -b -r1.85 -r1.86
--- cscc/csharp/cs_grammar.y 5 Oct 2008 16:35:40 -0000 1.85
+++ cscc/csharp/cs_grammar.y 19 Oct 2008 16:45:18 -0000 1.86
@@ -454,23 +454,35 @@
{
const char *name;
int namelen;
- ILNode_Identifier *ident;
if(yyisa(node,ILNode_QualIdent))
{
- ModifyAttrName(((ILNode_QualIdent*)node)->right, force);
+ name = ((ILNode_QualIdent *)node)->name;
+ }
+ else if(yyisa(node,ILNode_Identifier))
+ {
+ name = ((ILNode_Identifier*)node)->name;
+ }
+ else
+ {
return;
}
- ident = (ILNode_Identifier*) node;
-
- name = ident->name;
namelen = strlen(name);
if(force || (namelen < 9 || strcmp(name + namelen - 9, "Attribute") !=
0))
{
- ident->name = ILInternAppendedString
+ name = ILInternAppendedString
(ILInternString(name, namelen),
ILInternString("Attribute", 9)).string;
+
+ if(yyisa(node,ILNode_QualIdent))
+ {
+ ((ILNode_QualIdent *)node)->name = name;
+ }
+ else if(yyisa(node,ILNode_Identifier))
+ {
+ ((ILNode_Identifier*)node)->name = name;
+ }
}
}
@@ -544,9 +556,8 @@
else
{
return
ILNode_QualIdent_create(prefixName,
-
ILQualIdentSimple(
ILInternString(evalValue.un.strValue.str,
-
evalValue.un.strValue.len).string));
+
evalValue.un.strValue.len).string);
}
}
}
@@ -558,8 +569,9 @@
return ILQualIdentSimple(ILInternString("Item", 4).string);
else
return ILNode_QualIdent_create(prefixName,
-
ILQualIdentSimple(ILInternString("Item",4).string));
+
ILInternString("Item",4).string);
}
+
/*
* Adjust the name of a property to include a "get_" or "set_" prefix.
*/
@@ -580,7 +592,9 @@
{
/* Qualified name: add the prefix to the second component */
node = ILNode_QualIdent_create(((ILNode_QualIdent *)name)->left,
- AdjustPropertyName(((ILNode_QualIdent *)name)->right,
prefix));
+ (ILInternAppendedString
+ (ILInternString(prefix,
strlen(prefix)),
+
ILInternString(((ILNode_QualIdent *)name)->name, -1)).string));
CloneLine(node, name);
return node;
}
@@ -920,7 +934,6 @@
} opName;
struct
{
- ILNode *type;
ILNode *ident;
ILNode *params;
@@ -962,6 +975,17 @@
{
ILNode *attributes;
ILUInt32 modifiers;
+ } attributesAndModifiers;
+ struct
+ {
+ ILNode *attributes;
+ ILUInt32 modifiers;
+ ILUInt32 partial;
+ } typeHeader;
+ struct
+ {
+ ILNode *attributes;
+ ILUInt32 modifiers;
ILUInt32 partial;
ILNode *identifier;
ILNode *classBase;
@@ -972,6 +996,27 @@
ILNode *attributes;
ILUInt32 modifiers;
ILNode *type;
+ } memberHeaderStart;
+ struct
+ {
+ ILNode *attributes;
+ ILUInt32 modifiers;
+ ILNode *type;
+ ILNode *identifier;
+ } nonGenericMethodAndPropertyHeaderStart;
+ struct
+ {
+ ILNode *attributes;
+ ILUInt32 modifiers;
+ ILNode *type;
+ ILNode *identifier;
+ ILNode_GenericTypeParameters *typeFormals;
+ } genericMethodHeaderStart;
+ struct
+ {
+ ILNode *attributes;
+ ILUInt32 modifiers;
+ ILNode *type;
ILNode *identifier;
ILNode_List *args;
ILNode_GenericTypeParameters *typeFormals;
@@ -1142,7 +1187,7 @@
%type <count> DimensionSeparators DimensionSeparatorList
%type <count> RankSpecifier
%type <arrayRanks> RankSpecifiers
-%type <mask> OptModifiers Modifiers Modifier
+%type <mask> Modifiers Modifier
%type <partial> OptPartial
%type <node> Identifier GenericIdentifierStart
@@ -1219,6 +1264,9 @@
%type <node> InnerEmbeddedStatement InnerExpressionStatement
%type <node> YieldStatement DefaultValueExpression
+%type <memberHeaderStart> MemberHeaderStart
+%type <nonGenericMethodAndPropertyHeaderStart>
NonGenericMethodAndPropertyHeaderStart
+%type <genericMethodHeaderStart> GenericMethodHeaderStart
%type <node> ConstantDeclaration ConstantDeclarators
ConstantDeclarator
%type <node> FieldDeclaration FieldDeclarators FieldDeclarator
%type <varInit> VariableDeclarators VariableDeclarator
@@ -1259,6 +1307,8 @@
%type <node> OptAttributes AttributeSections AttributeSection
%type <node> AttributeList Attribute AttributeArguments
%type <node> NonOptAttributes
+%type <attributesAndModifiers> OptAttributesAndModifiers AttributesAndModifiers
+%type <typeHeader> OptTypeDeclarationHeader
%type <node> PositionalArgumentList PositionalArgument
NamedArgumentList
%type <node> NamedArgument AttributeArgumentExpression
%type <node> OptArrayInitializer ArrayInitializer
@@ -1436,15 +1486,15 @@
| SET { $$ = ILInternString("set",
3).string; }
| ADD { $$ = ILInternString("add",
3).string; }
| REMOVE { $$ = ILInternString("remove",
6).string; }
- | WHERE { $$ = ILInternString("where",
5).string; }
| PARTIAL { $$ =
ILInternString("partial", 7).string; }
+ | WHERE { $$ = ILInternString("where",
5).string; }
| YIELD { $$ = ILInternString("yield",
5).string; }
;
QualifiedIdentifier
: NonGenericQualifiedIdentifier { $$ = $1; }
| GenericQualifiedIdentifier {
- MakeQuaternary(GenericReference,
+ MakeQuaternary(GenericQualIdent,
$1.parent,
$1.memberName.identifier,
$1.memberName.numTypeArgs,
@@ -1456,7 +1506,7 @@
* A qualified identifier without a generic reference at the last part
*/
SimpleQualifiedIdentifier
- : QualifiedIdentifierMemberAccessStart Identifier {
+ : QualifiedIdentifierMemberAccessStart IDENTIFIER {
$$.parent = $1;
$$.memberName.identifier = $2;
$$.memberName.numTypeArgs = 0;
@@ -1476,7 +1526,7 @@
GenericQualifiedIdentifierStart
: GenericIdentifierStart {
$$.parent = 0;
- $$.memberName.identifier = $1;
+ $$.memberName.identifier =
ILQualIdentGetName($1);
$$.memberName.numTypeArgs = 0;
$$.memberName.typeArgs = 0;
}
@@ -1502,7 +1552,7 @@
$$ = $1;
}
| GenericQualifiedIdentifier '.' {
- MakeQuaternary(GenericReference,
+ MakeQuaternary(GenericQualIdent,
$1.parent,
$1.memberName.identifier,
$1.memberName.numTypeArgs,
@@ -3126,11 +3176,6 @@
* Modifiers.
*/
-OptModifiers
- : /* empty */ { $$ = 0; }
- | Modifiers { $$ = $1; }
- ;
-
Modifiers
: Modifier { $$ = $1; }
| Modifiers Modifier {
@@ -3161,36 +3206,61 @@
| VOLATILE { $$ = CS_MODIFIER_VOLATILE; }
;
+OptAttributesAndModifiers
+ : /* empty */ { $$.attributes = 0; $$.modifiers = 0; }
+ | AttributesAndModifiers {
+ $$.attributes = $1.attributes;
+ $$.modifiers = $1.modifiers;
+ }
+ ;
+
+AttributesAndModifiers
+ : NonOptAttributes { $$.attributes = $1; $$.modifiers = 0;
}
+ | Modifiers { $$.attributes = 0;
$$.modifiers = $1; }
+ | NonOptAttributes Modifiers {
+ $$.attributes = $1;
+ $$.modifiers = $2;
+ }
+ ;
+
+OptTypeDeclarationHeader
+ : OptAttributesAndModifiers OptPartial {
+ $$.attributes = $1.attributes;
+ $$.modifiers = $1.modifiers;
+ $$.partial = $2;
+ }
+ ;
+
/*
* Class declarations.
*/
ClassHeader
- : OptAttributes OptModifiers OptPartial CLASS Identifier ClassBase
{
- $$.attributes = $1;
- $$.modifiers = $2;
- $$.partial = $3;
- $$.identifier = $5;
- $$.classBase = $6;
+ : OptTypeDeclarationHeader CLASS Identifier ClassBase {
+ $$.attributes = $1.attributes;
+ $$.modifiers = $1.modifiers;
+ $$.partial = $1.partial;
+ $$.identifier = $3;
+ $$.classBase = $4;
$$.typeFormals = 0;
}
- | OptAttributes OptModifiers OptPartial CLASS GenericIdentifierStart
+ | OptTypeDeclarationHeader CLASS GenericIdentifierStart
TypeFormals ClassBase
OptTypeParameterConstraintsClauses {
#if IL_VERSION_MAJOR > 1
- $$.attributes = $1;
- $$.modifiers = $2;
- $$.partial = $3;
- $$.identifier = $5;
- $$.classBase = $7;
- $$.typeFormals = $6;
- MergeGenericConstraints($6, $8);
+ $$.attributes = $1.attributes;
+ $$.modifiers = $1.modifiers;
+ $$.partial = $1.partial;
+ $$.identifier = $3;
+ $$.classBase = $5;
+ $$.typeFormals = $4;
+ MergeGenericConstraints($4, $6);
#else /* IL_VERSION_MAJOR == 1 */
- CCErrorOnLine(yygetfilename($5),
yygetlinenum($5),
+ CCErrorOnLine(yygetfilename($3),
yygetlinenum($3),
"generics are not
supported in this version");
- $$.attributes = $1;
- $$.modifiers = $2;
- $$.partial = $3;
- $$.identifier = $5;
- $$.classBase = $7;
+ $$.attributes = $1.attributes;
+ $$.modifiers = $1.modifiers;
+ $$.partial = $1.partial;
+ $$.identifier = $3;
+ $$.classBase = $5;
$$.typeFormals = 0;
#endif /* IL_VERSION_MAJOR == 1 */
}
@@ -3297,19 +3367,28 @@
$$ = (ILNode_GenericTypeParameters *)
ILNode_GenericTypeParameters_create($1.count, $1.list);
}
+ | error '>' {
+ /*
+ * This production recovers from errors in the
typeformals
+ * of a "for" statement.
+ */
+ $$ = (ILNode_GenericTypeParameters *)
+
ILNode_GenericTypeParameters_create(0, 0);
+ yyerrok;
+ }
;
TypeFormalList
- : Identifier {
+ : IDENTIFIER {
$$.count = 1;
$$.list = (ILNode_List *)MakeList(0,
(ILNode
*)ILNode_GenericTypeParameter_create(0,
-
ILQualIdentName($1, 0),
+
$1,
0, 0));
}
- | TypeFormalList ',' Identifier {
+ | TypeFormalList ',' IDENTIFIER {
/* Check for duplicates in the list */
- const char *name = ILQualIdentName($3, 0);
+ const char *name = $3;
ILNode_ListIter iter;
ILNode_GenericTypeParameter *node;
ILNode_ListIter_Init(&iter, $1.list);
@@ -3317,7 +3396,7 @@
{
if(!strcmp(node->name, name))
{
-
CCErrorOnLine(yygetfilename($3), yygetlinenum($3),
+
CCErrorOnLine(yygetfilename($1.list), yygetlinenum($1.list),
"`%s' declared multiple times
in generic parameters",
name);
break;
@@ -3515,13 +3594,53 @@
;
/*
+ * Members
+ */
+MemberHeaderStart
+ : OptAttributesAndModifiers Type {
+ $$.attributes = $1.attributes;
+ $$.modifiers = $1.modifiers;
+ $$.type = $2;
+ }
+ ;
+
+NonGenericMethodAndPropertyHeaderStart
+ : MemberHeaderStart NonGenericQualifiedIdentifier {
+ $$.attributes = $1.attributes;
+ $$.modifiers = $1.modifiers;
+ $$.type = $1.type;
+ $$.identifier = $2;
+ }
+ ;
+
+GenericMethodHeaderStart
+ : MemberHeaderStart GenericQualifiedIdentifier {
+ ILNode_GenericTypeParameters *typeFormals;
+ /*
+ * We have to convert the TypeActuals for the
last part
+ * to TypeFormals here.
+ */
+ $$.attributes = $1.attributes;
+ $$.modifiers = $1.modifiers;
+ $$.type = $1.type;
+ typeFormals = TypeActualsToTypeFormals((ILNode
*)($2.memberName.typeArgs));
+ $$.identifier = ILNode_GenericQualIdent_create(
+
$2.parent,
+
$2.memberName.identifier,
+
$2.memberName.numTypeArgs,
+ (ILNode
*)typeFormals);
+ $$.typeFormals = typeFormals;
+ }
+ ;
+
+/*
* Constants.
*/
ConstantDeclaration
- : OptAttributes OptModifiers CONST Type ConstantDeclarators ';' {
- ILUInt32 attrs = CSModifiersToConstAttrs($4,
$2);
- $$ = ILNode_FieldDeclaration_create($1, attrs,
$4, $5);
+ : OptAttributesAndModifiers CONST Type ConstantDeclarators ';' {
+ ILUInt32 attrs = CSModifiersToConstAttrs($3,
$1.modifiers);
+ $$ =
ILNode_FieldDeclaration_create($1.attributes, attrs, $3, $4);
}
;
@@ -3547,22 +3666,22 @@
*/
FieldDeclaration
- : OptAttributes OptModifiers Type FieldDeclarators ';' {
- ILUInt32 attrs = CSModifiersToFieldAttrs($3,
$2);
+ : MemberHeaderStart FieldDeclarators ';' {
+ ILUInt32 attrs =
CSModifiersToFieldAttrs($1.type, $1.modifiers);
#if IL_VERSION_MAJOR > 1
if(ClassNameGetModifiers() & CS_MODIFIER_STATIC)
{
- if(!($2 & CS_MODIFIER_STATIC))
+ if(!($1.modifiers & CS_MODIFIER_STATIC))
{
CCError(_("only static fields
are allowed in static classes"));
}
- if($2 & CS_MODIFIER_PROTECTED)
+ if($1.modifiers & CS_MODIFIER_PROTECTED)
{
CCError(_("no protected or
protected internal fields are allowed in static classes"));
}
}
#endif /* IL_VERSION_MAJOR > 1 */
- $$ = ILNode_FieldDeclaration_create($1, attrs,
$3, $4);
+ $$ =
ILNode_FieldDeclaration_create($1.attributes, attrs, $1.type, $2);
}
;
@@ -3591,28 +3710,28 @@
* Methods.
*/
MethodHeader
- : OptAttributes OptModifiers Type NonGenericQualifiedIdentifier
+ : NonGenericMethodAndPropertyHeaderStart
'(' OptFormalParameterList ')' {
- $$.attributes = $1;
- $$.modifiers = $2;
- $$.type = $3;
- $$.args = (ILNode_List *)$6;
- $$.identifier = $4;
+ $$.attributes = $1.attributes;
+ $$.modifiers = $1.modifiers;
+ $$.type = $1.type;
+ $$.args = (ILNode_List *)$3;
+ $$.identifier = $1.identifier;
$$.typeFormals = 0;
}
- | OptAttributes OptModifiers Type NonGenericQualifiedIdentifier '<'
TypeFormals
+ | GenericMethodHeaderStart
'(' OptFormalParameterList ')'
OptTypeParameterConstraintsClauses {
- $$.attributes = $1;
- $$.modifiers = $2;
- $$.type = $3;
- $$.args = (ILNode_List *)$8;
- $$.identifier = $4;
+ $$.attributes = $1.attributes;
+ $$.modifiers = $1.modifiers;
+ $$.type = $1.type;
+ $$.args = (ILNode_List *)$3;
+ $$.identifier = $1.identifier;
#if IL_VERSION_MAJOR > 1
- $$.typeFormals = $6;
- MergeGenericConstraints($6, $10);
+ $$.typeFormals = $1.typeFormals;
+ MergeGenericConstraints($1.typeFormals, $5);
#else /* IL_VERSION_MAJOR == 1 */
$$.typeFormals = 0;
- CCErrorOnLine(yygetfilename($4),
yygetlinenum($4),
+ CCErrorOnLine(yygetfilename($1.identifier),
yygetlinenum($1.identifier),
"generics are not
supported in this version");
#endif /* IL_VERSION_MAJOR == 1 */
}
@@ -3693,30 +3812,30 @@
*/
PropertyDeclaration
- : OptAttributes OptModifiers Type QualifiedIdentifier
+ : NonGenericMethodAndPropertyHeaderStart
StartAccessorBlock AccessorBlock {
ILUInt32 attrs;
#if IL_VERSION_MAJOR > 1
if(ClassNameGetModifiers() & CS_MODIFIER_STATIC)
{
- if(!($2 & CS_MODIFIER_STATIC))
+ if(!($1.modifiers & CS_MODIFIER_STATIC))
{
CCError(_("only static
properties are allowed in static classes"));
}
- if($2 & CS_MODIFIER_PROTECTED)
+ if($1.modifiers & CS_MODIFIER_PROTECTED)
{
CCError(_("no protected or
protected internal properties are allowed in static classes"));
}
}
#endif /* IL_VERSION_MAJOR > 1 */
/* Create the property declaration */
- attrs = CSModifiersToPropertyAttrs($3, $2);
- $$ = ILNode_PropertyDeclaration_create($1,
- attrs, $3,
$4, 0, $6.item1, $6.item2,
- (($6.item1 ?
1 : 0) |
- ($6.item2 ?
2 : 0)));
- CloneLine($$, $4);
+ attrs = CSModifiersToPropertyAttrs($1.type,
$1.modifiers);
+ $$ =
ILNode_PropertyDeclaration_create($1.attributes,
+ attrs,
$1.type, $1.identifier, 0, $3.item1, $3.item2,
+ (($3.item1 ?
1 : 0) |
+ ($3.item2 ?
2 : 0)));
+ CloneLine($$, $1.identifier);
/* Create the property method declarations */
CreatePropertyMethods((ILNode_PropertyDeclaration *)($$));
@@ -3797,22 +3916,22 @@
;
EventFieldDeclaration
- : OptAttributes OptModifiers EVENT Type EventDeclarators ';' {
- ILUInt32 attrs = CSModifiersToEventAttrs($4,
$2);
+ : OptAttributesAndModifiers EVENT Type EventDeclarators ';' {
+ ILUInt32 attrs = CSModifiersToEventAttrs($3,
$1.modifiers);
#if IL_VERSION_MAJOR > 1
if(ClassNameGetModifiers() & CS_MODIFIER_STATIC)
{
- if(!($2 & CS_MODIFIER_STATIC))
+ if(!($1.modifiers & CS_MODIFIER_STATIC))
{
CCError(_("only static events
are allowed in static classes"));
}
- if($2 & CS_MODIFIER_PROTECTED)
+ if($1.modifiers & CS_MODIFIER_PROTECTED)
{
CCError(_("no protected or
protected internal events are allowed in static classes"));
}
}
#endif /* IL_VERSION_MAJOR > 1 */
- $$ = ILNode_EventDeclaration_create($1, attrs,
$4, $5);
+ $$ =
ILNode_EventDeclaration_create($1.attributes, attrs, $3, $4);
CreateEventMethods((ILNode_EventDeclaration
*)($$));
}
;
@@ -3841,15 +3960,15 @@
;
EventPropertyDeclaration
- : OptAttributes OptModifiers EVENT Type QualifiedIdentifier
+ : OptAttributesAndModifiers EVENT Type QualifiedIdentifier
StartAccessorBlock EventAccessorBlock {
- ILUInt32 attrs = CSModifiersToEventAttrs($4,
$2);
+ ILUInt32 attrs = CSModifiersToEventAttrs($3,
$1.modifiers);
$$ = ILNode_EventDeclaration_create
- ($1, attrs, $4,
+ ($1.attributes, attrs, $3,
ILNode_EventDeclarator_create
-
(ILNode_FieldDeclarator_create($5, 0),
- $7.item1, $7.item2));
- CloneLine($$, $5);
+
(ILNode_FieldDeclarator_create($4, 0),
+ $6.item1, $6.item2));
+ CloneLine($$, $4);
CreateEventMethods((ILNode_EventDeclaration
*)($$));
}
;
@@ -3904,32 +4023,32 @@
*/
IndexerDeclaration
- : OptAttributes OptModifiers IndexerDeclarator
+ : MemberHeaderStart IndexerDeclarator
StartAccessorBlock AccessorBlock {
- ILNode*
name=GetIndexerName(&CCCodeGen,(ILNode_AttributeTree*)$1,
- $3.ident);
- ILUInt32 attrs =
CSModifiersToPropertyAttrs($3.type, $2);
+ ILNode*
name=GetIndexerName(&CCCodeGen,(ILNode_AttributeTree*)$1.attributes,
+ $2.ident);
+ ILUInt32 attrs =
CSModifiersToPropertyAttrs($1.type, $1.modifiers);
#if IL_VERSION_MAJOR > 1
if(ClassNameGetModifiers() & CS_MODIFIER_STATIC)
{
- if(!($2 & CS_MODIFIER_STATIC))
+ if(!($1.modifiers & CS_MODIFIER_STATIC))
{
CCError(_("only static indexers
are allowed in static classes"));
}
- if($2 & CS_MODIFIER_PROTECTED)
+ if($1.modifiers & CS_MODIFIER_PROTECTED)
{
CCError(_("no protected or
protected internal indexers are allowed in static classes"));
}
}
#endif /* IL_VERSION_MAJOR > 1 */
- $$ = ILNode_PropertyDeclaration_create($1,
- attrs,
$3.type, name, $3.params,
- $5.item1,
$5.item2,
- (($5.item1 ?
1 : 0) |
- ($5.item2 ?
2 : 0)));
- CloneLine($$, $3.ident);
+ $$ =
ILNode_PropertyDeclaration_create($1.attributes,
+ attrs,
$1.type, name, $2.params,
+ $4.item1,
$4.item2,
+ (($4.item1 ?
1 : 0) |
+ ($4.item2 ?
2 : 0)));
+ CloneLine($$, $2.ident);
/* Create the property method declarations */
CreatePropertyMethods((ILNode_PropertyDeclaration *)($$));
@@ -3937,15 +4056,13 @@
;
IndexerDeclarator
- : Type THIS FormalIndexParameters {
- $$.type = $1;
+ : THIS FormalIndexParameters {
$$.ident = ILQualIdentSimple(NULL);
- $$.params = $3;
+ $$.params = $2;
}
- | Type QualifiedIdentifierMemberAccessStart THIS FormalIndexParameters
{
- $$.type = $1;
- $$.ident = $2;
- $$.params = $4;
+ | QualifiedIdentifierMemberAccessStart THIS FormalIndexParameters
{
+ $$.ident = $1;
+ $$.params = $3;
}
;
@@ -3989,16 +4106,16 @@
;
NormalOperatorDeclaration
- : OptAttributes OptModifiers Type OPERATOR OverloadableOperator
+ : MemberHeaderStart OPERATOR OverloadableOperator
'(' Type Identifier ')' Block {
ILUInt32 attrs;
ILNode *params;
/* Validate the name of the unary operator */
- if($5.unary == 0)
+ if($3.unary == 0)
{
CCError("overloadable unary operator
expected");
- $5.unary = $5.binary;
+ $3.unary = $3.binary;
}
#if IL_VERSION_MAJOR > 1
@@ -4009,30 +4126,30 @@
#endif /* IL_VERSION_MAJOR > 1 */
/* Get the operator attributes */
- attrs = CSModifiersToOperatorAttrs($3, $2);
+ attrs = CSModifiersToOperatorAttrs($1.type,
$1.modifiers);
/* Build the formal parameter list */
params = ILNode_List_create();
ILNode_List_Add(params,
- ILNode_FormalParameter_create(0,
ILParamMod_empty, $7, $8));
+ ILNode_FormalParameter_create(0,
ILParamMod_empty, $5, $6));
/* Create a method definition for the operator
*/
$$ = ILNode_MethodDeclaration_create
- ($1, attrs, $3,
-
ILQualIdentSimple(ILInternString($5.unary, -1).string),
- 0, params, $10);
- CloneLine($$, $3);
+ ($1.attributes, attrs, $1.type,
+
ILQualIdentSimple(ILInternString($3.unary, -1).string),
+ 0, params, $8);
+ CloneLine($$, $1.type);
}
- | OptAttributes OptModifiers Type OPERATOR OverloadableOperator
+ | MemberHeaderStart OPERATOR OverloadableOperator
'(' Type Identifier ',' Type Identifier ')' Block
{
ILUInt32 attrs;
ILNode *params;
/* Validate the name of the binary operator */
- if($5.binary == 0)
+ if($3.binary == 0)
{
CCError("overloadable binary operator
expected");
- $5.binary = $5.unary;
+ $3.binary = $3.unary;
}
#if IL_VERSION_MAJOR > 1
@@ -4043,24 +4160,24 @@
#endif /* IL_VERSION_MAJOR > 1 */
/* Get the operator attributes */
- attrs = CSModifiersToOperatorAttrs($3, $2);
+ attrs = CSModifiersToOperatorAttrs($1.type,
$1.modifiers);
/* Build the formal parameter list */
params = ILNode_List_create();
ILNode_List_Add(params,
ILNode_FormalParameter_create
- (0, ILParamMod_empty, $7, $8));
+ (0, ILParamMod_empty, $5, $6));
ILNode_List_Add(params,
ILNode_FormalParameter_create
- (0, ILParamMod_empty, $10,
$11));
+ (0, ILParamMod_empty, $8, $9));
/* Create a method definition for the operator
*/
$$ = ILNode_MethodDeclaration_create
- ($1, attrs, $3,
+ ($1.attributes, attrs, $1.type,
ILQualIdentSimple
-
(ILInternString($5.binary, -1).string),
- 0, params, $13);
- CloneLine($$, $3);
+
(ILInternString($3.binary, -1).string),
+ 0, params, $11);
+ CloneLine($$, $1.type);
}
;
@@ -4090,47 +4207,47 @@
;
ConversionOperatorDeclaration
- : OptAttributes OptModifiers IMPLICIT OPERATOR Type
+ : OptAttributesAndModifiers IMPLICIT OPERATOR Type
'(' Type Identifier ')' Block {
ILUInt32 attrs;
ILNode *params;
/* Get the operator attributes */
- attrs = CSModifiersToOperatorAttrs($5, $2);
+ attrs = CSModifiersToOperatorAttrs($4,
$1.modifiers);
/* Build the formal parameter list */
params = ILNode_List_create();
ILNode_List_Add(params,
- ILNode_FormalParameter_create(0,
ILParamMod_empty, $7, $8));
+ ILNode_FormalParameter_create(0,
ILParamMod_empty, $6, $7));
/* Create a method definition for the operator
*/
$$ = ILNode_MethodDeclaration_create
- ($1, attrs, $5,
+ ($1.attributes, attrs, $4,
ILQualIdentSimple
(ILInternString("op_Implicit", -1).string),
- 0, params, $10);
- CloneLine($$, $5);
+ 0, params, $9);
+ CloneLine($$, $4);
}
- | OptAttributes OptModifiers EXPLICIT OPERATOR Type
+ | OptAttributesAndModifiers EXPLICIT OPERATOR Type
'(' Type Identifier ')' Block {
ILUInt32 attrs;
ILNode *params;
/* Get the operator attributes */
- attrs = CSModifiersToOperatorAttrs($5, $2);
+ attrs = CSModifiersToOperatorAttrs($4,
$1.modifiers);
/* Build the formal parameter list */
params = ILNode_List_create();
ILNode_List_Add(params,
- ILNode_FormalParameter_create(0,
ILParamMod_empty, $7, $8));
+ ILNode_FormalParameter_create(0,
ILParamMod_empty, $6, $7));
/* Create a method definition for the operator
*/
$$ = ILNode_MethodDeclaration_create
- ($1, attrs, $5,
+ ($1.attributes, attrs, $4,
ILQualIdentSimple
(ILInternString("op_Explicit", -1).string),
- 0, params, $10);
- CloneLine($$, $5);
+ 0, params, $9);
+ CloneLine($$, $4);
}
;
@@ -4139,18 +4256,18 @@
*/
ConstructorDeclaration
- : OptAttributes OptModifiers Identifier
+ : OptAttributesAndModifiers Identifier
'(' OptFormalParameterList ')' ConstructorInitializer
MethodBody {
- ILUInt32 attrs =
CSModifiersToConstructorAttrs($3, $2);
+ ILUInt32 attrs =
CSModifiersToConstructorAttrs($2, $1.modifiers);
ILNode *ctorName;
ILNode *cname;
- ILNode *initializer = $7;
+ ILNode *initializer = $6;
ILNode *body;
#if IL_VERSION_MAJOR > 1
if(ClassNameGetModifiers() & CS_MODIFIER_STATIC)
{
- if(!($2 & CS_MODIFIER_STATIC))
+ if(!($1.modifiers & CS_MODIFIER_STATIC))
{
CCError(_("no instance
constructors are allowed in static classes"));
}
@@ -4169,26 +4286,26 @@
(ILInternString(".ctor", 5).string);
ClassNameCtorDefined();
}
- ctorName = $3;
+ ctorName = $2;
if(!ClassNameSame(ctorName))
{
- CCErrorOnLine(yygetfilename($3),
yygetlinenum($3),
+ CCErrorOnLine(yygetfilename($2),
yygetlinenum($2),
"constructor name does not
match class name");
}
- if($8 && yykind($8) ==
yykindof(ILNode_NewScope))
+ if($7 && yykind($7) ==
yykindof(ILNode_NewScope))
{
/* Push the initializer into the body
scope */
- body = $8;
+ body = $7;
((ILNode_NewScope *)body)->stmt =
ILNode_Compound_CreateFrom
(initializer,
((ILNode_NewScope *)body)->stmt);
}
- else if($8 || (attrs & CS_SPECIALATTR_EXTERN)
== 0)
+ else if($7 || (attrs & CS_SPECIALATTR_EXTERN)
== 0)
{
/* Non-scoped body: create a new scoped
body */
body = ILNode_NewScope_create
-
(ILNode_Compound_CreateFrom(initializer, $8));
- CCWarningOnLine(yygetfilename($3),
yygetlinenum($3),
+
(ILNode_Compound_CreateFrom(initializer, $7));
+ CCWarningOnLine(yygetfilename($2),
yygetlinenum($2),
"constructor without body
should be declared 'extern'");
}
else
@@ -4198,9 +4315,9 @@
}
if((attrs & IL_META_METHODDEF_STATIC) != 0)
{
- if(!yyisa($5,ILNode_Empty))
+ if(!yyisa($4,ILNode_Empty))
{
-
CCErrorOnLine(yygetfilename($3), yygetlinenum($3),
+
CCErrorOnLine(yygetfilename($2), yygetlinenum($2),
"Static
constructors cannot have parameters");
}
$$.body = 0;
@@ -4209,8 +4326,8 @@
else
{
$$.body =
ILNode_MethodDeclaration_create
- ($1, attrs, 0 /* "void" */,
cname, 0, $5, body);
- CloneLine($$.body, $3);
+ ($1.attributes, attrs, 0 /*
"void" */, cname, 0, $4, body);
+ CloneLine($$.body, $2);
$$.staticCtors = 0;
}
}
@@ -4235,7 +4352,7 @@
;
DestructorDeclaration
- : OptAttributes OptModifiers '~' Identifier '(' ')' Block
{
+ : OptAttributesAndModifiers '~' Identifier '(' ')' Block
{
ILUInt32 attrs;
ILNode *dtorName;
ILNode *name;
@@ -4244,24 +4361,24 @@
#if IL_VERSION_MAJOR > 1
if(ClassNameGetModifiers() & CS_MODIFIER_STATIC)
{
- if(!($2 & CS_MODIFIER_STATIC))
+ if(!($1.modifiers & CS_MODIFIER_STATIC))
{
CCError(_("no destructors are
allowed in static classes"));
}
}
#endif /* IL_VERSION_MAJOR > 1 */
- dtorName = $4;
+ dtorName = $3;
/* Validate the destructor name */
if(!ClassNameSame(dtorName))
{
- CCErrorOnLine(yygetfilename($4),
yygetlinenum($4),
+ CCErrorOnLine(yygetfilename($3),
yygetlinenum($3),
"destructor name does not match
class name");
}
/* Build the list of attributes needed on
"Finalize" */
- attrs = CSModifiersToDestructorAttrs($4,$2);
+ attrs = CSModifiersToDestructorAttrs($3,
$1.modifiers);
/* Build the name of the "Finalize" method */
name =
ILQualIdentSimple(ILInternString("Finalize", -1).string);
@@ -4276,15 +4393,15 @@
ILNode_InvocationExpression_create
(ILNode_BaseAccess_create(name), 0));
body = ILNode_Try_create
- ($7, 0,
ILNode_FinallyClause_create(body));
+ ($6, 0,
ILNode_FinallyClause_create(body));
/* Construct the finalizer declaration */
$$ = ILNode_MethodDeclaration_create
- ($1, attrs, 0 /* void
*/,
+ ($1.attributes, attrs,
0 /* void */,
ILQualIdentSimple
(ILInternString("Finalize", -1).string),
0, 0, body);
- CloneLine($$, $4);
+ CloneLine($$, $3);
}
;
@@ -4292,32 +4409,32 @@
* Structs.
*/
StructHeader
- : OptAttributes OptModifiers OptPartial STRUCT Identifier
StructInterfaces {
- $$.attributes = $1;
- $$.modifiers = $2;
- $$.partial = $3;
- $$.identifier = $5;
- $$.classBase = $6;
+ : OptTypeDeclarationHeader STRUCT Identifier StructInterfaces {
+ $$.attributes = $1.attributes;
+ $$.modifiers = $1.modifiers;
+ $$.partial = $1.partial;
+ $$.identifier = $3;
+ $$.classBase = $4;
$$.typeFormals = 0;
}
- | OptAttributes OptModifiers OptPartial STRUCT GenericIdentifierStart
+ | OptTypeDeclarationHeader STRUCT GenericIdentifierStart
TypeFormals StructInterfaces
OptTypeParameterConstraintsClauses {
#if IL_VERSION_MAJOR > 1
- $$.attributes = $1;
- $$.modifiers = $2;
- $$.partial = $3;
- $$.identifier = $5;
- $$.classBase = $7;
- $$.typeFormals = $6;
- MergeGenericConstraints($6, $8);
+ $$.attributes = $1.attributes;
+ $$.modifiers = $1.modifiers;
+ $$.partial = $1.partial;
+ $$.identifier = $3;
+ $$.classBase = $5;
+ $$.typeFormals = $4;
+ MergeGenericConstraints($4, $6);
#else /* IL_VERSION_MAJOR == 1 */
- CCErrorOnLine(yygetfilename($5),
yygetlinenum($5),
+ CCErrorOnLine(yygetfilename($3),
yygetlinenum($3),
"generics are not
supported in this version");
- $$.attributes = $1;
- $$.modifiers = $2;
- $$.partial = $3;
- $$.identifier = $5;
- $$.classBase = $7;
+ $$.attributes = $1.attributes;
+ $$.modifiers = $1.modifiers;
+ $$.partial = $1.partial;
+ $$.identifier = $3;
+ $$.classBase = $5;
$$.typeFormals = 0;
#endif /* IL_VERSION_MAJOR == 1 */
}
@@ -4396,32 +4513,32 @@
* Interfaces.
*/
InterfaceHeader
- : OptAttributes OptModifiers OptPartial INTERFACE Identifier
InterfaceBase {
- $$.attributes = $1;
- $$.modifiers = $2;
- $$.partial = $3;
- $$.identifier = $5;
- $$.classBase = $6;
+ : OptTypeDeclarationHeader INTERFACE Identifier InterfaceBase {
+ $$.attributes = $1.attributes;
+ $$.modifiers = $1.modifiers;
+ $$.partial = $1.partial;
+ $$.identifier = $3;
+ $$.classBase = $4;
$$.typeFormals = 0;
}
- | OptAttributes OptModifiers OptPartial INTERFACE GenericIdentifierStart
+ | OptTypeDeclarationHeader INTERFACE GenericIdentifierStart
TypeFormals InterfaceBase
OptTypeParameterConstraintsClauses {
#if IL_VERSION_MAJOR > 1
- $$.attributes = $1;
- $$.modifiers = $2;
- $$.partial = $3;
- $$.identifier = $5;
- $$.classBase = $7;
- $$.typeFormals = $6;
- MergeGenericConstraints($6, $8);
+ $$.attributes = $1.attributes;
+ $$.modifiers = $1.modifiers;
+ $$.partial = $1.partial;
+ $$.identifier = $3;
+ $$.classBase = $5;
+ $$.typeFormals = $4;
+ MergeGenericConstraints($4, $6);
#else /* IL_VERSION_MAJOR == 1 */
- CCErrorOnLine(yygetfilename($5),
yygetlinenum($5),
+ CCErrorOnLine(yygetfilename($3),
yygetlinenum($3),
"generics are not
supported in this version");
- $$.attributes = $1;
- $$.modifiers = $2;
- $$.partial = $3;
- $$.identifier = $5;
- $$.classBase = $7;
+ $$.attributes = $1.attributes;
+ $$.modifiers = $1.modifiers;
+ $$.partial = $1.partial;
+ $$.identifier = $3;
+ $$.classBase = $5;
$$.typeFormals = 0;
#endif /* IL_VERSION_MAJOR == 1 */
}
@@ -4651,12 +4768,12 @@
*/
EnumDeclaration
- : OptAttributes OptModifiers ENUM Identifier EnumBase {
+ : OptAttributesAndModifiers ENUM Identifier EnumBase {
/* Enter a new nesting level */
++NestingLevel;
/* Push the identifier onto the class name
stack */
- ClassNamePush($4, $2);
+ ClassNamePush($3, $1.modifiers);
}
EnumBody OptSemiColon {
ILNode *baseList;
@@ -4665,7 +4782,7 @@
ILUInt32 attrs;
/* Validate the modifiers */
- attrs = CSModifiersToTypeAttrs($4, $2,
(NestingLevel > 1));
+ attrs = CSModifiersToTypeAttrs($3,
$1.modifiers, (NestingLevel > 1));
/* Add extra attributes that enums need */
attrs |= IL_META_TYPEDEF_SERIALIZABLE |
@@ -4679,7 +4796,7 @@
/* Add an instance field called "value__" to
the body,
which is used to hold the enumerated value */
- bodyList = $7;
+ bodyList = $6;
if(!bodyList)
{
bodyList = ILNode_List_create();
@@ -4688,26 +4805,26 @@
ILNode_List_Add(fieldDecl,
ILNode_FieldDeclarator_create
(ILQualIdentSimple("value__"),
0));
- MakeBinary(FieldDeclarator, $1, 0);
+ MakeBinary(FieldDeclarator, $1.attributes, 0);
ILNode_List_Add(bodyList,
ILNode_FieldDeclaration_create
(0, IL_META_FIELDDEF_PUBLIC |
IL_META_FIELDDEF_SPECIAL_NAME |
-
IL_META_FIELDDEF_RT_SPECIAL_NAME, $5, fieldDecl));
+
IL_META_FIELDDEF_RT_SPECIAL_NAME, $4, fieldDecl));
/* Create the class definition */
InitGlobalNamespace();
$$ = ILNode_ClassDefn_create
- ($1,
/* OptAttributes */
+ ($1.attributes,
/* OptAttributes */
attrs,
/* OptModifiers */
- ILQualIdentName($4,
0),/* Identifier */
+ ILQualIdentName($3,
0),/* Identifier */
CurrNamespace.string,
/* Namespace */
(ILNode
*)CurrNamespaceNode,
0,
/* TypeFormals */
baseList,
/* ClassBase */
bodyList,
/* EnumBody */
0);
/* StaticCtors */
- CloneLine($$, $4);
+ CloneLine($$, $3);
/* Pop the class name stack */
ClassNamePop();
@@ -4778,33 +4895,33 @@
* Delegates.
*/
DelegateHeader
- : OptAttributes OptModifiers DELEGATE Type Identifier
+ : OptAttributesAndModifiers DELEGATE Type Identifier
'(' OptFormalParameterList ')' {
- $$.attributes = $1;
- $$.modifiers = $2;
- $$.type = $4;
- $$.identifier = $5;
- $$.args = (ILNode_List *)$7;
+ $$.attributes = $1.attributes;
+ $$.modifiers = $1.modifiers;
+ $$.type = $3;
+ $$.identifier = $4;
+ $$.args = (ILNode_List *)$6;
$$.typeFormals = 0;
}
- | OptAttributes OptModifiers DELEGATE Type GenericIdentifierStart
TypeFormals
+ | OptAttributesAndModifiers DELEGATE Type GenericIdentifierStart
TypeFormals
'(' OptFormalParameterList ')'
OptTypeParameterConstraintsClauses {
#if IL_VERSION_MAJOR > 1
- $$.attributes = $1;
- $$.modifiers = $2;
- $$.type = $4;
- $$.identifier = $5;
- $$.args = (ILNode_List *)$8;
- $$.typeFormals = $6;
- MergeGenericConstraints($6, $10);
+ $$.attributes = $1.attributes;
+ $$.modifiers = $1.modifiers;
+ $$.type = $3;
+ $$.identifier = $4;
+ $$.args = (ILNode_List *)$7;
+ $$.typeFormals = $5;
+ MergeGenericConstraints($5, $9);
#else /* IL_VERSION_MAJOR == 1 */
- CCErrorOnLine(yygetfilename($5),
yygetlinenum($5),
+ CCErrorOnLine(yygetfilename($4),
yygetlinenum($4),
"generics are not
supported in this version");
- $$.attributes = $1;
- $$.modifiers = $2;
- $$.type = $4;
- $$.identifier = $5;
- $$.args = (ILNode_List *)$8;
+ $$.attributes = $1.attributes;
+ $$.modifiers = $1.modifiers;
+ $$.type = $3;
+ $$.identifier = $4;
+ $$.args = (ILNode_List *)$7;
$$.typeFormals = 0;
#endif /* IL_VERSION_MAJOR == 1 */
}
Index: cscc/csharp/cs_internal.h
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/cscc/csharp/cs_internal.h,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -b -r1.26 -r1.27
--- cscc/csharp/cs_internal.h 23 Oct 2007 18:32:21 -0000 1.26
+++ cscc/csharp/cs_internal.h 19 Oct 2008 16:45:18 -0000 1.27
@@ -53,7 +53,7 @@
*/
struct MemberName
{
- ILNode *identifier;
+ const char *identifier;
ILUInt32 numTypeArgs;
ILNode_List *typeArgs;
};
Index: cscc/csharp/cs_lvalue.tc
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/cscc/csharp/cs_lvalue.tc,v
retrieving revision 1.67
retrieving revision 1.68
diff -u -b -r1.67 -r1.68
--- cscc/csharp/cs_lvalue.tc 15 Aug 2008 20:52:36 -0000 1.67
+++ cscc/csharp/cs_lvalue.tc 19 Oct 2008 16:45:18 -0000 1.68
@@ -1083,7 +1083,7 @@
value = ILNode_SemAnalysisType(node->left, info, &(node->left));
/* Resolve the member */
- name = ILQualIdentName(node->right, 0);
+ name = node->name;
value2 = CSResolveMemberName(info, (ILNode *)node, value, name, 0);
/* Convert the result into an l-value or r-value and return it */
@@ -1103,7 +1103,7 @@
int savedState = info->inSemType;
ns = ILQualIdentName(node->left, 0);
- name = ILQualIdentName(node->right, 0);
+ name = node->name;
value = GetFullyQualifiedType(info, ns, name);
@@ -1136,6 +1136,133 @@
}
/*
+ * Perform semantic analysis for qualified identifiers.
+ */
+ILNode_SemAnalysis(ILNode_GenericQualIdent)
+{
+ CSSemValue value;
+ ILClass *classInfo;
+ ILUInt32 numFormals;
+ ILType *withType;
+ const char *name;
+ char buffer[261];
+
+ /* Get the type name with the generic arity appended */
+ sprintf(buffer, "%s`%i", node->name, node->numTypeArgs);
+ name = buffer;
+
+ if(node->left)
+ {
+ CSSemValue value2;
+
+ /* Get the semantic value for the left part of the identifier */
+ value2 = ILNode_SemAnalysisType(node->left, info,
&(node->left));
+
+ /* Resolve the member */
+ value = CSResolveMemberName(info, (ILNode *)node, value2, name,
1);
+ }
+ else
+ {
+ value = CSResolveSimpleNameQuiet(info, (ILNode *)node, name, 1);
+ }
+ if(!CSSemIsType(value))
+ {
+ CCErrorOnLine(yygetfilename(node), yygetlinenum(node),
+ "type name expected in generic type
reference");
+ return value;
+ }
+
+ /* Find the number of generic parameters that we expect */
+ classInfo = ILClassResolve(ILTypeToClass(info, CSSemGetType(value)));
+ numFormals = ILGenericParGetNumParams(ILToProgramItem(classInfo));
+
+ /* Check the counts for consistency */
+ /* TODO: This check is not correct for nested types. */
+ if(numFormals != node->numTypeArgs)
+ {
+ CCErrorOnLine(yygetfilename(node), yygetlinenum(node),
+ "incorrect number of generic
parameters supplied to "
+ "`%s'; was %d but should be %d",
+ CSTypeToName(CSSemGetType(value)),
+ (int)node->numTypeArgs,
(int)numFormals);
+ }
+
+ /* Build the "with" type and return it */
+ withType = ILTypeCreateWith(info->context, CSSemGetType(value));
+ if(!withType)
+ {
+ CCOutOfMemory();
+ }
+ CSSemWithType(node->typeArgs, info, &(node->typeArgs), withType);
+ CSSemSetType(value, withType);
+ return value;
+}
+
+/*
+ * Perform semantic analysis with a bias to returning Type objects.
+ */
+ILNode_SemAnalysisType(ILNode_GenericQualIdent)
+{
+ CSSemValue value;
+ const char *name;
+ int savedState=info->inSemType;
+ char buffer[261];
+
+ /* Get the type name with the generic arity appended */
+ sprintf(buffer, "%s`%i", node->name, node->numTypeArgs);
+ name = buffer;
+
+ info->inSemType = -1;
+
+ /* Perform semantic analysis on the main part of the type */
+ if(node->left)
+ {
+ CSSemValue value2;
+
+ /* Get the semantic value for the left part of the identifier */
+ value2 = ILNode_SemAnalysisType(node->left, info,
&(node->left));
+
+ /* Resolve the member */
+ value = CSResolveMemberName(info, (ILNode *)node, value2, name,
1);
+ }
+ else
+ {
+ value = CSResolveSimpleNameQuiet(info, (ILNode *)node, name, 1);
+ }
+ info->inSemType = savedState;
+
+ if(CSSemGetKind(value) == CS_SEMKIND_TYPE)
+ {
+ ILType *withType;
+ /* TODO: perform the analysis for the TypeActuals. */
+
+ /* Build the "with" type and return it */
+ withType = ILTypeCreateWith(info->context, CSSemGetType(value));
+ if(!withType)
+ {
+ CCOutOfMemory();
+ }
+ CSSemWithType(node->typeArgs, info, &(node->typeArgs),
+ withType);
+ CSSemSetType(value, withType);
+
+ /* Convert the result into an l-value or r-value and return it
*/
+ return SemToLRValue((ILNode *)node, info, parent, value,
+ name, node->left,
&value);
+ }
+ else if(CSSemGetKind(value) == CS_SEMKIND_TYPE_NODE)
+ {
+ /* TODO: perform the analysis for the TypeActuals. */
+
+ /* Convert the result into an l-value or r-value and return it
*/
+ return SemToLRValue((ILNode *)node, info, parent, value,
+ name, node->left,
&value);
+
+ }
+ return CSSemValueDefault;
+}
+
+/*
* Perform semantic analysis with a bias to returning Type objects.
* If the first lookup fails, another is tried where the right-hand
* part of the identifier ends in "Attribute".
@@ -1154,7 +1281,7 @@
value = ILNode_SemAnalysis(node->left, info, &(node->left));
/* Resolve the member */
- name = ILQualIdentName(node->right, 0);
+ name = node->name;
value2 = CSResolveMemberNameQuiet(info, (ILNode *)node, value, name, 1);
/* If the resolution failed, then try again with "Attribute" appended */
Index: cscc/csharp/cs_types.tc
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/cscc/csharp/cs_types.tc,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -b -r1.13 -r1.14
--- cscc/csharp/cs_types.tc 30 Oct 2007 17:35:23 -0000 1.13
+++ cscc/csharp/cs_types.tc 19 Oct 2008 16:45:18 -0000 1.14
@@ -310,137 +310,6 @@
return CSSemValueDefault;
}
-/*
- * Perform semantic analysis for a generic type or method reference
- * with a bias to returning Type objects.
- */
-ILNode_SemAnalysisType(ILNode_GenericReference)
-{
- CSSemValue value;
- const char *name;
- int savedState=info->inSemType;
- char buffer[261];
-
- /* Get the type name with the generic arity appended */
- sprintf(buffer, "%s`%i",
- ILQualIdentName(node->identifier, 0),
- node->numArgs);
- name = buffer;
-
- info->inSemType = -1;
-
- /* Perform semantic analysis on the main part of the type */
- if(node->left)
- {
- CSSemValue value2;
-
- /* Get the semantic value for the left part of the identifier */
- value2 = ILNode_SemAnalysisType(node->left, info,
&(node->left));
-
- /* Resolve the member */
- value = CSResolveMemberName(info, (ILNode *)node, value2, name,
1);
- }
- else
- {
- value = CSResolveSimpleNameQuiet(info, (ILNode *)node, name, 1);
- }
- info->inSemType = savedState;
-
- if(CSSemGetKind(value) == CS_SEMKIND_TYPE)
- {
- ILType *withType;
- /* TODO: perform the analysis for the TypeActuals. */
-
- /* Build the "with" type and return it */
- withType = ILTypeCreateWith(info->context, CSSemGetType(value));
- if(!withType)
- {
- CCOutOfMemory();
- }
- CSSemWithType(node->typeArguments, info, &(node->typeArguments),
- withType);
- CSSemSetType(value, withType);
-
- /* Convert the result into an l-value or r-value and return it
*/
- return SemToLRValue((ILNode *)node, info, parent, value,
- name, node->left,
&value);
- }
- else if(CSSemGetKind(value) == CS_SEMKIND_TYPE_NODE)
- {
- /* TODO: perform the analysis for the TypeActuals. */
-
- /* Convert the result into an l-value or r-value and return it
*/
- return SemToLRValue((ILNode *)node, info, parent, value,
- name, node->left,
&value);
-
- }
- return CSSemValueDefault;
-}
-
-/*
- * Perform semantic analysis for a generic type or method reference.
- */
-ILNode_SemAnalysis(ILNode_GenericReference)
-{
- CSSemValue value;
- ILClass *classInfo;
- ILUInt32 numFormals;
- ILType *withType;
- const char *name;
- char buffer[261];
-
- /* Get the type name with the generic arity appended */
- sprintf(buffer, "%s`%i",
- ILQualIdentName(node->identifier, 0),
- node->numArgs);
- name = buffer;
-
- if(node->left)
- {
- CSSemValue value2;
-
- /* Get the semantic value for the left part of the identifier */
- value2 = ILNode_SemAnalysisType(node->left, info,
&(node->left));
-
- /* Resolve the member */
- value = CSResolveMemberName(info, (ILNode *)node, value2, name,
1);
- }
- else
- {
- value = CSResolveSimpleNameQuiet(info, (ILNode *)node, name, 1);
- }
- if(!CSSemIsType(value))
- {
- CCErrorOnLine(yygetfilename(node->identifier),
yygetlinenum(node->identifier),
- "type name expected in generic type
reference");
- return value;
- }
-
- /* Find the number of generic parameters that we expect */
- classInfo = ILClassResolve(ILTypeToClass(info, CSSemGetType(value)));
- numFormals = ILGenericParGetNumParams(ILToProgramItem(classInfo));
-
- /* Check the counts for consistency */
- /* TODO: This check is not correct for nested types. */
- if(numFormals != node->numArgs)
- {
- CCErrorOnLine(yygetfilename(node), yygetlinenum(node),
- "incorrect number of generic
parameters supplied to "
- "`%s'; was %d but should be %d",
- CSTypeToName(CSSemGetType(value)),
- (int)node->numArgs, (int)numFormals);
- }
-
- /* Build the "with" type and return it */
- withType = ILTypeCreateWith(info->context, CSSemGetType(value));
- if(!withType)
- {
- CCOutOfMemory();
- }
- CSSemWithType(node->typeArguments, info, &(node->typeArguments),
withType);
- CSSemSetType(value, withType);
- return value;
-}
%end %{
Index: cscc/java/java_gather.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/cscc/java/java_gather.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- cscc/java/java_gather.c 20 Sep 2007 20:04:17 -0000 1.3
+++ cscc/java/java_gather.c 19 Oct 2008 16:45:18 -0000 1.4
@@ -468,7 +468,7 @@
}
else if(yyisa(baseNode,ILNode_QualIdent))
{
-
baseName=ILQualIdentName(((ILNode_QualIdent*)baseNode)->right,0);
+ baseName=((ILNode_QualIdent*)baseNode)->name;
}
else
{
Index: cscc/java/java_grammar.y
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/cscc/java/java_grammar.y,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- cscc/java/java_grammar.y 20 Sep 2007 20:04:17 -0000 1.7
+++ cscc/java/java_grammar.y 19 Oct 2008 16:45:18 -0000 1.8
@@ -695,7 +695,9 @@
QualifiedIdentifier
: Identifier { $$ = $1; }
- | QualifiedIdentifier '.' Identifier { MakeBinary(QualIdent, $1,
$3); }
+ | QualifiedIdentifier '.' IDENTIFIER {
+ MakeBinary(QualIdent, $1, ILInternString($3,
strlen($3)).string);
+ }
;
QualifiedIdentifierList
Index: cscc/java/java_lvalue.tc
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/cscc/java/java_lvalue.tc,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- cscc/java/java_lvalue.tc 5 May 2007 15:56:42 -0000 1.2
+++ cscc/java/java_lvalue.tc 19 Oct 2008 16:45:18 -0000 1.3
@@ -677,7 +677,7 @@
value = ILNode_JSemAnalysis(node->left, info, &(node->left));
/* Resolve the member */
- name = ILQualIdentName(node->right, 0);
+ name = node->name;
value2 = JavaResolveMemberName(info, (ILNode *)node, value, name, 0);
/* Convert the result into an l-value or r-value and return it */
Index: cscc/vb/vb_grammar.y
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/cscc/vb/vb_grammar.y,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- cscc/vb/vb_grammar.y 20 Sep 2007 20:04:17 -0000 1.6
+++ cscc/vb/vb_grammar.y 19 Oct 2008 16:45:18 -0000 1.7
@@ -837,13 +837,13 @@
QualifiedIdentifier
: QualifiedIdentifier '.' IdentifierOrKeyword {
- $$ = ILNode_QualIdent_create($1, $3);
+ $$ = ILNode_QualIdent_create($1,
ILQualIdentGetName($3));
}
| Identifier
;
QualifiedIdentifier2
- : QualifiedIdentifier2 '.' Identifier {
+ : QualifiedIdentifier2 '.' IDENTIFIER {
$$ = ILNode_QualIdent_create($1, $3);
}
| Identifier
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [dotgnu-pnet-commits] pnet ChangeLog codegen/cg_lvalue.tc codegen/cg_...,
Klaus Treichel <=