dotgnu-pnet-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Dotgnu-pnet-commits] CVS: pnet/cscc/csharp cs_grammar.y,1.35,1.36 cs_de


From: Gopal.V <address@hidden>
Subject: [Dotgnu-pnet-commits] CVS: pnet/cscc/csharp cs_grammar.y,1.35,1.36 cs_defs.tc,1.5,1.6
Date: Fri, 15 Nov 2002 15:26:30 -0500

Update of /cvsroot/dotgnu-pnet/pnet/cscc/csharp
In directory subversions:/tmp/cvs-serv6796/cscc/csharp

Modified Files:
        cs_grammar.y cs_defs.tc 
Log Message:
hopefully this should fixing using aliases


Index: cs_grammar.y
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/cscc/csharp/cs_grammar.y,v
retrieving revision 1.35
retrieving revision 1.36
diff -C2 -r1.35 -r1.36
*** cs_grammar.y        15 Nov 2002 12:50:57 -0000      1.35
--- cs_grammar.y        15 Nov 2002 20:26:27 -0000      1.36
***************
*** 66,69 ****
--- 66,70 ----
  static ILIntString CurrNamespace = {"", 0};
  static ILNode_Namespace *CurrNamespaceNode = 0;
+ static ILScope* localScope = 0;
  static int HaveDecls = 0;
  
***************
*** 96,104 ****
                CCGlobalScope = ILScopeCreate(&CCCodeGen, 0);
                ILScopeDeclareNamespace(CCGlobalScope, "System");
!               ILScopeUsing(CCGlobalScope, "System", 0);
                return CCGlobalScope;
        }
  }
  
  /*
   * Reset the global state ready for the next file to be parsed.
--- 97,121 ----
                CCGlobalScope = ILScopeCreate(&CCCodeGen, 0);
                ILScopeDeclareNamespace(CCGlobalScope, "System");
!               ILScopeUsing(CCGlobalScope, "System");
                return CCGlobalScope;
        }
  }
  
+ /* 
+  * Get the local scope
+  */
+ static ILScope *LocalScope(void)
+ {
+       if(localScope)
+       {
+               return localScope;
+       }
+       else
+       {
+               localScope = ILScopeCreate(&CCCodeGen, CCGlobalScope);
+               return localScope;
+       }
+ }
+ 
  /*
   * Reset the global state ready for the next file to be parsed.
***************
*** 110,113 ****
--- 127,131 ----
        CurrNamespaceNode = 0;
        HaveDecls = 0;
+       localScope = 0;
        ILScopeClearUsing(GlobalScope());
  }
***************
*** 1112,1115 ****
--- 1130,1134 ----
        : USING IDENTIFIER '=' QualifiedIdentifier ';'  {
                                ILScope *globalScope = GlobalScope();
+                               ILScope *scope = LocalScope();
                                ILNode *alias;
                                if(ILScopeLookup(globalScope, $2, 1))
***************
*** 1117,1129 ****
                                        CCError("`%s' is already declared", $2);
                                }
                                alias = ILNode_UsingAlias_create($2, 
ILQualIdentName($4,0));
-                               ILScopeDeclareAlias(globalScope, $2,alias,$4);
                                /* NOTE: CSSemGuard is not needed as 
ILNode_UsingAlias is
                                         never Semanalyzed */
                        }
        | USING NamespaceIdentifier ';'         {
                                ILScope *globalScope = GlobalScope();
                                ILNode_UsingNamespace *using;
!                               if(!ILScopeUsing(globalScope, $2.string, 0))
                                {
                                        CCError("`%s' is not a namespace", 
$2.string);
--- 1136,1154 ----
                                        CCError("`%s' is already declared", $2);
                                }
+                               else if(ILScopeLookup(localScope, $2, 1))
+                               {
+                                       CCError("`%s' is already declared", $2);
+                               }
                                alias = ILNode_UsingAlias_create($2, 
ILQualIdentName($4,0));
                                /* NOTE: CSSemGuard is not needed as 
ILNode_UsingAlias is
                                         never Semanalyzed */
+                               InitGlobalNamespace();
+                               ILScopeDeclareAlias(scope, $2,alias,$4);
+                               CurrNamespaceNode->localScope=scope;
                        }
        | USING NamespaceIdentifier ';'         {
                                ILScope *globalScope = GlobalScope();
                                ILNode_UsingNamespace *using;
!                               if(!ILScopeUsing(globalScope, $2.string))
                                {
                                        CCError("`%s' is not a namespace", 
$2.string);

Index: cs_defs.tc
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/cscc/csharp/cs_defs.tc,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** cs_defs.tc  15 Nov 2002 12:50:57 -0000      1.5
--- cs_defs.tc  15 Nov 2002 20:26:27 -0000      1.6
***************
*** 156,159 ****
--- 156,160 ----
        ILNode_Namespace *enclosing;
        %nocreate ILNode_UsingNamespace *using = {0};
+       %nocreate ILScope *localScope={0};
  }
  %node ILNode_UsingAlias ILNode_DummySem =





reply via email to

[Prev in Thread] Current Thread [Next in Thread]