Nice/src/bossa/syntax TypeScope.java,1.43,1.44

Artem Gr Kozarezov <[email protected]> Mon, 18 Apr 2005 19:05:01 +0000
Newsgroups gmane.comp.lang.nice.cvs
Message-ID <[email protected]>
Update of /cvsroot/nice/Nice/src/bossa/syntax
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20098/src/bossa/syntax

Modified Files:
	TypeScope.java 
Log Message:
A workaround for the situation when a class with a '$' in its name is searched for with '.' instead of '$'.

Index: TypeScope.java
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/syntax/TypeScope.java,v
retrieving revision 1.43
retrieving revision 1.44
diff -C2 -d -r1.43 -r1.44
*** TypeScope.java	6 Mar 2005 01:34:26 -0000	1.43
--- TypeScope.java	18 Apr 2005 19:04:58 -0000	1.44
***************
*** 106,110 ****
    TypeSymbol get(String name)
    {
!     return (TypeSymbol) map.get(name);
    }
  
--- 106,122 ----
    TypeSymbol get(String name)
    {
!     TypeSymbol typeSymbol = (TypeSymbol) map.get(name);
!     if (typeSymbol != null) return typeSymbol;
!     // A workaround required to find Nice classes having a '$' in the name.
!     // Such classes are placed into the scope with their correct name,
!     // but when looked up from the bytecode, the '$' is replaced with a '.'.
!     // Therefore we'll try to replace '.' back into '$'.
!     int dot; while (true) {
!       dot = name.lastIndexOf('.');
!       if (-1 == dot) return null;
!       name = name.substring(0,dot) + '$' + name.substring(dot+1);
!       typeSymbol = (TypeSymbol) map.get(name);
!       if (typeSymbol != null) return typeSymbol;
!     }
    }
  



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click