[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Dotgnu-pnet-commits] CVS: pnet/codegen cg_scope.c,1.11,1.12 cg_scope.h,
From: |
Gopal.V <address@hidden> |
Subject: |
[Dotgnu-pnet-commits] CVS: pnet/codegen cg_scope.c,1.11,1.12 cg_scope.h,1.10,1.11 |
Date: |
Fri, 15 Nov 2002 07:50:59 -0500 |
Update of /cvsroot/dotgnu-pnet/pnet/codegen
In directory subversions:/tmp/cvs-serv12532/codegen
Modified Files:
cg_scope.c cg_scope.h
Log Message:
Enable use of global aliases
Index: cg_scope.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/codegen/cg_scope.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -r1.11 -r1.12
*** cg_scope.c 13 Aug 2002 00:21:55 -0000 1.11
--- cg_scope.c 15 Nov 2002 12:50:57 -0000 1.12
***************
*** 809,812 ****
--- 809,851 ----
}
+ /* Declare an alias to do name => valueNode mapping */
+ int ILScopeDeclareAlias(ILScope *scope, const char *name,
+ ILNode *node, ILNode *valueNode)
+ {
+ ILScopeData *data;
+
+ /* Determine if there is a declaration for the name already */
+ data = ILScopeLookup(scope, name, 0);
+ if(data != 0)
+ {
+ if(data->rbnode.kind == IL_SCOPE_DECLARED_TYPE)
+ {
+ /* Declaration conflicts with a type the user already
declared */
+ return IL_SCOPE_ERROR_REDECLARED;
+ }
+ else if(data->rbnode.kind == IL_SCOPE_SUBSCOPE)
+ {
+ /* There is already a namespace with that name in
existence */
+ return IL_SCOPE_ERROR_NAME_IS_NAMESPACE;
+ }
+ else if(data->rbnode.kind == IL_SCOPE_IMPORTED_TYPE)
+ {
+ /* Conflict with an imported type */
+ return IL_SCOPE_ERROR_IMPORT_CONFLICT;
+ }
+ else
+ {
+ /* Something else is declared here */
+ return IL_SCOPE_ERROR_OTHER;
+ }
+ }
+
+ /* Add the local to the scope */
+ AddToScope(scope, name, IL_SCOPE_ALIAS, node, (void*)valueNode, 0);
+
+ /* Done */
+ return IL_SCOPE_ERROR_OK;
+ }
+
int ILScopeDataGetKind(ILScopeData *data)
{
Index: cg_scope.h
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/codegen/cg_scope.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -r1.10 -r1.11
*** cg_scope.h 13 Aug 2002 00:21:55 -0000 1.10
--- cg_scope.h 15 Nov 2002 12:50:57 -0000 1.11
***************
*** 44,48 ****
#define IL_SCOPE_LOCAL 9 /* Item is a local
variable */
#define IL_SCOPE_LOCAL_CONST 10 /* Item is a local variable */
! #define IL_SCOPE_DUMMY 11 /* Used internally */
/*
--- 44,49 ----
#define IL_SCOPE_LOCAL 9 /* Item is a local
variable */
#define IL_SCOPE_LOCAL_CONST 10 /* Item is a local variable */
! #define IL_SCOPE_ALIAS 11 /* Item is a local
variable */
! #define IL_SCOPE_DUMMY 12 /* Used internally */
/*
***************
*** 154,157 ****
--- 155,163 ----
ILNode *guarded, ILNode *node);
+ /* Declare an alias in a particular scope, this returns a scope
+ * error if already declared.
+ */
+ int ILScopeDeclareAlias(ILScope *scope, const char *name,
+ ILNode *node, ILNode
*valueNode);
/*
* Get the kind value associated with a scope item.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Dotgnu-pnet-commits] CVS: pnet/codegen cg_scope.c,1.11,1.12 cg_scope.h,1.10,1.11,
Gopal.V <address@hidden> <=
- Prev by Date:
[Dotgnu-pnet-commits] CVS: pnet/cscc/csharp cs_lvalue.tc,1.24,1.25 cs_grammar.y,1.34,1.35 cs_lookup.c,1.15,1.16 cs_internal.h,1.12,1.13 cs_defs.tc,1.4,1.5
- Next by Date:
[Dotgnu-pnet-commits] CVS: pnetlib ChangeLog,1.445,1.446
- Previous by thread:
[Dotgnu-pnet-commits] CVS: pnet/cscc/csharp cs_lvalue.tc,1.24,1.25 cs_grammar.y,1.34,1.35 cs_lookup.c,1.15,1.16 cs_internal.h,1.12,1.13 cs_defs.tc,1.4,1.5
- Next by thread:
[Dotgnu-pnet-commits] CVS: pnetlib ChangeLog,1.445,1.446
- Index(es):