[Nice-commit] Nice/src/bossa/syntax overloadedsymbol.nice,1.16,1.17
Brought to you by:
bonniot
|
From: Daniel B. <bo...@us...> - 2005-04-04 12:21:58
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21253/src/bossa/syntax Modified Files: overloadedsymbol.nice Log Message: Whitespace cleanup. Index: overloadedsymbol.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/overloadedsymbol.nice,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** overloadedsymbol.nice 11 Mar 2005 17:35:52 -0000 1.16 --- overloadedsymbol.nice 4 Apr 2005 12:21:48 -0000 1.17 *************** *** 37,41 **** return createSymbolExp(symbols.get(0), this.location()); } ! private Expression uniqueExpression(VarSymbol sym, mlsub.typing.Polytype t) { --- 37,41 ---- return createSymbolExp(symbols.get(0), this.location()); } ! private Expression uniqueExpression(VarSymbol sym, mlsub.typing.Polytype t) { *************** *** 44,48 **** return res; } ! resolveOverloading(CallExp callExp) { --- 44,48 ---- return res; } ! resolveOverloading(CallExp callExp) { *************** *** 51,61 **** arguments.computeTypes(); ! if (bossa.util.Debug.overloading) bossa.util.Debug.println("Overloading resolution for " + this + "\nwith parameters " + arguments); // FIRST PASS: only checks the number of parameters ! ! // remembers removed symbols, // to list possibilities if none matches LinkedList<VarSymbol> removed = new LinkedList(); --- 51,61 ---- arguments.computeTypes(); ! if (bossa.util.Debug.overloading) bossa.util.Debug.println("Overloading resolution for " + this + "\nwith parameters " + arguments); // FIRST PASS: only checks the number of parameters ! ! // remembers removed symbols, // to list possibilities if none matches LinkedList<VarSymbol> removed = new LinkedList(); *************** *** 67,71 **** { let s = i.next(); ! if (s.isIgnored()) { --- 67,71 ---- { let s = i.next(); ! if (s.isIgnored()) { *************** *** 76,80 **** let case = s.match(arguments); ! if (case == 0) // Doesn't match { removed.add(s); --- 76,80 ---- let case = s.match(arguments); ! if (case == 0) // Doesn't match { removed.add(s); *************** *** 89,94 **** else // Should not happen { ! Internal.warning("Unknown O.R. case: " + s.getClass()); ! i.remove(); } } --- 89,94 ---- else // Should not happen { ! Internal.warning("Unknown O.R. case: " + s.getClass()); ! i.remove(); } } *************** *** 113,118 **** { let s = i.next(); ! ! if(bossa.util.Debug.overloading) bossa.util.Debug.println("Overloading: Trying with "+s); --- 113,118 ---- { let s = i.next(); ! ! if(bossa.util.Debug.overloading) bossa.util.Debug.println("Overloading: Trying with "+s); *************** *** 124,128 **** s.makeClonedType(); ! mlsub.typing.Polytype[] argsType = this.computeArgsType(notNull(arguments.getExpressions(s)), s.getClonedType(), arguments.getUsedArguments(s)); --- 124,128 ---- s.makeClonedType(); ! mlsub.typing.Polytype[] argsType = this.computeArgsType(notNull(arguments.getExpressions(s)), s.getClonedType(), arguments.getUsedArguments(s)); *************** *** 154,158 **** removeNonMinimal(symbols, arguments); removeOverlappingJavaMethods(symbols); ! if (symbols.size() == 1) { --- 154,158 ---- removeNonMinimal(symbols, arguments); removeOverlappingJavaMethods(symbols); ! if (symbols.size() == 1) { *************** *** 210,218 **** resolveOverloading(mlsub.typing.Polytype expectedType) { ! if(bossa.util.Debug.overloading) bossa.util.Debug.println("Overloading resolution (expected type " + expectedType + ") for " + this); ! // remembers removed symbols, // to list possibilities if none matches LinkedList<VarSymbol> removed = new LinkedList(); --- 210,218 ---- resolveOverloading(mlsub.typing.Polytype expectedType) { ! if(bossa.util.Debug.overloading) bossa.util.Debug.println("Overloading resolution (expected type " + expectedType + ") for " + this); ! // remembers removed symbols, // to list possibilities if none matches LinkedList<VarSymbol> removed = new LinkedList(); *************** *** 235,240 **** i.remove(); s.releaseClonedType(); ! if(bossa.util.Debug.overloading) ! bossa.util.Debug.println("Not "+s+" of type\n" + s.getClonedType() + "\nbecause "+e); } --- 235,240 ---- i.remove(); s.releaseClonedType(); ! if(bossa.util.Debug.overloading) ! bossa.util.Debug.println("Not "+s+" of type\n" + s.getClonedType() + "\nbecause "+e); } *************** *** 244,248 **** { let s = symbols[0]; ! let symType = s.getClonedType(); s.releaseClonedType(); return this.uniqueExpression(s, symType); --- 244,248 ---- { let s = symbols[0]; ! let symType = s.getClonedType(); s.releaseClonedType(); return this.uniqueExpression(s, symType); *************** *** 259,264 **** if (symbols.size() == 1) { ! let s = symbols[0]; ! let symType = s.getClonedType(); s.releaseClonedType(); symbols = nonMin; --- 259,264 ---- if (symbols.size() == 1) { ! let s = symbols[0]; ! let symType = s.getClonedType(); s.releaseClonedType(); symbols = nonMin; *************** *** 287,291 **** noOverloading() { ! if(bossa.util.Debug.overloading) bossa.util.Debug.println("(no)Overloading resolution for "+this); --- 287,291 ---- noOverloading() { ! if(bossa.util.Debug.overloading) bossa.util.Debug.println("(no)Overloading resolution for "+this); *************** *** 308,312 **** throw new AmbiguityError(this); ! throw User.error(this, "No variable or field in this class has name " + ident); } --- 308,312 ---- throw new AmbiguityError(this); ! throw User.error(this, "No variable or field in this class has name " + ident); } *************** *** 379,383 **** let sym = removed[0]; if (sym.isIgnored()) ! return sym.getName() + " cannot be used because it has been ignored.\n" + "See above for the reason why it has been ignored"; --- 379,383 ---- let sym = removed[0]; if (sym.isIgnored()) ! return sym.getName() + " cannot be used because it has been ignored.\n" + "See above for the reason why it has been ignored"; *************** *** 414,418 **** return ident + " has type " + removed[0].getType(); ! return "No symbol with name " + ident + " has type " + expectedType + ":\n" + Util.map("", "\n", "", removed); } --- 414,418 ---- return ident + " has type " + removed[0].getType(); ! return "No symbol with name " + ident + " has type " + expectedType + ":\n" + Util.map("", "\n", "", removed); } *************** *** 431,435 **** } ! private Expression createOverloadedSymbolExp(List<VarSymbol> symbols, LocatedString ident, boolean noImplicitThis) { --- 431,435 ---- } ! private Expression createOverloadedSymbolExp(List<VarSymbol> symbols, LocatedString ident, boolean noImplicitThis) { *************** *** 450,456 **** new AmbiguityError(OverloadedSymbolExp sym) { ! this(sym, ! "Ambiguity for symbol " + sym.ident + ! ". Possibilities are :\n" + Util.map("", "\n", "", sym.symbols)); } --- 450,456 ---- new AmbiguityError(OverloadedSymbolExp sym) { ! this(sym, ! "Ambiguity for symbol " + sym.ident + ! ". Possibilities are :\n" + Util.map("", "\n", "", sym.symbols)); } *************** *** 462,474 **** if(symbols.size()<2) return removed; ! int len = symbols.size(); List<VarSymbol> syms = new ArrayList(symbols); boolean[] remove = new boolean[len]; ! for(int s1 = 0; s1<len; s1++) { mlsub.typing.Domain d1 = nice.tools.typing.Types.domain(syms[s1].getType()); ! for(int s2 = 0; s2<len; s2++) /* --- 462,474 ---- if(symbols.size()<2) return removed; ! int len = symbols.size(); List<VarSymbol> syms = new ArrayList(symbols); boolean[] remove = new boolean[len]; ! for(int s1 = 0; s1<len; s1++) { mlsub.typing.Domain d1 = nice.tools.typing.Types.domain(syms[s1].getType()); ! for(int s2 = 0; s2<len; s2++) /* *************** *** 506,510 **** if (bossa.util.Debug.overloading) bossa.util.Debug.println("Removing " + syms[i] + " since it is not minimal"); ! removed.add(syms[i]); symbols.remove(syms[i]); --- 506,510 ---- if (bossa.util.Debug.overloading) bossa.util.Debug.println("Removing " + syms[i] + " since it is not minimal"); ! removed.add(syms[i]); symbols.remove(syms[i]); *************** *** 521,525 **** * removoNonMinimal will remove s1. * ! * This allows for java-style overloading, * where the most precise method is choosen at compile-time. */ --- 521,525 ---- * removoNonMinimal will remove s1. * ! * This allows for java-style overloading, * where the most precise method is choosen at compile-time. */ *************** *** 529,542 **** if(symbols.size()<2) return; ! int len = symbols.size(); List<VarSymbol> syms = new ArrayList(symbols); boolean[] remove = new boolean[len]; ! for(int s1 = 0; s1<len; s1++) { ! mlsub.typing.Domain d1 = domain(syms[s1].getClonedType(), ! arguments.getUsedArguments(syms[s1])); ! for(int s2 = 0; s2<len; s2++) /* --- 529,542 ---- if(symbols.size()<2) return; ! int len = symbols.size(); List<VarSymbol> syms = new ArrayList(symbols); boolean[] remove = new boolean[len]; ! for(int s1 = 0; s1<len; s1++) { ! mlsub.typing.Domain d1 = domain(syms[s1].getClonedType(), ! arguments.getUsedArguments(syms[s1])); ! for(int s2 = 0; s2<len; s2++) /* *************** *** 551,555 **** if (s1 != s2 && !remove[s2]) { ! mlsub.typing.Domain d2 = domain(syms[s2].getClonedType(), arguments.getUsedArguments(syms[s2])); --- 551,555 ---- if (s1 != s2 && !remove[s2]) { ! mlsub.typing.Domain d2 = domain(syms[s2].getClonedType(), arguments.getUsedArguments(syms[s2])); *************** *** 574,578 **** if (bossa.util.Debug.overloading) bossa.util.Debug.println("Removing " + syms[i] + " since it is not minimal"); ! syms[i].releaseClonedType(); symbols.remove(syms[i]); --- 574,578 ---- if (bossa.util.Debug.overloading) bossa.util.Debug.println("Removing " + syms[i] + " since it is not minimal"); ! syms[i].releaseClonedType(); symbols.remove(syms[i]); *************** *** 607,611 **** there is no ambiguity between methods of the same signature defined in both interfaces, since they are implemented by the same ! method in the class. So this method removes all but one of the overlapping methods. */ --- 607,611 ---- there is no ambiguity between methods of the same signature defined in both interfaces, since they are implemented by the same ! method in the class. So this method removes all but one of the overlapping methods. */ *************** *** 615,619 **** if(symbols.size()<2) return; ! int len = symbols.size(); List<VarSymbol> syms = new ArrayList(symbols); --- 615,619 ---- if(symbols.size()<2) return; ! int len = symbols.size(); List<VarSymbol> syms = new ArrayList(symbols); |