[Nice-commit] Nice/src/bossa/syntax NiceMethod.java,1.39,1.40
Brought to you by:
bonniot
From: Daniel B. <bo...@us...> - 2004-06-17 10:41:23
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26637/src/bossa/syntax Modified Files: NiceMethod.java Log Message: Explicitly mark which methods are overrides in compiled packages, and use that information to speed up the loading of compiled packages. Index: NiceMethod.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/NiceMethod.java,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** NiceMethod.java 16 Jun 2004 14:56:14 -0000 1.39 --- NiceMethod.java 17 Jun 2004 10:41:13 -0000 1.40 *************** *** 160,168 **** super.resolve(); ! homonyms = Node.getGlobalScope().lookup(getName()); ! if (homonyms.size() == 1) ! homonyms = null; ! else ! homonyms.remove(getSymbol()); } --- 160,174 ---- super.resolve(); ! // In interface files, we can assume that if the method overrides ! // any other known method, there is an explicit override keyword. ! // So we can avoid looking for specializations when there isn't one. ! if (isOverride || ! module.interfaceFile()) ! { ! homonyms = Node.getGlobalScope().lookup(getName()); ! if (homonyms.size() == 1) ! homonyms = null; ! else ! homonyms.remove(getSymbol()); ! } } *************** *** 234,237 **** --- 240,250 ---- continue; + // In a compiled package, we don't need checking. + if (module.interfaceFile()) + { + addSpecializedMethod(d); + continue; + } + if (! Types.covariantSpecialization(getType(), s.getType())) { *************** *** 258,266 **** } ! if (specializedMethods == null) ! specializedMethods = new ArrayList ! // Heuristic: the maximum number that might be needed ! (homonyms.size() - i.previousIndex()); ! specializedMethods.add(d); } --- 271,275 ---- } ! addSpecializedMethod(d); } *************** *** 268,271 **** --- 277,288 ---- } + private void addSpecializedMethod(MethodDeclaration method) + { + if (specializedMethods == null) + specializedMethods = new ArrayList(5); + + specializedMethods.add(method); + } + /**************************************************************** * Code generation *************** *** 298,301 **** --- 315,320 ---- public void printInterface(java.io.PrintWriter s) { + if (specializedMethods != null) + s.print("override "); s.print(super.toString() + ";\n"); } |