nice-commit Mailing List for The Nice Programming Language (Page 23)
Brought to you by:
bonniot
You can subscribe to this list here.
2003 |
Jan
|
Feb
(60) |
Mar
(125) |
Apr
(183) |
May
(140) |
Jun
(227) |
Jul
(141) |
Aug
(181) |
Sep
(75) |
Oct
(89) |
Nov
(187) |
Dec
(162) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(69) |
Feb
(197) |
Mar
(98) |
Apr
(26) |
May
(10) |
Jun
(85) |
Jul
(88) |
Aug
(79) |
Sep
(80) |
Oct
(81) |
Nov
(53) |
Dec
(109) |
2005 |
Jan
(68) |
Feb
(77) |
Mar
(232) |
Apr
(79) |
May
(37) |
Jun
(37) |
Jul
(3) |
Aug
(18) |
Sep
|
Oct
|
Nov
|
Dec
|
2006 |
Jan
(10) |
Feb
|
Mar
(4) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
(1) |
Dec
(9) |
2007 |
Jan
(2) |
Feb
(8) |
Mar
(2) |
Apr
(5) |
May
|
Jun
|
Jul
|
Aug
(4) |
Sep
|
Oct
|
Nov
(17) |
Dec
(6) |
2008 |
Jan
|
Feb
(3) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2011 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29296/F:/nice/src/bossa/syntax Modified Files: Symbol.java ai.nice alternative.nice analyse.nice codegen.nice compilation.nice constant.nice customConstructor.nice dispatchTest.nice enum.nice globalvar.nice increment.nice javaMethod.nice locals.nice monotype.nice niceclass.nice nicefield.nice pattern.nice primitive.nice rewrite.nice super.nice symbol.nice symbolexp.nice tools.nice typeConstructors.nice typecheck.nice typedef.nice Log Message: Conversion cleanup part 2. Index: nicefield.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/nicefield.nice,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** nicefield.nice 14 Jan 2005 11:12:11 -0000 1.5 --- nicefield.nice 14 Jan 2005 22:47:11 -0000 1.6 *************** *** 95,99 **** { let decl = declaringClass.classe.addField ! (sym.name.toString(), nice.tools.code.Types.javaType(sym.type)); method.fieldDecl = decl; decl.setFlag(isFinal_, gnu.expr.Declaration.IS_CONSTANT); --- 95,99 ---- { let decl = declaringClass.classe.addField ! (sym.getName().toString(), nice.tools.code.Types.javaType(sym.type)); method.fieldDecl = decl; decl.setFlag(isFinal_, gnu.expr.Declaration.IS_CONSTANT); Index: compilation.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/compilation.nice,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** compilation.nice 14 Jan 2005 11:12:10 -0000 1.5 --- compilation.nice 14 Jan 2005 22:47:11 -0000 1.6 *************** *** 142,146 **** { ?mlsub.typing.TypeConstructor firstArgument = alt.getPatterns()[0].getTC(); ! let def = firstArgument==null ? null : getTypeDefinition(firstArgument); if (def != null && def.getImplementation() instanceof NiceClass) --- 142,146 ---- { ?mlsub.typing.TypeConstructor firstArgument = alt.getPatterns()[0].getTC(); ! let def = getTypeDefinition(firstArgument); if (def != null && def.getImplementation() instanceof NiceClass) Index: niceclass.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/niceclass.nice,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** niceclass.nice 14 Jan 2005 16:41:27 -0000 1.20 --- niceclass.nice 14 Jan 2005 22:47:11 -0000 1.21 *************** *** 407,411 **** for (msym : constructors) { ! let MethodDeclaration m = notNull(msym.getMethodDeclaration()); // Only consider parent methods for which a call from this class --- 407,411 ---- for (msym : constructors) { ! let m = msym.getMethodDeclaration(); // Only consider parent methods for which a call from this class *************** *** 454,458 **** for (msym : constructors) { ! let MethodDeclaration decl = notNull(msym.getMethodDeclaration()); res.add((decl, notNull(decl.formalParameters()).getParameters(scope))); } --- 454,458 ---- for (msym : constructors) { ! let decl = msym.getMethodDeclaration(); res.add((decl, notNull(decl.formalParameters()).getParameters(scope))); } *************** *** 728,732 **** let allAtoms = new mlsub.typing.AtomicConstraint[n + typeParameters.length * 2]; if (n > 0) ! System.arraycopy(atoms, 0, allAtoms, 2 * typeParameters.length, n); for(int i = 0; i < typeParameters.length; i++) --- 728,732 ---- let allAtoms = new mlsub.typing.AtomicConstraint[n + typeParameters.length * 2]; if (n > 0) ! System.arraycopy(notNull(atoms), 0, allAtoms, 2 * typeParameters.length, n); for(int i = 0; i < typeParameters.length; i++) Index: customConstructor.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/customConstructor.nice,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** customConstructor.nice 14 Jan 2005 16:41:27 -0000 1.18 --- customConstructor.nice 14 Jan 2005 22:47:11 -0000 1.19 *************** *** 185,186 **** --- 185,228 ---- return res; } + + void resolveCCThis(Statement stmt, Located thisLoc, NiceClass classe) + { + void missingThisError() + { + User.error(thisLoc, "The last statement must be a call to 'this' constructor"); + } + + Block block = cast(stmt); + + if (block.statements.length == 0) + missingThisError(); + + Statement last = block.last; + if (last instanceof Block) + { + resolveCCThis(last, thisLoc, classe); + return; + } + + if (! (last instanceof ExpressionStmt)) + missingThisError(); + + ExpressionStmt expstmt = cast(last); + + if (! (expstmt.exp instanceof CallExp)) + missingThisError(); + + CallExp call = cast(expstmt.exp); + + if (! (call.function instanceof IdentExp)) + missingThisError(); + + IdentExp ident = cast(call.function); + + if (! ident.toString().equals("this")) + missingThisError(); + + call.function = createOverloadedSymbolExp(new ArrayList(cast(classe).getConstructorCallSymbols()), + thisName); + call.function.setLocation(ident.location()); + } Index: typecheck.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/typecheck.nice,v retrieving revision 1.121 retrieving revision 1.122 diff -C2 -d -r1.121 -r1.122 *** typecheck.nice 11 Jan 2005 21:45:46 -0000 1.121 --- typecheck.nice 14 Jan 2005 22:47:11 -0000 1.122 *************** *** 712,718 **** catch(TypingEx t){ reportNullAssignmentError(decl, t, value: value, ! target.name.toString(), notNull(target.getMonotype())); ! throw assignmentError(target, target.name.toString(), String.valueOf(target.getMonotype), value); --- 712,718 ---- catch(TypingEx t){ reportNullAssignmentError(decl, t, value: value, ! target.getName.toString(), notNull(target.getMonotype())); ! throw assignmentError(target, target.getName().toString(), String.valueOf(target.getMonotype), value); *************** *** 788,794 **** catch(TypingEx t){ reportNullAssignmentError(decl, t, value: value, ! target.name.toString(), notNull(target.getMonotype())); ! throw assignmentError(target, target.name.toString(), String.valueOf(target.getMonotype), value); --- 788,794 ---- catch(TypingEx t){ reportNullAssignmentError(decl, t, value: value, ! target.getName().toString(), notNull(target.getMonotype())); ! throw assignmentError(target, target.getName().toString(), String.valueOf(target.getMonotype), value); Index: super.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/super.nice,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** super.nice 14 Jan 2005 11:12:11 -0000 1.10 --- super.nice 14 Jan 2005 22:47:11 -0000 1.11 *************** *** 88,92 **** private void getSuper(JavaMethod decl) { ! gnu.bytecode.Type firstArg = nice.tools.code.Types.get(notNull(currentMethod).firstArgument()); if (! (firstArg instanceof gnu.bytecode.ClassType)) --- 88,92 ---- private void getSuper(JavaMethod decl) { ! let firstArg = nice.tools.code.Types.get(notNull(currentMethod).firstArgument()); if (! (firstArg instanceof gnu.bytecode.ClassType)) Index: locals.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/locals.nice,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** locals.nice 14 Jan 2005 16:41:27 -0000 1.8 --- locals.nice 14 Jan 2005 22:47:11 -0000 1.9 *************** *** 28,32 **** } ! location() = this.getSymbol().name.location(); gnu.expr.Expression compile(gnu.expr.LetExp letExp) --- 28,32 ---- } ! location() = notNull(this.getSymbol().name).location(); gnu.expr.Expression compile(gnu.expr.LetExp letExp) *************** *** 93,97 **** LocalVariableSymbol left; ! getName() = left.name.toString(); getSymbol() = left; getBytecodeType() = nice.tools.code.Types.javaType(left.type); --- 93,97 ---- LocalVariableSymbol left; ! getName() = notNull(left.name).toString(); getSymbol() = left; getBytecodeType() = nice.tools.code.Types.javaType(left.type); *************** *** 152,156 **** MonoSymbol left; ! getName() = left.name.toString(); getSymbol() = left; getBytecodeType() = nice.tools.code.Types.javaType(left.type); --- 152,156 ---- MonoSymbol left; ! getName() = notNull(left.name).toString(); getSymbol() = left; getBytecodeType() = nice.tools.code.Types.javaType(left.type); *************** *** 185,189 **** FormalParameters parameters; ! getName() = left.name.toString(); getSymbol() = left; getBytecodeType() = nice.tools.code.Types.javaType(left.type); --- 185,189 ---- FormalParameters parameters; ! getName() = notNull(left.name).toString(); getSymbol() = left; getBytecodeType() = nice.tools.code.Types.javaType(left.type); Index: monotype.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/monotype.nice,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** monotype.nice 13 Jan 2005 23:56:06 -0000 1.9 --- monotype.nice 14 Jan 2005 22:47:11 -0000 1.10 *************** *** 206,210 **** Monotype res = createMonotypeConstructor (notNull(tc), ! new TypeParameters(content: notNull(parameters.content).mapToArray(Monotype t => t.substitute(map))), loc); res.nullness = this.nullness; --- 206,210 ---- Monotype res = createMonotypeConstructor (notNull(tc), ! new TypeParameters(content: parameters.content.mapToArray(Monotype t => t.substitute(map))), loc); res.nullness = this.nullness; *************** *** 212,216 **** } ! containsAlike() = notNull(parameters.content).any(Monotype t => t.containsAlike()); public ?TypeIdent getTC() = tc; --- 212,216 ---- } ! containsAlike() = parameters.content.any(Monotype t => t.containsAlike()); public ?TypeIdent getTC() = tc; Index: symbolexp.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/symbolexp.nice,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** symbolexp.nice 3 Jan 2005 01:24:28 -0000 1.3 --- symbolexp.nice 14 Jan 2005 22:47:11 -0000 1.4 *************** *** 80,87 **** public LocatedString getName() { ! return symbol.name; } ! toString() = symbol.name.toQuotedString(); } --- 80,87 ---- public LocatedString getName() { ! return symbol.getName(); } ! toString() = symbol.getName().toQuotedString(); } Index: alternative.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/alternative.nice,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** alternative.nice 14 Jan 2005 16:41:27 -0000 1.7 --- alternative.nice 14 Jan 2005 22:47:11 -0000 1.8 *************** *** 38,42 **** * Tests the matching of tags against a method alternative. */ ! public boolean matches(TypeConstructor[] tags) { for(int i = 0; i < patterns.length; i++) --- 38,42 ---- * Tests the matching of tags against a method alternative. */ ! public boolean matches(?TypeConstructor[] tags) { for(int i = 0; i < patterns.length; i++) *************** *** 47,51 **** } ! public boolean matchesTypePart(TypeConstructor[] tags, boolean[] isValue) { for(int i = 0; i < patterns.length; i++) --- 47,51 ---- } ! public boolean matchesTypePart(?TypeConstructor[] tags, boolean[] isValue) { for(int i = 0; i < patterns.length; i++) Index: Symbol.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/Symbol.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Symbol.java 13 Jan 2005 16:47:33 -0000 1.1 --- Symbol.java 14 Jan 2005 22:47:11 -0000 1.2 *************** *** 27,31 **** } ! LocatedString name; // commenting this triggers a bug --- 27,31 ---- } ! final LocatedString name; // commenting this triggers a bug Index: analyse.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/analyse.nice,v retrieving revision 1.126 retrieving revision 1.127 diff -C2 -d -r1.126 -r1.127 *** analyse.nice 14 Jan 2005 16:41:27 -0000 1.126 --- analyse.nice 14 Jan 2005 22:47:11 -0000 1.127 *************** *** 198,202 **** this.checkNotDefined(symbol); ! this.vars[symbol.name.toString()] = symbol; } --- 198,202 ---- this.checkNotDefined(symbol); ! this.vars[notNull(symbol.name).toString()] = symbol; } *************** *** 216,220 **** this.checkNotDefined(symbol); ! this.vars[symbol.name.toString()] = symbol; symbol.depth = this.depth; } --- 216,220 ---- this.checkNotDefined(symbol); ! this.vars[notNull(symbol.name).toString()] = symbol; symbol.depth = this.depth; } *************** *** 228,232 **** void checkNotDefined(VarSymbol symbol) { ! ?VarSymbol old = this.vars[symbol.name.toString()]; if (old != null) throw error(symbol, "Symbol " + symbol.name + " is already defined.\n" + --- 228,232 ---- void checkNotDefined(VarSymbol symbol) { ! ?VarSymbol old = this.vars[notNull(symbol.name).toString()]; if (old != null) throw error(symbol, "Symbol " + symbol.name + " is already defined.\n" + *************** *** 276,280 **** analyseAssigned(TupleExp e, info) { ! Expression[] es = notNull(e.expressions); for (int i = 0; i < es.length; i++) es[i] = es[i].analyseAssigned(info); --- 276,280 ---- analyseAssigned(TupleExp e, info) { ! Expression[] es = e.expressions; for (int i = 0; i < es.length; i++) es[i] = es[i].analyseAssigned(info); *************** *** 329,333 **** if (e.infix) ! markAsCallFirstArg(notNull(args.getExp(0))); List<ExpLocalVariable> expLocals = new ArrayList(); --- 329,333 ---- if (e.infix) ! markAsCallFirstArg(args.getExp(0)); List<ExpLocalVariable> expLocals = new ArrayList(); *************** *** 366,370 **** if (nextComponent == null) ! throw unknownIdent(notNull(pkg.locatedName())); return createTypeConstantExp(pkg, nextComponent); --- 366,370 ---- if (nextComponent == null) ! throw unknownIdent(pkg.locatedName()); return createTypeConstantExp(pkg, nextComponent); *************** *** 390,395 **** ?LocatedString funName = identString(e.function); if (funName == null) ! throw notNull(bossa.util.Internal.error ! (e.function, "This is not a valid class member")); int arity = args.size(); --- 390,394 ---- ?LocatedString funName = identString(e.function); if (funName == null) ! throw Internal.error(e.function, "This is not a valid class member"); int arity = args.size(); *************** *** 481,485 **** if (!e.isInfix()) // infix symbols can only come from the global scope { ! ?VarSymbol sym = info.lookup(notNull(e.ident).toString()); if (sym != null) --- 480,484 ---- if (!e.isInfix()) // infix symbols can only come from the global scope { ! ?VarSymbol sym = info.lookup(e.ident.toString()); if (sym != null) *************** *** 502,506 **** if (e.alwaysOverloadedSymbol) ! return createOverloadedSymbolExp(sym, notNull(e.ident)); else return createSymbolExp(sym, e.location()); --- 501,505 ---- if (e.alwaysOverloadedSymbol) ! return createOverloadedSymbolExp(sym, e.ident); else return createSymbolExp(sym, e.location()); *************** *** 512,516 **** symbols = cast(notNull(Node.getGlobalScope()).lookup(e.ident)); else ! symbols = info.globalLookup(notNull(e.ident)); if (symbols != null && symbols.size() > 0) --- 511,515 ---- symbols = cast(notNull(Node.getGlobalScope()).lookup(e.ident)); else ! symbols = info.globalLookup(e.ident); if (symbols != null && symbols.size() > 0) *************** *** 533,537 **** if (sym.isNonStaticFieldAccess() && Node.thisExp != null) { ! CallExp res = new CallExp(function: createOverloadedSymbolExp(symbols, notNull(e.ident)), arguments: new Arguments(arguments: [new Argument(value: notNull(Node.thisExp))])); res.setLocation(e.location()); --- 532,536 ---- if (sym.isNonStaticFieldAccess() && Node.thisExp != null) { ! CallExp res = new CallExp(function: createOverloadedSymbolExp(symbols, e.ident), arguments: new Arguments(arguments: [new Argument(value: notNull(Node.thisExp))])); res.setLocation(e.location()); *************** *** 542,546 **** { // Make an implicit call to fetch the static field's value. ! CallExp res = new CallExp(function: createOverloadedSymbolExp(symbols, notNull(e.ident)), arguments: new Arguments(arguments: [])); res.setLocation(e.location()); --- 541,545 ---- { // Make an implicit call to fetch the static field's value. ! CallExp res = new CallExp(function: createOverloadedSymbolExp(symbols, e.ident), arguments: new Arguments(arguments: [])); res.setLocation(e.location()); *************** *** 551,561 **** } else ! return createOverloadedSymbolExp(symbols, notNull(e.ident)); } if (e.enableClassExp) ! return createTypeConstantExp(null, notNull(e.ident)); ! throw unknownIdent(notNull(e.ident)); } --- 550,560 ---- } else ! return createOverloadedSymbolExp(symbols, e.ident); } if (e.enableClassExp) ! return createTypeConstantExp(null, e.ident); ! throw unknownIdent(e.ident); } *************** *** 728,732 **** { info.begin(); ! notNull(b.locals).foreach(LocalDeclaration l => analyse(l, info)); analyse(b.statements, info); info.end(); --- 727,731 ---- { info.begin(); ! b.locals.foreach(LocalDeclaration l => analyse(l, info)); analyse(b.statements, info); info.end(); Index: primitive.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/primitive.nice,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** primitive.nice 1 Dec 2004 02:00:32 -0000 1.1 --- primitive.nice 14 Jan 2005 22:47:11 -0000 1.2 *************** *** 33,37 **** ?gnu.bytecode.Type t = nice.tools.typing.PrimitiveType.register(definition.name.toString(), definition.getTC()); if (t == null) ! User.error(definition, definition.name + " is not a known primitive type"); definition.setJavaType(t); return new PrimitiveTypeImplementation(); --- 33,38 ---- ?gnu.bytecode.Type t = nice.tools.typing.PrimitiveType.register(definition.name.toString(), definition.getTC()); if (t == null) ! throw User.error(definition, definition.name + " is not a known primitive type"); ! definition.setJavaType(t); return new PrimitiveTypeImplementation(); Index: pattern.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/pattern.nice,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** pattern.nice 14 Jan 2005 16:41:27 -0000 1.16 --- pattern.nice 14 Jan 2005 22:47:11 -0000 1.17 *************** *** 76,83 **** // Class constraints ! if (tc == null) ! return; ! ! let def = getTypeDefinition(notNull(tc)); if (def == null) return; --- 76,80 ---- // Class constraints ! let def = getTypeDefinition(tc); if (def == null) return; *************** *** 479,483 **** let EnumSymbol esym = cast(atValue.value); for (sym : esym.getDefinition().symbols) ! values.add(createSymbolConstantExp(notNull(tc), sym, sym.name.toString(), this.location)); } --- 476,480 ---- let EnumSymbol esym = cast(atValue.value); for (sym : esym.getDefinition().symbols) ! values.add(createSymbolConstantExp(notNull(tc), sym, sym.getName().toString(), this.location)); } Index: codegen.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/codegen.nice,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** codegen.nice 13 Jan 2005 14:06:15 -0000 1.1 --- codegen.nice 14 Jan 2005 22:47:11 -0000 1.2 *************** *** 66,70 **** (gnu.expr.LambdaExp lexp, ?String bytecodeName, ! gnu.bytecode.Type[] argTypes, gnu.bytecode.Type retType, MonoSymbol[?] args, --- 66,70 ---- (gnu.expr.LambdaExp lexp, ?String bytecodeName, ! gnu.bytecode.Type[?] argTypes, gnu.bytecode.Type retType, MonoSymbol[?] args, *************** *** 89,95 **** { boolean isThis = member && n == 0; ! String parameterName = notNull(args)[n].getName() == null ? "anonymous_" + n ! : notNull(notNull(args)[n].getName()).toString(); gnu.expr.Declaration d; --- 89,95 ---- { boolean isThis = member && n == 0; ! String parameterName = notNull(args)[n].name == null ? "anonymous_" + n ! : notNull(notNull(args)[n].name).toString(); gnu.expr.Declaration d; Index: dispatchTest.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/dispatchTest.nice,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** dispatchTest.nice 14 Jan 2005 11:12:10 -0000 1.6 --- dispatchTest.nice 14 Jan 2005 22:47:11 -0000 1.7 *************** *** 15,19 **** import bossa.util.*; ! List<mlsub.typing.TypeConstructor[]> enumerate(?mlsub.typing.Constraint, mlsub.typing.lowlevel.Element[], boolean[]) = native List mlsub.typing.Enumeration.enumerate(mlsub.typing.Constraint, mlsub.typing.lowlevel.Element[], boolean[]); /** --- 15,19 ---- import bossa.util.*; ! List<?mlsub.typing.TypeConstructor[]> enumerate(?mlsub.typing.Constraint, mlsub.typing.lowlevel.Element[], boolean[]) = native List mlsub.typing.Enumeration.enumerate(mlsub.typing.Constraint, mlsub.typing.lowlevel.Element[], boolean[]); /** *************** *** 201,205 **** throw Internal.error(method + " is not in a proper state."); ! List<mlsub.typing.TypeConstructor[]> multitags = enumerateTags(type, used); boolean[] isValue = new boolean[method.getArity()]; --- 201,205 ---- throw Internal.error(method + " is not in a proper state."); ! List<?mlsub.typing.TypeConstructor[]> multitags = enumerateTags(type, used); boolean[] isValue = new boolean[method.getArity()]; *************** *** 236,240 **** } ! private ?gnu.bytecode.ClassType classTypeOfNiceClass(mlsub.typing.TypeConstructor tc) { let def = getTypeDefinition(tc); --- 236,240 ---- } ! private ?gnu.bytecode.ClassType classTypeOfNiceClass(?mlsub.typing.TypeConstructor tc) { let def = getTypeDefinition(tc); *************** *** 257,261 **** */ private boolean testTypes(MethodDeclaration method, ! mlsub.typing.TypeConstructor[] tags, Stack<Alternative> sortedAlternatives, ?gnu.bytecode.ClassType firstArg, --- 257,261 ---- */ private boolean testTypes(MethodDeclaration method, ! ?mlsub.typing.TypeConstructor[] tags, Stack<Alternative> sortedAlternatives, ?gnu.bytecode.ClassType firstArg, *************** *** 311,315 **** private boolean testValues (MethodDeclaration method, ! mlsub.typing.TypeConstructor[] tags, List<?ConstantExp[]> valueCombis, boolean[] isValue, --- 311,315 ---- private boolean testValues (MethodDeclaration method, ! ?mlsub.typing.TypeConstructor[] tags, List<?ConstantExp[]> valueCombis, boolean[] isValue, *************** *** 353,357 **** } ! private String tagsToString(mlsub.typing.TypeConstructor[] tags) { let res = new StringBuffer(); --- 353,357 ---- } ! private String tagsToString(?mlsub.typing.TypeConstructor[] tags) { let res = new StringBuffer(); *************** *** 366,370 **** } ! private String tagsToString(mlsub.typing.TypeConstructor[] tags, ?ConstantExp[] values, boolean[] isValue) { let res = new StringBuffer(); --- 366,370 ---- } ! private String tagsToString(?mlsub.typing.TypeConstructor[] tags, ?ConstantExp[] values, boolean[] isValue) { let res = new StringBuffer(); *************** *** 390,394 **** PrimtiveType.nullTC if it can be matched by @null **/ ! private List<mlsub.typing.TypeConstructor[]> enumerateTags(mlsub.typing.Polytype type, boolean[] used) { mlsub.typing.Monotype[] domains = type.domain(); --- 390,394 ---- PrimtiveType.nullTC if it can be matched by @null **/ ! private List<?mlsub.typing.TypeConstructor[]> enumerateTags(mlsub.typing.Polytype type, boolean[] used) { mlsub.typing.Monotype[] domains = type.domain(); *************** *** 430,434 **** throw new Error(); ! List<mlsub.typing.TypeConstructor[]> res = mlsub.typing.Enumeration.enumerate(cst, types, used); return mergeNullCases(res, domains.length); } --- 430,434 ---- throw new Error(); ! List<?mlsub.typing.TypeConstructor[]> res = mlsub.typing.Enumeration.enumerate(cst, types, used); return mergeNullCases(res, domains.length); } *************** *** 441,451 **** alternatively a nullness marker TC and a normal TC */ ! private List<mlsub.typing.TypeConstructor[]> mergeNullCases(List<mlsub.typing.TypeConstructor[]> tuples, int length) { ! LinkedList<mlsub.typing.TypeConstructor[]> res = new LinkedList(); ! Set<mlsub.typing.TypeConstructor[]> tupleSet = new TreeSet(tagComp); for (tuple : tuples) { ! mlsub.typing.TypeConstructor[] tags = flattenTags(tuple, length); //add only non duplicate tags if (tupleSet.add(tags)) --- 441,451 ---- alternatively a nullness marker TC and a normal TC */ ! private List<?mlsub.typing.TypeConstructor[]> mergeNullCases(List<?mlsub.typing.TypeConstructor[]> tuples, int length) { ! LinkedList<?mlsub.typing.TypeConstructor[]> res = new LinkedList(); ! Set<?mlsub.typing.TypeConstructor[]> tupleSet = new TreeSet(tagComp); for (tuple : tuples) { ! ?mlsub.typing.TypeConstructor[] tags = flattenTags(tuple, length); //add only non duplicate tags if (tupleSet.add(tags)) *************** *** 455,459 **** } ! private let Comparator<mlsub.typing.TypeConstructor[]> tagComp = new TagComparator(); private class TagComparator<-T> implements Comparator<T> --- 455,459 ---- } ! private let Comparator<?mlsub.typing.TypeConstructor[]> tagComp = new TagComparator(); private class TagComparator<-T> implements Comparator<T> *************** *** 461,466 **** compare(o1, o2) { ! mlsub.typing.TypeConstructor[] tc1 = cast(o1); ! mlsub.typing.TypeConstructor[] tc2 = cast(o2); for(int i = 0; i<tc1.length; i++) --- 461,466 ---- compare(o1, o2) { ! ?mlsub.typing.TypeConstructor[] tc1 = cast(o1); ! ?mlsub.typing.TypeConstructor[] tc2 = cast(o2); for(int i = 0; i<tc1.length; i++) *************** *** 473,478 **** if (tc2[i] == null) return 1; ! int a = tc1[i].getId(); ! int b = tc2[i].getId(); if (a<b) return -1; --- 473,478 ---- if (tc2[i] == null) return 1; ! int a = notNull(tc1[i]).getId(); ! int b = notNull(tc2[i]).getId(); if (a<b) return -1; *************** *** 497,503 **** alternatively a nullness marker TC and a normal TC */ ! private mlsub.typing.TypeConstructor[] flattenTags(mlsub.typing.TypeConstructor[] tags, int length) { ! mlsub.typing.TypeConstructor[] res = cast(new mlsub.typing.TypeConstructor[length]); for (int i = length; --i >= 0 ;) if (tags[2 * i] == nice.tools.typing.PrimitiveType.nullTC) --- 497,503 ---- alternatively a nullness marker TC and a normal TC */ ! private ?mlsub.typing.TypeConstructor[] flattenTags(?mlsub.typing.TypeConstructor[] tags, int length) { ! ?mlsub.typing.TypeConstructor[] res = new mlsub.typing.TypeConstructor[length]; for (int i = length; --i >= 0 ;) if (tags[2 * i] == nice.tools.typing.PrimitiveType.nullTC) Index: ai.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/ai.nice,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ai.nice 5 Jan 2005 02:02:43 -0000 1.4 --- ai.nice 14 Jan 2005 22:47:11 -0000 1.5 *************** *** 117,121 **** interfaceITF = ident.resolveToItf(notNull(typeScope)); ! let def = getTypeDefinition(notNull(classTC)); boolean isNiceClass = def != null && --- 117,121 ---- interfaceITF = ident.resolveToItf(notNull(typeScope)); ! let def = getTypeDefinition(classTC); boolean isNiceClass = def != null && *************** *** 127,131 **** if (def != null) ! def.addInterfaceImplementation(interfaceITF); this.createContext(); --- 127,131 ---- if (def != null) ! def.addInterfaceImplementation(notNull(interfaceITF)); this.createContext(); Index: rewrite.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/rewrite.nice,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** rewrite.nice 3 Sep 2004 18:07:27 -0000 1.7 --- rewrite.nice 14 Jan 2005 22:47:11 -0000 1.8 *************** *** 50,54 **** { ifExp.elseExp = new StatementExp ! (statement: rewrite(makeBlock(notNull(ifExp.elseExp), statements.slice(from: i+1)))); return statements.slice(to: i); --- 50,54 ---- { ifExp.elseExp = new StatementExp ! (statement: rewrite(makeBlock(ifExp.elseExp, statements.slice(from: i+1)))); return statements.slice(to: i); *************** *** 57,61 **** { ifExp.thenExp = new StatementExp ! (statement: rewrite(makeBlock(notNull(ifExp.thenExp), statements.slice(from: i+1)))); return statements.slice(to: i); --- 57,61 ---- { ifExp.thenExp = new StatementExp ! (statement: rewrite(makeBlock(ifExp.thenExp, statements.slice(from: i+1)))); return statements.slice(to: i); Index: typedef.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/typedef.nice,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** typedef.nice 14 Jan 2005 11:12:11 -0000 1.14 --- typedef.nice 14 Jan 2005 22:47:11 -0000 1.15 *************** *** 330,337 **** mlsub.typing.Monotype[?] resolveParams(MonotypeConstructor parent, TypeScope typeScope) { ! if (parent.parameters == null) ! return null; ! ! return resolveMonotypes(typeScope, cast(notNull(parent.parameters).content)); } --- 330,334 ---- mlsub.typing.Monotype[?] resolveParams(MonotypeConstructor parent, TypeScope typeScope) { ! return resolveMonotypes(typeScope, parent.parameters.content); } *************** *** 380,384 **** let parentMap = new int[params.length]; this.parentTypeParameterMap = parentMap; ! let parentParams = notNull( this.parentParams ); List<mlsub.typing.TypeSymbol> binders = new ArrayList(); --- 377,381 ---- let parentMap = new int[params.length]; this.parentTypeParameterMap = parentMap; ! let parentParams = notNull(this.parentParams); List<mlsub.typing.TypeSymbol> binders = new ArrayList(); *************** *** 429,445 **** getInterfaces() = interfaces.toArray(); ! void addInterfaceImplementation(?Interface itf) { ! if (itf != null) ! interfaces.add(itf); } getJavaInterfaces() = javaInterfaces; ! void setJavaType(?gnu.bytecode.Type javaType) { - if (javaType == null) - return; - this.javaType = javaType; nice.tools.code.Types.set(tc, javaType); --- 426,438 ---- getInterfaces() = interfaces.toArray(); ! void addInterfaceImplementation(Interface itf) { ! interfaces.add(itf); } getJavaInterfaces() = javaInterfaces; ! void setJavaType(gnu.bytecode.Type javaType) { this.javaType = javaType; nice.tools.code.Types.set(tc, javaType); *************** *** 463,467 **** class ClassDefinition extends TypeDefinition { ! // Super class ?MonotypeConstructor superClassIdent = null; ?mlsub.typing.TypeConstructor superClass = null; --- 456,460 ---- class ClassDefinition extends TypeDefinition { ! // Super class ?MonotypeConstructor superClassIdent = null; ?mlsub.typing.TypeConstructor superClass = null; *************** *** 471,477 **** getSuperClassDefinition() { ! if (superClass == null) ! return null; ! let s = getTypeDefinition(notNull(superClass)); if (s instanceof ClassDefinition) return s; --- 464,468 ---- getSuperClassDefinition() { ! let s = getTypeDefinition(superClass); if (s instanceof ClassDefinition) return s; *************** *** 705,713 **** } ! ?TypeDefinition getTypeDefinition(mlsub.typing.TypeConstructor tc) = ! tcToTypeDef.get(tc); ?TypeDefinition getTypeDefinition(mlsub.typing.Interface itf) = ! tcToTypeDef.get( itf.associatedTC() ); //used in mlsub.typing.Enumeration --- 696,709 ---- } ! ?TypeDefinition getTypeDefinition(?mlsub.typing.TypeConstructor tc) ! { ! if (tc == null) ! return null; ! ! return tcToTypeDef.get(tc); ! } ?TypeDefinition getTypeDefinition(mlsub.typing.Interface itf) = ! getTypeDefinition(itf.associatedTC()); //used in mlsub.typing.Enumeration *************** *** 733,737 **** ?mlsub.typing.Monotype getTypeWithTC(TypeConstructor tc) { ! ?TypeDefinition def = cast(getTypeDefinition(tc)); if (def == null) --- 729,733 ---- ?mlsub.typing.Monotype getTypeWithTC(TypeConstructor tc) { ! ?TypeDefinition def = getTypeDefinition(tc); if (def == null) *************** *** 762,766 **** ?mlsub.typing.Monotype getTypeWithTC(TypeConstructor tc, mlsub.typing.Monotype[?] sourceParams ) { ! ?TypeDefinition def = cast(getTypeDefinition(tc)); if (def == null) --- 758,762 ---- ?mlsub.typing.Monotype getTypeWithTC(TypeConstructor tc, mlsub.typing.Monotype[?] sourceParams ) { ! ?TypeDefinition def = getTypeDefinition(tc); if (def == null) *************** *** 845,857 **** return -1; - if (notNull(parent.parameters).content == null) - return -1; - // Assume non-variance ! return notNull(notNull(parent.parameters).content).length; } // Constructors - ClassDefinition makeClass(LocatedString name, boolean isFinal, boolean isAbstract, --- 841,849 ---- return -1; // Assume non-variance ! return notNull(parent.parameters).content.length; } // Constructors ClassDefinition makeClass(LocatedString name, boolean isFinal, boolean isAbstract, Index: constant.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/constant.nice,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** constant.nice 14 Jan 2005 16:41:27 -0000 1.8 --- constant.nice 14 Jan 2005 22:47:11 -0000 1.9 *************** *** 113,136 **** if (Byte.MIN_VALUE <= value <= Byte.MAX_VALUE && !isLong) { ! type = notNull(nice.tools.typing.PrimitiveType.bytePolytype); ! tc = notNull(nice.tools.typing.PrimitiveType.byteTC); object = new Byte(byte(value)); } else if (Short.MIN_VALUE <= value <= Short.MAX_VALUE && !isLong) { ! type = notNull(nice.tools.typing.PrimitiveType.shortPolytype); ! tc = notNull(nice.tools.typing.PrimitiveType.shortTC); object = new Short(short(value)); } else if (Integer.MIN_VALUE <= value <= Integer.MAX_VALUE && !isLong) { ! type = notNull(nice.tools.typing.PrimitiveType.intPolytype); ! tc = notNull(nice.tools.typing.PrimitiveType.intTC); object = value; } else { ! type = notNull(nice.tools.typing.PrimitiveType.longPolytype); ! tc = notNull(nice.tools.typing.PrimitiveType.longTC); object = value; } --- 113,136 ---- if (Byte.MIN_VALUE <= value <= Byte.MAX_VALUE && !isLong) { ! type = nice.tools.typing.PrimitiveType.bytePolytype; ! tc = nice.tools.typing.PrimitiveType.byteTC; object = new Byte(byte(value)); } else if (Short.MIN_VALUE <= value <= Short.MAX_VALUE && !isLong) { ! type = nice.tools.typing.PrimitiveType.shortPolytype; ! tc = nice.tools.typing.PrimitiveType.shortTC; object = new Short(short(value)); } else if (Integer.MIN_VALUE <= value <= Integer.MAX_VALUE && !isLong) { ! type = nice.tools.typing.PrimitiveType.intPolytype; ! tc = nice.tools.typing.PrimitiveType.intTC; object = value; } else { ! type = nice.tools.typing.PrimitiveType.longPolytype; ! tc = nice.tools.typing.PrimitiveType.longTC; object = value; } *************** *** 253,257 **** } ! compile() = notNull(gnu.expr.QuoteExp.nullExp); toString() = "null"; --- 253,257 ---- } ! compile() = gnu.expr.QuoteExp.nullExp; toString() = "null"; *************** *** 280,284 **** let res = new BooleanConstantExp(tc: nice.tools.typing.PrimitiveType.boolTC, value: value, representation: value ? "true" : "false", ! compiledValue: notNull(value ? gnu.expr.QuoteExp.trueExp : gnu.expr.QuoteExp.falseExp)); res.type = nice.tools.typing.PrimitiveType.boolPolytype; res.setLocation(location); --- 280,284 ---- let res = new BooleanConstantExp(tc: nice.tools.typing.PrimitiveType.boolTC, value: value, representation: value ? "true" : "false", ! compiledValue: value ? gnu.expr.QuoteExp.trueExp : gnu.expr.QuoteExp.falseExp); res.type = nice.tools.typing.PrimitiveType.boolPolytype; res.setLocation(location); *************** *** 307,311 **** User.error(value, "Invalid character constant: " + value); ! return createCharConstant(s[0], notNull(value.location())); } --- 307,311 ---- User.error(value, "Invalid character constant: " + value); ! return createCharConstant(s[0], value.location()); } Index: javaMethod.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/javaMethod.nice,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** javaMethod.nice 14 Jan 2005 16:41:27 -0000 1.6 --- javaMethod.nice 14 Jan 2005 22:47:11 -0000 1.7 *************** *** 117,121 **** ?List<gnu.bytecode.Method> methods = knownMethods.get(m.getName()); if (methods == null) ! knownMethods.put( m.getName(), methods = new ArrayList() ); assert methods != null; --- 117,121 ---- ?List<gnu.bytecode.Method> methods = knownMethods.get(m.getName()); if (methods == null) ! knownMethods.put(m.getName(), methods = new ArrayList()); assert methods != null; Index: typeConstructors.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/typeConstructors.nice,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** typeConstructors.nice 20 Dec 2004 16:05:19 -0000 1.1 --- typeConstructors.nice 14 Jan 2005 22:47:11 -0000 1.2 *************** *** 19,23 **** */ ! var HashMap<mlsub.typing.TypeConstructor,?LinkedList<VarSymbol>> constructorsMap = new HashMap(); public void resetConstructorsMap() { constructorsMap = new HashMap(); } --- 19,23 ---- */ ! var HashMap<mlsub.typing.TypeConstructor,?LinkedList<MethodSymbol>> constructorsMap = new HashMap(); public void resetConstructorsMap() { constructorsMap = new HashMap(); } *************** *** 29,33 **** this class. */ ! ?LinkedList<VarSymbol> getConstructors(mlsub.typing.TypeConstructor tc) { return constructorsMap.get(tc); --- 29,33 ---- this class. */ ! ?LinkedList<MethodSymbol> getConstructors(mlsub.typing.TypeConstructor tc) { return constructorsMap.get(tc); *************** *** 36,40 **** void addConstructor(mlsub.typing.TypeConstructor tc, MethodDeclaration m) { ! ?LinkedList<VarSymbol> l = constructorsMap.get(tc); if (l==null) { --- 36,40 ---- void addConstructor(mlsub.typing.TypeConstructor tc, MethodDeclaration m) { ! ?LinkedList<MethodSymbol> l = constructorsMap.get(tc); if (l==null) { *************** *** 47,51 **** void removeConstructor(TypeConstructor tc, MethodDeclaration m) { ! ?LinkedList<VarSymbol> l = constructorsMap.get(tc); if (l == null) return; --- 47,51 ---- void removeConstructor(TypeConstructor tc, MethodDeclaration m) { ! ?LinkedList<MethodSymbol> l = constructorsMap.get(tc); if (l == null) return; Index: symbol.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/symbol.nice,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** symbol.nice 14 Jan 2005 16:41:27 -0000 1.10 --- symbol.nice 14 Jan 2005 22:47:11 -0000 1.11 *************** *** 24,32 **** private boolean isThis = false; ! location() = name.location(); ! public LocatedString getName() = name; ! public boolean hasName(LocatedString i) = this.name.equals(i); boolean isAssignable() = true; --- 24,32 ---- private boolean isThis = false; ! location() = notNull(name).location(); ! public LocatedString getName() = notNull(name); ! public boolean hasName(LocatedString i) = notNull(name).equals(i); boolean isAssignable() = true; *************** *** 91,95 **** return new gnu.expr.ThisExp(decl); else ! return new gnu.expr.ReferenceExp(name == null ? null : name.toString(), decl); } --- 91,95 ---- return new gnu.expr.ThisExp(decl); else ! return new gnu.expr.ReferenceExp(name == null ? null : notNull(name).toString(), decl); } *************** *** 115,119 **** this.isThis = isThis; if (name != null) ! name.location().write(declaration); declaration.setCanRead(true); declaration.setCanWrite(true); --- 115,119 ---- this.isThis = isThis; if (name != null) ! notNull(name).location().write(declaration); declaration.setCanRead(true); declaration.setCanWrite(true); *************** *** 179,190 **** int arity = k.domainArity; if (notNull(arguments).size() != arity) ! return name + Util.has(arity, "parameter", notNull(arguments).size()); else // If the number of arguments is correct, it must be that // some arguments are named. ! return name + " does not have named parameters"; } else ! return name + " is not a function"; } --- 179,190 ---- int arity = k.domainArity; if (notNull(arguments).size() != arity) ! return notNull(name) + Util.has(arity, "parameter", notNull(arguments).size()); else // If the number of arguments is correct, it must be that // some arguments are named. ! return notNull(name) + " does not have named parameters"; } else ! return notNull(name) + " is not a function"; } *************** *** 324,330 **** { if (arguments.size() == 0) ! return name + " is not defined"; ! return name + " is a field of class " + this.describeParameters(); } --- 324,330 ---- { if (arguments.size() == 0) ! return notNull(name) + " is not defined"; ! return notNull(name) + " is a field of class " + this.describeParameters(); } *************** *** 384,388 **** getDefinition() = this.declaration; ! getMethodDeclaration() = this.declaration; compile() = this.declaration.getCode(); --- 384,388 ---- getDefinition() = this.declaration; ! public override MethodDeclaration getMethodDeclaration() = this.declaration; compile() = this.declaration.getCode(); Index: enum.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/enum.nice,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** enum.nice 14 Jan 2005 16:41:27 -0000 1.14 --- enum.nice 14 Jan 2005 22:47:11 -0000 1.15 *************** *** 130,134 **** if (res == null) { ! res = new gnu.expr.Declaration(name.toString(), nice.tools.code.Types.javaType(type)); this.setDeclaration(notNull(res)); definition.module.addGlobalVar(res, true); --- 130,134 ---- if (res == null) { ! res = new gnu.expr.Declaration(notNull(name).toString(), nice.tools.code.Types.javaType(type)); this.setDeclaration(notNull(res)); definition.module.addGlobalVar(res, true); Index: tools.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/tools.nice,v retrieving revision 1.99 retrieving revision 1.100 diff -C2 -d -r1.99 -r1.100 *** tools.nice 14 Jan 2005 16:41:27 -0000 1.99 --- tools.nice 14 Jan 2005 22:47:11 -0000 1.100 *************** *** 133,178 **** } - void resolveCCThis(Statement stmt, Located thisLoc, NiceClass classe) - { - void missingThisError() - { - User.error(thisLoc, "The last statement must be a call to 'this' constructor"); - } - - Block block = cast(stmt); - - if (block.statements.length == 0) - missingThisError(); - - Statement last = block.last; - if (last instanceof Block) - { - resolveCCThis(last, thisLoc, classe); - return; - } - - if (! (last instanceof ExpressionStmt)) - missingThisError(); - - ExpressionStmt expstmt = cast(last); - - if (! (expstmt.exp instanceof CallExp)) - missingThisError(); - - CallExp call = cast(expstmt.exp); - - if (! (call.function instanceof IdentExp)) - missingThisError(); - - IdentExp ident = cast(call.function); - - if (! ident.toString().equals("this")) - missingThisError(); - - call.function = createOverloadedSymbolExp(new ArrayList(cast(classe).getConstructorCallSymbols()), - thisName); - call.function.setLocation(ident.location()); - } - /** A mapping from type names to type symbols. --- 133,136 ---- *************** *** 234,250 **** List<VarSymbol> lookup(VarScope, LocatedString) = native List VarScope.lookup(LocatedString); Map<gnu.bytecode.Type,mlsub.typing.TypeConstructor> javaTypeConstructors(bossa.modules.Compilation ) = native bossa.modules.Compilation.javaTypeConstructors; ! LocatedString name(Symbol) = native Symbol.name; gnu.bytecode.ClassType Type_pointer_type() = native gnu.bytecode.Type.pointer_type; - gnu.expr.QuoteExp QuoteExp_undefined_exp() = native gnu.expr.QuoteExp.undefined_exp; // Retypings needed since java types are not strict. mlsub.typing.Polytype boolPolytype() = native nice.tools.typing.PrimitiveType.boolPolytype; mlsub.typing.Polytype longPolytype() = native nice.tools.typing.PrimitiveType.longPolytype; mlsub.typing.Polytype voidPolytype() = native nice.tools.typing.PrimitiveType.voidPolytype; mlsub.typing.Monotype boolType() = native nice.tools.typing.PrimitiveType.boolType; mlsub.typing.Monotype intType() = native nice.tools.typing.PrimitiveType.intType; mlsub.typing.Monotype longType() = native nice.tools.typing.PrimitiveType.longType; gnu.expr.QuoteExp trueExp() = native gnu.expr.QuoteExp.trueExp; gnu.expr.QuoteExp voidExp() = native gnu.expr.QuoteExp.voidExp; // Local Variables: --- 192,221 ---- List<VarSymbol> lookup(VarScope, LocatedString) = native List VarScope.lookup(LocatedString); Map<gnu.bytecode.Type,mlsub.typing.TypeConstructor> javaTypeConstructors(bossa.modules.Compilation ) = native bossa.modules.Compilation.javaTypeConstructors; ! ?LocatedString name(Symbol) = native Symbol.name; ! ?TypeConstructor associatedTC(mlsub.typing.Interface) = native TypeConstructor mlsub.typing.Interface.associatedTC(); ! mlsub.typing.AtomicConstraint[?] atoms(mlsub.typing.Constraint) = native mlsub.typing.AtomicConstraint[] mlsub.typing.Constraint.atoms(); ! ?gnu.bytecode.Type Types_get(mlsub.typing.TypeConstructor) = native gnu.bytecode.Type nice.tools.code.Types.get(mlsub.typing.TypeConstructor); gnu.bytecode.ClassType Type_pointer_type() = native gnu.bytecode.Type.pointer_type; // Retypings needed since java types are not strict. mlsub.typing.Polytype boolPolytype() = native nice.tools.typing.PrimitiveType.boolPolytype; mlsub.typing.Polytype longPolytype() = native nice.tools.typing.PrimitiveType.longPolytype; + mlsub.typing.Polytype intPolytype() = native nice.tools.typing.PrimitiveType.intPolytype; + mlsub.typing.Polytype shortPolytype() = native nice.tools.typing.PrimitiveType.shortPolytype; + mlsub.typing.Polytype bytePolytype() = native nice.tools.typing.PrimitiveType.bytePolytype; mlsub.typing.Polytype voidPolytype() = native nice.tools.typing.PrimitiveType.voidPolytype; mlsub.typing.Monotype boolType() = native nice.tools.typing.PrimitiveType.boolType; mlsub.typing.Monotype intType() = native nice.tools.typing.PrimitiveType.intType; mlsub.typing.Monotype longType() = native nice.tools.typing.PrimitiveType.longType; + gnu.bytecode.ClassType Type_pointer_type() = native gnu.bytecode.Type.pointer_type; + mlsub.typing.TypeConstructor longTC() = native nice.tools.typing.PrimitiveType.longTC; + mlsub.typing.TypeConstructor intTC() = native nice.tools.typing.PrimitiveType.intTC; + mlsub.typing.TypeConstructor shortTC() = native nice.tools.typing.PrimitiveType.shortTC; + mlsub.typing.TypeConstructor byteTC() = native nice.tools.typing.PrimitiveType.byteTC; + gnu.expr.QuoteExp nullExp() = native gnu.expr.QuoteExp.nullExp; + gnu.expr.QuoteExp falseExp() = native gnu.expr.QuoteExp.falseExp; gnu.expr.QuoteExp trueExp() = native gnu.expr.QuoteExp.trueExp; gnu.expr.QuoteExp voidExp() = native gnu.expr.QuoteExp.voidExp; + gnu.expr.QuoteExp QuoteExp_undefined_exp() = native gnu.expr.QuoteExp.undefined_exp; // Local Variables: Index: globalvar.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/globalvar.nice,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** globalvar.nice 13 Jan 2005 16:47:34 -0000 1.4 --- globalvar.nice 14 Jan 2005 22:47:11 -0000 1.5 *************** *** 71,75 **** { res = new gnu.expr.Declaration ! (name.toString(), nice.tools.code.Types.javaType(type)); this.setDeclaration(notNull(res)); --- 71,75 ---- { res = new gnu.expr.Declaration ! (notNull(name).toString(), nice.tools.code.Types.javaType(type)); this.setDeclaration(notNull(res)); Index: increment.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/increment.nice,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** increment.nice 14 Jan 2005 16:41:27 -0000 1.5 --- increment.nice 14 Jan 2005 22:47:11 -0000 1.6 *************** *** 33,37 **** { variable = variable.noOverloading(); ! if(!variable.isAssignable()) User.error(this, variable + " cannot be incremented"); --- 33,37 ---- { variable = variable.noOverloading(); ! if (!variable.isAssignable()) User.error(this, variable + " cannot be incremented"); *************** *** 39,43 **** if (decl != null) return new gnu.expr.IncrementExp ! (decl, (short) (increment ? 1 : -1), !returnOld); // variable is not a local variable, so it must be a field --- 39,43 ---- if (decl != null) return new gnu.expr.IncrementExp ! (decl, short(increment ? 1 : -1), !returnOld); // variable is not a local variable, so it must be a field |
From: Arjan B. <ar...@us...> - 2005-01-14 18:54:32
|
Update of /cvsroot/nice/Nice/src/nice/tools/compiler In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12024/F:/nice/src/nice/tools/compiler Modified Files: load.nice interface.nice Log Message: Removed some dead code. Index: load.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/nice/tools/compiler/load.nice,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** load.nice 13 Sep 2003 00:39:02 -0000 1.1 --- load.nice 14 Jan 2005 18:53:51 -0000 1.2 *************** *** 29,33 **** if (compilation.runtimeFile == null) compilation.runtimeFile = getNiceRuntime(); - nice.tools.code.TypeImport.setRuntime(compilation.runtimeFile); compilation.setMainPackage(mainPackage); --- 29,32 ---- Index: interface.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/nice/tools/compiler/interface.nice,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** interface.nice 9 Feb 2004 19:23:20 -0000 1.8 --- interface.nice 14 Jan 2005 18:53:51 -0000 1.9 *************** *** 35,39 **** if (compilation.runtimeFile == null) compilation.runtimeFile = getNiceRuntime(); - nice.tools.code.TypeImport.setRuntime(compilation.runtimeFile); compilation.setMainPackage(mainPackage); --- 35,38 ---- |
From: Arjan B. <ar...@us...> - 2005-01-14 18:54:05
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12024/F:/nice/src/bossa/syntax Modified Files: VarScope.java Log Message: Removed some dead code. Index: VarScope.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/VarScope.java,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** VarScope.java 13 Jan 2005 16:47:33 -0000 1.20 --- VarScope.java 14 Jan 2005 18:53:54 -0000 1.21 *************** *** 58,73 **** } - /** - Adds a collection of VarSymbols - */ - void addSymbols(/*VarSymbol*/Symbol[] s) - { - if (s == null) return; - - for(int i = 0; i < s.length; i++) - if (s[i].name != null) - addSymbol(s[i]); - } - void removeSymbol(/*VarSymbol*/Symbol sym) { --- 58,61 ---- |
From: Arjan B. <ar...@us...> - 2005-01-14 18:54:04
|
Update of /cvsroot/nice/Nice/src/nice/tools/typing In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12024/F:/nice/src/nice/tools/typing Modified Files: PrimitiveType.java Log Message: Removed some dead code. Index: PrimitiveType.java =================================================================== RCS file: /cvsroot/nice/Nice/src/nice/tools/typing/PrimitiveType.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** PrimitiveType.java 31 Dec 2004 18:40:44 -0000 1.3 --- PrimitiveType.java 14 Jan 2005 18:53:53 -0000 1.4 *************** *** 166,180 **** public static TypeConstructor collectionTC; public static TypeConstructor throwableTC; - - private static Polytype throwableType; - public static Polytype throwableType() - { - if (throwableType == null) - { - throwableType = new Polytype - (Constraint.True, - Types.sureMonotype(new MonotypeConstructor(throwableTC, null))); - } - return throwableType; - } } \ No newline at end of file --- 166,168 ---- |
From: Arjan B. <ar...@us...> - 2005-01-14 18:54:04
|
Update of /cvsroot/nice/Nice/src/nice/tools/code In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12024/F:/nice/src/nice/tools/code Modified Files: Gen.java TypeImport.java Types.java Log Message: Removed some dead code. Index: Gen.java =================================================================== RCS file: /cvsroot/nice/Nice/src/nice/tools/code/Gen.java,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** Gen.java 13 Jan 2005 16:47:32 -0000 1.24 --- Gen.java 14 Jan 2005 18:53:53 -0000 1.25 *************** *** 152,167 **** /** - @return an expression that references the lambda expression. - */ - public static ReferenceExp referenceTo(LambdaExp lambda) - { - Declaration decl = new Declaration(lambda.getName()); - decl.noteValue(lambda); - decl.setFlag(Declaration.IS_CONSTANT|Declaration.STATIC_SPECIFIED); - decl.setProcedureDecl(true); - return new ReferenceExp(decl); - } - - /** @return the lambda expression referenced. */ --- 152,155 ---- Index: TypeImport.java =================================================================== RCS file: /cvsroot/nice/Nice/src/nice/tools/code/TypeImport.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** TypeImport.java 20 Dec 2004 20:25:52 -0000 1.10 --- TypeImport.java 14 Jan 2005 18:53:53 -0000 1.11 *************** *** 31,43 **** public class TypeImport { - public static void setRuntime(String file) - { - runtime = file; - } - - private static String runtime; - - public static String getRuntime() { return runtime; } - public static Type lookup(bossa.syntax.LocatedString className) { --- 31,34 ---- *************** *** 114,135 **** ****************************************************************/ - /** Search className in opened packages too */ - static java.lang.Class lookupJavaClass(String className) - { - Class res = lookupQualifiedJavaClass(className); - - if (res != null) - return res; - - String[] pkgs = bossa.syntax.Node.getGlobalTypeScopeModule().listImplicitPackages(); - for (int i = 0; i < pkgs.length; i++) - { - res = lookupQualifiedJavaClass(pkgs[i] + "." + className); - if(res != null) - return res; - } - return null; - } - static HashMap stringToReflectClass = new HashMap(); --- 105,108 ---- Index: Types.java =================================================================== RCS file: /cvsroot/nice/Nice/src/nice/tools/code/Types.java,v retrieving revision 1.65 retrieving revision 1.66 diff -C2 -d -r1.65 -r1.66 *** Types.java 12 Jan 2005 18:50:34 -0000 1.65 --- Types.java 14 Jan 2005 18:53:53 -0000 1.66 *************** *** 127,152 **** } - public static void setBytecodeType(Polytype t) - { - Constraint cst = t.getConstraint(); - if (Constraint.hasBinders(cst)) - { - Typing.enter(); - try{ - Constraint.enter(cst); - setBytecodeType(t.getMonotype()); - } - catch(TypingEx e) {} - finally{ - try{ - Typing.leave(); - } - catch(TypingEx e) {} - } - } - else - setBytecodeType(t.getMonotype()); - } - /**************************************************************** * Mapping monotypes to java types --- 127,130 ---- *************** *** 542,579 **** return null; } - - /**************************************************************** - * Default values - ****************************************************************/ - - public static Expression defaultValue(Monotype m) - { - if (!(m instanceof MonotypeConstructor)) - return QuoteExp.nullExp; - - TypeConstructor tc = nice.tools.typing.Types.rawType(m).head(); - - if (tc == null) - return QuoteExp.nullExp; - - if(tc == PrimitiveType.intTC || - tc == PrimitiveType.byteTC || - tc == PrimitiveType.shortTC || - tc == PrimitiveType.longTC) - return zeroInt; - if(tc == PrimitiveType.floatTC || - tc == PrimitiveType.doubleTC) - return zeroFloat; - if(tc == PrimitiveType.boolTC) - return QuoteExp.falseExp; - if(tc == PrimitiveType.charTC) - return zeroChar; - - return QuoteExp.nullExp; - } - - private static Expression zeroInt = new QuoteExp(new Integer(0)); - private static Expression zeroFloat = new QuoteExp(new Float(0.0)); - private static Expression zeroChar = new QuoteExp(new Character((char) 0)); /**************************************************************** --- 520,523 ---- |
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12840/F:/nice/src/bossa/syntax Modified Files: LocatedString.java alternative.nice analyse.nice constant.nice constructor.nice customConstructor.nice defaultMethod.nice enum.nice fieldAccess.nice ident.nice importedconstructor.nice increment.nice inline.nice javaFieldAccess.nice javaMethod.nice locals.nice methodDeclaration.nice methodbody.nice niceMethod.nice niceclass.nice nicefieldaccess.nice pattern.nice retypedMethod.nice statement.nice symbol.nice tools.nice typeIdent.nice Log Message: Conversion cleanup part 1. Index: typeIdent.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/typeIdent.nice,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** typeIdent.nice 13 Jan 2005 23:56:06 -0000 1.4 --- typeIdent.nice 14 Jan 2005 16:41:28 -0000 1.5 *************** *** 22,34 **** */ ! public final class TypeIdent extends bossa.syntax.Monotype implements Located { public LocatedString name; - public TypeIdent cloneTypeIdent() - { - return new TypeIdent(name: name); - } - containsAlike() = false; --- 22,29 ---- */ ! public final class TypeIdent extends Monotype implements Located { public LocatedString name; containsAlike() = false; *************** *** 121,130 **** public LocatedString getName() = name; ! public boolean hasName(LocatedString name) ! { ! return this.name.equals(name); ! } ! ! location() = notNull(name.location()); ! } --- 116,119 ---- public LocatedString getName() = name; ! location() = name.location(); } Index: enum.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/enum.nice,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** enum.nice 13 Jan 2005 16:47:34 -0000 1.13 --- enum.nice 14 Jan 2005 16:41:27 -0000 1.14 *************** *** 178,182 **** args.add(new Argument(value: createStringConstantExp(name.toString()), name: new LocatedString("name",name.location))); ! args.add(new Argument(value: createIntConstantExp(ordinal, notNull(name.location())), name: new LocatedString("ordinal", name.location))); for (int i = 0; i < fields.size(); i++) --- 178,182 ---- args.add(new Argument(value: createStringConstantExp(name.toString()), name: new LocatedString("name",name.location))); ! args.add(new Argument(value: createIntConstantExp(ordinal, name.location()), name: new LocatedString("ordinal", name.location))); for (int i = 0; i < fields.size(); i++) Index: LocatedString.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/LocatedString.java,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** LocatedString.java 13 Oct 2004 23:22:22 -0000 1.19 --- LocatedString.java 14 Jan 2005 16:41:27 -0000 1.20 *************** *** 42,46 **** { this.content = content; ! this.location = loc; this.quoted = quoted; } --- 42,46 ---- { this.content = content; ! this.loc = loc; this.quoted = quoted; } *************** *** 61,65 **** public Location location() { ! return location; } --- 61,65 ---- public Location location() { ! return loc; } *************** *** 80,89 **** public LocatedString cloneLS() { ! return new LocatedString(content, location); } public LocatedString substring(int beginIndex, int endIndex) { ! return new LocatedString(content.substring(beginIndex,endIndex),location); } --- 80,89 ---- public LocatedString cloneLS() { ! return new LocatedString(content, loc); } public LocatedString substring(int beginIndex, int endIndex) { ! return new LocatedString(content.substring(beginIndex,endIndex),loc); } *************** *** 113,117 **** public String content; ! Location location; private boolean quoted; } --- 113,117 ---- public String content; ! Location loc; private boolean quoted; } Index: niceclass.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/niceclass.nice,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** niceclass.nice 14 Jan 2005 11:12:11 -0000 1.19 --- niceclass.nice 14 Jan 2005 16:41:27 -0000 1.20 *************** *** 127,134 **** } ! // FIXME change to MethodSymbol once this is converted to nice ! void addConstructorCallSymbol(VarSymbol sym) { ! constructors.add(cast(sym)); } --- 127,133 ---- } ! void addConstructorCallSymbol(ConstructorCallSymbol sym) { ! constructors.add(sym); } *************** *** 408,412 **** for (msym : constructors) { ! let MethodDeclaration m = cast(msym.getMethodDeclaration()); // Only consider parent methods for which a call from this class --- 407,411 ---- for (msym : constructors) { ! let MethodDeclaration m = notNull(msym.getMethodDeclaration()); // Only consider parent methods for which a call from this class *************** *** 455,459 **** for (msym : constructors) { ! let MethodDeclaration decl = cast(msym.getMethodDeclaration()); res.add((decl, notNull(decl.formalParameters()).getParameters(scope))); } --- 454,458 ---- for (msym : constructors) { ! let MethodDeclaration decl = notNull(msym.getMethodDeclaration()); res.add((decl, notNull(decl.formalParameters()).getParameters(scope))); } *************** *** 584,588 **** symbol: cast(null), type: ctype, classe: this, isDefault: true, fields: fields, parent: parent); ! notNull(constructorMethod)[i].symbol = createMethodSymbol(notNull(constructorMethod)[i], cname, ctype); addConstructor(definition.getTC(), notNull(constructorMethod)[i]); --- 583,587 ---- symbol: cast(null), type: ctype, classe: this, isDefault: true, fields: fields, parent: parent); ! notNull(constructorMethod)[i].symbol = new MethodSymbol(notNull(constructorMethod)[i], cname, ctype); addConstructor(definition.getTC(), notNull(constructorMethod)[i]); *************** *** 612,617 **** // since classes are always regenerated. if (constructorMethod != null) ! for (int i = 0; i < notNull(constructorMethod).length; i++) ! notNull(constructorMethod)[i].getCode(); // Take into account external interface implementations, which --- 611,616 ---- // since classes are always regenerated. if (constructorMethod != null) ! for (cm : notNull(constructorMethod)) ! cm.getCode(); // Take into account external interface implementations, which *************** *** 741,745 **** let gnu.bytecode.Method cloneMethod = ! notNull(gnu.bytecode.Type.pointer_type).getDeclaredMethod("clone", 0); class ThisSymbol extends MonoSymbol --- 740,744 ---- let gnu.bytecode.Method cloneMethod = ! gnu.bytecode.Type.pointer_type.getDeclaredMethod("clone", 0); class ThisSymbol extends MonoSymbol Index: ident.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/ident.nice,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ident.nice 14 Dec 2004 20:18:05 -0000 1.2 --- ident.nice 14 Jan 2005 16:41:27 -0000 1.3 *************** *** 80,86 **** toString() = "PackageExp " + name; ! private void error() { ! User.error(this, name + " is neither a valid expression nor a valid package"); } --- 80,86 ---- toString() = "PackageExp " + name; ! private UserError error() { ! throw User.error(this, name + " is neither a valid expression nor a valid package"); } *************** *** 93,98 **** compile() { ! this.error(); ! return cast(null); } } --- 93,97 ---- compile() { ! throw this.error(); } } Index: retypedMethod.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/retypedMethod.nice,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** retypedMethod.nice 2 Jan 2005 02:20:59 -0000 1.4 --- retypedMethod.nice 14 Jan 2005 16:41:27 -0000 1.5 *************** *** 238,242 **** res.addChild(parameters); ! let symbol = createMethodSymbol(res, name, constraint, returnType); res.symbol = symbol; symbol.propagate = Node.global; --- 238,242 ---- res.addChild(parameters); ! let symbol = new MethodSymbol(res, name, constraint, returnType); res.symbol = symbol; symbol.propagate = Node.global; Index: locals.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/locals.nice,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** locals.nice 12 Jan 2005 18:50:37 -0000 1.7 --- locals.nice 14 Jan 2005 16:41:27 -0000 1.8 *************** *** 28,32 **** } ! location() = notNull(this.getSymbol().name.location()); gnu.expr.Expression compile(gnu.expr.LetExp letExp) --- 28,32 ---- } ! location() = this.getSymbol().name.location(); gnu.expr.Expression compile(gnu.expr.LetExp letExp) *************** *** 45,50 **** generateCode() { ! Internal.error("Should not be called"); ! return cast(null); } --- 45,49 ---- generateCode() { ! throw Internal.error("Should not be called"); } *************** *** 101,114 **** { if (value == null) ! return notNull(gnu.expr.QuoteExp.undefined_exp); else return notNull(value).generateCode(); } - int getIndex() - { - return left.index; - } - void setIndex(int i) { --- 100,108 ---- { if (value == null) ! return gnu.expr.QuoteExp.undefined_exp; else return notNull(value).generateCode(); } void setIndex(int i) { *************** *** 208,212 **** public Statement createLocalFunction(LocatedString name, Monotype returnType, FormalParameters parameters, Statement body) { ! let value = createFunExp(trueConstraint, parameters.getMonoSymbols() || new MonoSymbol[0], body); let symbol = new FunSymbol(name, trueConstraint, parameters, returnType); notNull(symbol.syntacticType).monotype.nullness = /*sure*/2; --- 202,206 ---- public Statement createLocalFunction(LocatedString name, Monotype returnType, FormalParameters parameters, Statement body) { ! let value = createFunExp(trueConstraint, parameters.getMonoSymbols(), body); let symbol = new FunSymbol(name, trueConstraint, parameters, returnType); notNull(symbol.syntacticType).monotype.nullness = /*sure*/2; Index: fieldAccess.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/fieldAccess.nice,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** fieldAccess.nice 1 Jan 2005 16:36:31 -0000 1.1 --- fieldAccess.nice 14 Jan 2005 16:41:27 -0000 1.2 *************** *** 27,35 **** ?gnu.expr.Declaration fieldDecl = null; - /** - * true if this method represent the access to the field of an object. - */ - isFieldAccess() = true; - public boolean isFinal(); public boolean isStatic() = false; --- 27,30 ---- Index: javaFieldAccess.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/javaFieldAccess.nice,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** javaFieldAccess.nice 2 Jan 2005 02:20:59 -0000 1.4 --- javaFieldAccess.nice 14 Jan 2005 16:41:27 -0000 1.5 *************** *** 119,123 **** fieldName : fieldName ); res.addChild(parameters); ! let symbol = createMethodSymbol(res, name, cst, returnType); res.symbol = symbol; symbol.propagate = Node.global; --- 119,123 ---- fieldName : fieldName ); res.addChild(parameters); ! let symbol = new MethodSymbol(res, name, cst, returnType); res.symbol = symbol; symbol.propagate = Node.global; *************** *** 139,143 **** className: new LocatedString(field.getDeclaringClass().getName(), Location.nowhere()), fieldName: field.getName() ); ! res.symbol = createMethodSymbol(res, new LocatedString(field.getName(),Location.nowhere()), type); return res; } --- 139,143 ---- className: new LocatedString(field.getDeclaringClass().getName(), Location.nowhere()), fieldName: field.getName() ); ! res.symbol = new MethodSymbol(res, new LocatedString(field.getName(),Location.nowhere()), type); return res; } Index: nicefieldaccess.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/nicefieldaccess.nice,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** nicefieldaccess.nice 12 Jan 2005 22:06:53 -0000 1.10 --- nicefieldaccess.nice 14 Jan 2005 16:41:27 -0000 1.11 *************** *** 31,35 **** printInterface(s) { ! bossa.util.Internal.error("Should not be part of the module interface"); } --- 31,35 ---- printInterface(s) { ! Internal.error("Should not be part of the module interface"); } *************** *** 56,60 **** res.addChild(params); ! let symbol = createMethodSymbol(res, field.getName(), constr, notNull(field.sym.syntacticType)); res.symbol = symbol; symbol.propagate = Node.global; --- 56,60 ---- res.addChild(params); ! let symbol = new MethodSymbol(res, field.getName(), constr, notNull(field.sym.syntacticType)); res.symbol = symbol; symbol.propagate = Node.global; Index: alternative.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/alternative.nice,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** alternative.nice 2 Jan 2005 02:20:59 -0000 1.6 --- alternative.nice 14 Jan 2005 16:41:27 -0000 1.7 *************** *** 444,448 **** continue; ! MethodDeclaration md = cast(sym.getMethodDeclaration()); if (md.getFullName().equals(fullName)) { --- 444,448 ---- continue; ! MethodDeclaration md = notNull(sym.getMethodDeclaration()); if (md.getFullName().equals(fullName)) { Index: defaultMethod.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/defaultMethod.nice,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** defaultMethod.nice 13 Jan 2005 23:56:06 -0000 1.7 --- defaultMethod.nice 14 Jan 2005 16:41:27 -0000 1.8 *************** *** 49,53 **** Monotype returnType, FormalParameters parameters, ! Statement body, Contract contract, boolean isOverride) { --- 49,53 ---- Monotype returnType, FormalParameters parameters, ! ?Statement body, Contract contract, boolean isOverride) { *************** *** 130,134 **** contract: contract, isOverride: isOverride, implementation: res); notNull(res.declaration).addChild(parameters); ! let symbol = createMethodSymbol(notNull(res.declaration), name, constraint, returnType); notNull(res.declaration).symbol = symbol; symbol.propagate = Node.global; --- 130,134 ---- contract: contract, isOverride: isOverride, implementation: res); notNull(res.declaration).addChild(parameters); ! let symbol = new MethodSymbol(notNull(res.declaration), name, constraint, returnType); notNull(res.declaration).symbol = symbol; symbol.propagate = Node.global; Index: constructor.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/constructor.nice,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** constructor.nice 14 Jan 2005 11:12:10 -0000 1.7 --- constructor.nice 14 Jan 2005 16:41:27 -0000 1.8 *************** *** 30,34 **** let type = new mlsub.typing.Polytype(notNull(this.getType()).getConstraint(), new mlsub.typing.FunType(this.getArgTypes(), nice.tools.typing.PrimitiveType.voidType)); ! classe.addConstructorCallSymbol(createConstructorCallSymbol(this, name, type)); } --- 30,34 ---- let type = new mlsub.typing.Polytype(notNull(this.getType()).getConstraint(), new mlsub.typing.FunType(this.getArgTypes(), nice.tools.typing.PrimitiveType.voidType)); ! classe.addConstructorCallSymbol(new ConstructorCallSymbol(this, name, type)); } Index: statement.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/statement.nice,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** statement.nice 20 Dec 2004 13:56:16 -0000 1.1 --- statement.nice 14 Jan 2005 16:41:27 -0000 1.2 *************** *** 41,50 **** Statement s = statements[i]; - if (s == null) - { - res[i] = gnu.expr.QuoteExp.voidExp; - continue; - } - try { res[i] = s.generateCode(); --- 41,44 ---- Index: analyse.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/analyse.nice,v retrieving revision 1.125 retrieving revision 1.126 diff -C2 -d -r1.125 -r1.126 *** analyse.nice 13 Jan 2005 16:47:33 -0000 1.125 --- analyse.nice 14 Jan 2005 16:41:27 -0000 1.126 *************** *** 719,723 **** analyse(LocalFunction decl, info) { ! decl.parameters.resolveCalledFromAnalyse(cast(info)); info.addVar(decl.left); --- 719,723 ---- analyse(LocalFunction decl, info) { ! decl.parameters.resolveCalledFromAnalyse(info); info.addVar(decl.left); Index: constant.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/constant.nice,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** constant.nice 12 Jan 2005 18:50:37 -0000 1.7 --- constant.nice 14 Jan 2005 16:41:27 -0000 1.8 *************** *** 62,73 **** public long longValue() { ! let Number val = cast(value); ! return val.longValue(); } isZero() { ! let Number val = cast(value); ! return val.intValue() == 0; } --- 62,71 ---- public long longValue() { ! return value.longValue(); } isZero() { ! return value.intValue() == 0; } *************** *** 85,90 **** compile() { ! let VarSymbol val = cast(value); ! return val.compile(); } } --- 83,87 ---- compile() { ! return value.compile(); } } *************** *** 291,298 **** class CharConstantExp extends ConstantExp { public long longValue() { ! Character val = cast(this.value); ! return int(val.charValue()); } --- 288,296 ---- class CharConstantExp extends ConstantExp { + override char value; + public long longValue() { ! return int(value); } Index: customConstructor.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/customConstructor.nice,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** customConstructor.nice 14 Jan 2005 11:12:10 -0000 1.17 --- customConstructor.nice 14 Jan 2005 16:41:27 -0000 1.18 *************** *** 36,40 **** new mlsub.typing.FunType(this.getArgTypes(), nice.tools.typing.PrimitiveType.voidType)); notNull(classe).addConstructorCallSymbol( ! createConstructorCallSymbol(this, name, type)); } --- 36,40 ---- new mlsub.typing.FunType(this.getArgTypes(), nice.tools.typing.PrimitiveType.voidType)); notNull(classe).addConstructorCallSymbol( ! new ConstructorCallSymbol(this, name, type)); } *************** *** 155,159 **** res.addChild(params); ! let symbol = createMethodSymbol(res, name, cst, returnType); res.symbol = symbol; symbol.propagate = Node.global; --- 155,159 ---- res.addChild(params); ! let symbol = new MethodSymbol(res, name, cst, returnType); res.symbol = symbol; symbol.propagate = Node.global; *************** *** 177,181 **** if (! (syms[i] instanceof mlsub.typing.MonotypeVar)) User.error(classe, syms[i] + " is not a type"); ! notNull(params)[i] = new MonotypeWrapper(type: cast(syms[i])); } --- 177,181 ---- if (! (syms[i] instanceof mlsub.typing.MonotypeVar)) User.error(classe, syms[i] + " is not a type"); ! params[i] = new MonotypeWrapper(type: cast(syms[i])); } Index: methodbody.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/methodbody.nice,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** methodbody.nice 11 Jan 2005 21:45:46 -0000 1.10 --- methodbody.nice 14 Jan 2005 16:41:27 -0000 1.11 *************** *** 43,50 **** } ! private void setDeclaration(MethodDeclaration d) { if (d == null) ! User.error(this, "Method " + name + " is not declared"); this.declaration = d; --- 43,50 ---- } ! private void setDeclaration(?MethodDeclaration d) { if (d == null) ! throw User.error(this, "Method " + name + " is not declared"); this.declaration = d; *************** *** 85,89 **** } ! MethodDeclaration m = cast(s.getMethodDeclaration()); if (m.isIgnored()) { --- 85,89 ---- } ! MethodDeclaration m = notNull(s.getMethodDeclaration()); if (m.isIgnored()) { *************** *** 151,155 **** for (int m1 = 0; m1 < size; m1++) { ! let MethodDeclaration md1 = cast(tempSymbols[m1].getMethodDeclaration()); mlsub.typing.Monotype[] dom1 = notNull(md1.getType()).domain(); for (int m2 = 0; m2 < size; m2++) --- 151,155 ---- for (int m1 = 0; m1 < size; m1++) { ! let MethodDeclaration md1 = notNull(tempSymbols[m1].getMethodDeclaration()); mlsub.typing.Monotype[] dom1 = notNull(md1.getType()).domain(); for (int m2 = 0; m2 < size; m2++) *************** *** 158,162 **** boolean remove = true; boolean additionalsEqual = true; ! let MethodDeclaration md2 = cast(tempSymbols[m2].getMethodDeclaration()); mlsub.typing.Monotype[] dom2 = notNull(md2.getType()).domain(); for (int i = 0; i < len; i++) --- 158,162 ---- boolean remove = true; boolean additionalsEqual = true; ! let MethodDeclaration md2 = notNull(tempSymbols[m2].getMethodDeclaration()); mlsub.typing.Monotype[] dom2 = notNull(md2.getType()).domain(); for (int i = 0; i < len; i++) *************** *** 192,197 **** // Check that the non-dispatched parameter names match the declaration outer: for(let it = symbols.iterator(); it.hasNext();) { ! MethodDeclaration m = cast(it.next().getMethodDeclaration()); ! if( m instanceof NiceMethod) { FormalParameters params = notNull(m.formalParameters()); for (int i = params.hasThis() ? 1 : 0; i < formals.length; i++) --- 192,197 ---- // Check that the non-dispatched parameter names match the declaration outer: for(let it = symbols.iterator(); it.hasNext();) { ! ?MethodDeclaration m = it.next().getMethodDeclaration(); ! if (m instanceof NiceMethod) { FormalParameters params = notNull(m.formalParameters()); for (int i = params.hasThis() ? 1 : 0; i < formals.length; i++) *************** *** 225,229 **** for (s : symbols) { ! MethodDeclaration m = cast(s.getMethodDeclaration()); methods += m + " defined " + m.location() + "\n"; } --- 225,229 ---- for (s : symbols) { ! MethodDeclaration m = notNull(s.getMethodDeclaration()); methods += m + " defined " + m.location() + "\n"; } *************** *** 271,275 **** User.error(this, name+" is not a method"); ! MethodDeclaration decl = cast(s.getMethodDeclaration()); this.setDeclaration(decl); --- 271,275 ---- User.error(this, name+" is not a method"); ! ?MethodDeclaration decl = s.getMethodDeclaration(); this.setDeclaration(decl); *************** *** 489,493 **** { let res = new MethodBodyDefinition(name, Node.down, body: body, ! formals: makeFormals(formals, container, notNull(name.location())), binders: binders); --- 489,493 ---- { let res = new MethodBodyDefinition(name, Node.down, body: body, ! formals: makeFormals(formals, container, name.location()), binders: binders); Index: inline.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/inline.nice,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** inline.nice 2 Jan 2005 02:20:59 -0000 1.2 --- inline.nice 14 Jan 2005 16:41:27 -0000 1.3 *************** *** 145,149 **** res.addChild(parameters); ! let symbol = createMethodSymbol(res, name, constraint, returnType); res.symbol = symbol; symbol.propagate = Node.global; --- 145,149 ---- res.addChild(parameters); ! let symbol = new MethodSymbol(res, name, constraint, returnType); res.symbol = symbol; symbol.propagate = Node.global; Index: niceMethod.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/niceMethod.nice,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** niceMethod.nice 14 Jan 2005 11:12:11 -0000 1.16 --- niceMethod.nice 14 Jan 2005 16:41:27 -0000 1.17 *************** *** 22,26 **** { private boolean isOverride; ! private bossa.util.Location returnTypeLocation = Location.nowhere(); private ?List<VarSymbol> homonyms = null; --- 22,26 ---- { private boolean isOverride; ! private ?bossa.util.Location returnTypeLocation = null; private ?List<VarSymbol> homonyms = null; *************** *** 95,99 **** for (s : notNull(homonyms)) { ! let MethodDeclaration d = cast(s.getMethodDeclaration()); // Ignore non-methods. --- 95,99 ---- for (s : notNull(homonyms)) { ! let ?MethodDeclaration d = s.getMethodDeclaration(); // Ignore non-methods. *************** *** 213,217 **** res.addChild(parameters); ! let symbol = createMethodSymbol(res, name, constraint, returnType); res.symbol = symbol; symbol.propagate = Node.global; --- 213,217 ---- res.addChild(parameters); ! let symbol = new MethodSymbol(res, name, constraint, returnType); res.symbol = symbol; symbol.propagate = Node.global; *************** *** 237,241 **** Monotype returnType, FormalParameters params, ! Statement body, Contract contract, boolean isOverride) --- 237,241 ---- Monotype returnType, FormalParameters params, ! ?Statement body, Contract contract, boolean isOverride) *************** *** 302,306 **** map.put(getAlikeID(), createMonotypeConstructor(alikeTC, ! createTypeParameters(new ArrayList()), notNull(name.location()))); returnType = returnType.substitute(map); params.substitute(map); --- 302,306 ---- map.put(getAlikeID(), createMonotypeConstructor(alikeTC, ! createTypeParameters(new ArrayList()), name.location())); returnType = returnType.substitute(map); params.substitute(map); Index: methodDeclaration.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/methodDeclaration.nice,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** methodDeclaration.nice 12 Jan 2005 18:50:37 -0000 1.2 --- methodDeclaration.nice 14 Jan 2005 16:41:27 -0000 1.3 *************** *** 198,206 **** } - /** - * true if this method represent the access to the field of an object. - */ - public boolean isFieldAccess() { return false; } - void checkSpecialRequirements(Expression[?] arguments) { --- 198,201 ---- Index: javaMethod.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/javaMethod.nice,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** javaMethod.nice 2 Jan 2005 02:20:59 -0000 1.5 --- javaMethod.nice 14 Jan 2005 16:41:27 -0000 1.6 *************** *** 96,100 **** parameters: null, arity: type.domain().length, type: type, symbol: cast(null), reflectMethod: m); ! res.symbol = createMethodSymbol(res, name, type); return res; } --- 96,100 ---- parameters: null, arity: type.domain().length, type: type, symbol: cast(null), reflectMethod: m); ! res.symbol = new MethodSymbol(res, name, type); return res; } *************** *** 104,108 **** parameters: null, arity: type.domain().length, type: type, symbol: cast(null), reflectMethod: m); ! res.symbol = createMethodSymbol(res, name, type); return res; } --- 104,108 ---- parameters: null, arity: type.domain().length, type: type, symbol: cast(null), reflectMethod: m); ! res.symbol = new MethodSymbol(res, name, type); return res; } Index: pattern.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/pattern.nice,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** pattern.nice 31 Dec 2004 18:40:45 -0000 1.15 --- pattern.nice 14 Jan 2005 16:41:27 -0000 1.16 *************** *** 161,165 **** } ! public boolean matches(mlsub.typing.TypeConstructor tag); public boolean matchesValue(ConstantExp val); --- 161,165 ---- } ! public boolean matches(?mlsub.typing.TypeConstructor tag); public boolean matchesValue(ConstantExp val); *************** *** 245,249 **** public Pattern createPattern(LocatedString name) { ! return new VariablePattern(name: name, loc: notNull(name.location())); } --- 245,249 ---- public Pattern createPattern(LocatedString name) { ! return new VariablePattern(name: name, loc: name.location()); } *************** *** 253,257 **** return new NotNullPattern(name: name, tc: nice.tools.typing.PrimitiveType.sureTC, loc: notNull(name.location)); ! return new TypePattern(name: name, typeConstructor: ti, loc: notNull(name.location()), exactlyAt: false); } --- 253,257 ---- return new NotNullPattern(name: name, tc: nice.tools.typing.PrimitiveType.sureTC, loc: notNull(name.location)); ! return new TypePattern(name: name, typeConstructor: ti, loc: name.location(), exactlyAt: false); } *************** *** 259,263 **** public Pattern createPattern(?LocatedString name, ?mlsub.typing.TypeConstructor tc, boolean sure) { // TODO: don't generate NotNullPatterns if the overriden domain is sure. ! let loc = (name != null) ? notNull(name.location()) : Location.nowhere(); if (nice.tools.typing.Types.isPrimitive(tc)) --- 259,263 ---- public Pattern createPattern(?LocatedString name, ?mlsub.typing.TypeConstructor tc, boolean sure) { // TODO: don't generate NotNullPatterns if the overriden domain is sure. ! let loc = (name != null) ? name.location() : Location.nowhere(); if (nice.tools.typing.Types.isPrimitive(tc)) Index: symbol.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/symbol.nice,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** symbol.nice 13 Jan 2005 16:47:34 -0000 1.9 --- symbol.nice 14 Jan 2005 16:41:27 -0000 1.10 *************** *** 24,28 **** private boolean isThis = false; ! location() = notNull(name.location()); public LocatedString getName() = name; --- 24,28 ---- private boolean isThis = false; ! location() = name.location(); public LocatedString getName() = name; *************** *** 115,121 **** this.isThis = isThis; if (name != null) ! notNull(name.location).write(notNull(this.decl)); ! notNull(this.decl).setCanRead(true); ! notNull(this.decl).setCanWrite(true); } } --- 115,121 ---- this.isThis = isThis; if (name != null) ! name.location().write(declaration); ! declaration.setCanRead(true); ! declaration.setCanWrite(true); } } *************** *** 231,235 **** { ! if(syntacticType!=null) this.addChild(syntacticType); } --- 231,235 ---- { ! if (syntacticType!=null) this.addChild(syntacticType); } *************** *** 285,289 **** String describeParameters() { ! ?FormalParameters parameters = this.parameters; if (parameters != null) return parameters.toString(); --- 285,289 ---- String describeParameters() { ! ?FormalParameters parameters = this.parameters; if (parameters != null) return parameters.toString(); *************** *** 355,359 **** { let decl = this.declaration; ! if(decl instanceof FieldAccess) return decl; --- 355,359 ---- { let decl = this.declaration; ! if (decl instanceof FieldAccess) return decl; *************** *** 426,451 **** return decl.getInitializationCode(true); ! Internal.error("Declaration associated with ConstructorCallSymbol is not a constructor."); ! return super; } } - // Bootstrap (for conversion to nice) - MethodSymbol createMethodSymbol(MethodDeclaration declaration, - LocatedString name, Constraint constraint, Monotype returnType ) = - new MethodSymbol(declaration,name,constraint,returnType); - - MethodSymbol createMethodSymbol(MethodDeclaration declaration, - LocatedString name, mlsub.typing.Polytype type ) = - new MethodSymbol(declaration,name,type); - - VarSymbol createConstructorCallSymbol(MethodDeclaration declaration, - LocatedString name, mlsub.typing.Polytype type ) = - new ConstructorCallSymbol(declaration,name,type); - - boolean isNonStaticFieldAccess(VarSymbol sym) { ! FieldAccess access = cast(sym.getFieldAccessMethod()); return access != null && ! access.isStatic(); } --- 426,436 ---- return decl.getInitializationCode(true); ! throw Internal.error("Declaration associated with ConstructorCallSymbol is not a constructor."); } } boolean isNonStaticFieldAccess(VarSymbol sym) { ! let access = sym.getFieldAccessMethod(); return access != null && ! access.isStatic(); } *************** *** 453,457 **** boolean isStaticFieldAccess(VarSymbol sym) { ! FieldAccess access = cast(sym.getFieldAccessMethod()); return access != null && access.isStatic(); } --- 438,442 ---- boolean isStaticFieldAccess(VarSymbol sym) { ! let access = sym.getFieldAccessMethod(); return access != null && access.isStatic(); } Index: tools.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/tools.nice,v retrieving revision 1.98 retrieving revision 1.99 diff -C2 -d -r1.98 -r1.99 *** tools.nice 14 Jan 2005 11:12:11 -0000 1.98 --- tools.nice 14 Jan 2005 16:41:27 -0000 1.99 *************** *** 235,238 **** --- 235,240 ---- Map<gnu.bytecode.Type,mlsub.typing.TypeConstructor> javaTypeConstructors(bossa.modules.Compilation ) = native bossa.modules.Compilation.javaTypeConstructors; LocatedString name(Symbol) = native Symbol.name; + gnu.bytecode.ClassType Type_pointer_type() = native gnu.bytecode.Type.pointer_type; + gnu.expr.QuoteExp QuoteExp_undefined_exp() = native gnu.expr.QuoteExp.undefined_exp; // Retypings needed since java types are not strict. Index: importedconstructor.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/importedconstructor.nice,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** importedconstructor.nice 14 Jan 2005 11:12:10 -0000 1.13 --- importedconstructor.nice 14 Jan 2005 16:41:27 -0000 1.14 *************** *** 115,119 **** method: method); res.addChild(parameters); ! let symbol = createMethodSymbol(res, name, constraint, returnType); res.symbol = symbol; symbol.propagate = Node.global; --- 115,119 ---- method: method); res.addChild(parameters); ! let symbol = new MethodSymbol(res, name, constraint, returnType); res.symbol = symbol; symbol.propagate = Node.global; Index: increment.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/increment.nice,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** increment.nice 1 Jan 2005 16:36:31 -0000 1.4 --- increment.nice 14 Jan 2005 16:41:27 -0000 1.5 *************** *** 43,47 **** // variable is not a local variable, so it must be a field if (! (variable instanceof CallExp)) ! Internal.error(this, "\"var\" is assignable and not a local, " + "so it should be a call to a FieldAccessMethod"); --- 43,47 ---- // variable is not a local variable, so it must be a field if (! (variable instanceof CallExp)) ! throw Internal.error(this, "\"var\" is assignable and not a local, " + "so it should be a call to a FieldAccessMethod"); |
From: Arjan B. <ar...@us...> - 2005-01-14 11:12:55
|
Update of /cvsroot/nice/Nice/src/bossa/parser In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3346/F:/nice/src/bossa/parser Modified Files: Parser.jj Log Message: Converted the last piece of NiceClass. Index: Parser.jj =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/parser/Parser.jj,v retrieving revision 1.304 retrieving revision 1.305 diff -C2 -d -r1.304 -r1.305 *** Parser.jj 13 Jan 2005 16:47:31 -0000 1.304 --- Parser.jj 14 Jan 2005 11:12:06 -0000 1.305 *************** *** 976,980 **** } ! void getField(CNiceClass c, boolean storeDocString): { MonoSymbol field; --- 976,980 ---- } ! void getField(NiceClass c, boolean storeDocString): { MonoSymbol field; *************** *** 1059,1063 **** ( "{" ! { CNiceClass impl = new CNiceClass(res); List methods = new ArrayList();} // internal fields and methods ( --- 1059,1063 ---- ( "{" ! { NiceClass impl = new NiceClass(res); List methods = new ArrayList();} // internal fields and methods ( |
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3346/F:/nice/src/bossa/syntax Modified Files: Module.java compilation.nice constructor.nice customConstructor.nice dispatch.java.bootstrap dispatchTest.nice importedconstructor.nice methodImplementation.nice niceMethod.nice niceclass.nice nicefield.nice super.nice tools.nice typedef.nice Removed Files: ClassImplementation.java NiceClass.java Log Message: Converted the last piece of NiceClass. Index: customConstructor.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/customConstructor.nice,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** customConstructor.nice 13 Jan 2005 14:06:15 -0000 1.16 --- customConstructor.nice 14 Jan 2005 11:12:10 -0000 1.17 *************** *** 23,27 **** Statement body; ! ?CNiceClass classe = null; private ?VarScope thisScope = null; private ?TypeScope thisTypeScope = null; --- 23,27 ---- Statement body; ! ?NiceClass classe = null; private ?VarScope thisScope = null; private ?TypeScope thisTypeScope = null; --- ClassImplementation.java DELETED --- Index: dispatchTest.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/dispatchTest.nice,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** dispatchTest.nice 4 Jan 2005 21:20:39 -0000 1.5 --- dispatchTest.nice 14 Jan 2005 11:12:10 -0000 1.6 *************** *** 243,247 **** return null; ! let CNiceClass nc = cast(def.getImplementation()); return nc.getClassExp().getClassType(); } --- 243,247 ---- return null; ! let NiceClass nc = cast(def.getImplementation()); return nc.getClassExp().getClassType(); } Index: nicefield.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/nicefield.nice,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** nicefield.nice 3 Jan 2005 01:24:28 -0000 1.4 --- nicefield.nice 14 Jan 2005 11:12:11 -0000 1.5 *************** *** 21,25 **** abstract class NiceField { ! CNiceClass declaringClass; MonoSymbol sym; ?Expression value; --- 21,25 ---- abstract class NiceField { ! NiceClass declaringClass; MonoSymbol sym; ?Expression value; *************** *** 248,252 **** public final class ValueOverride { ! CNiceClass declaringClass; LocatedString name; Expression value; --- 248,252 ---- public final class ValueOverride { ! NiceClass declaringClass; LocatedString name; Expression value; *************** *** 288,292 **** to the corresponding symbol in the constructor of this class. */ ! private TypeScope translationScope(CNiceClass this, CNiceClass other) { let binders = other.definition.getBinders(); --- 288,292 ---- to the corresponding symbol in the constructor of this class. */ ! private TypeScope translationScope(NiceClass this, NiceClass other) { let binders = other.definition.getBinders(); Index: compilation.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/compilation.nice,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** compilation.nice 4 Jan 2005 21:20:39 -0000 1.4 --- compilation.nice 14 Jan 2005 11:12:10 -0000 1.5 *************** *** 108,112 **** Iterator<Alternative> i = sortedAlternatives.iterator(); Alternative a = i.next(); ! CNiceClass c = declaringClass(m, a); i.remove(); --- 108,112 ---- Iterator<Alternative> i = sortedAlternatives.iterator(); Alternative a = i.next(); ! NiceClass c = declaringClass(m, a); i.remove(); *************** *** 139,143 **** } ! private CNiceClass declaringClass(JavaMethod m, Alternative alt) { ?mlsub.typing.TypeConstructor firstArgument = alt.getPatterns()[0].getTC(); --- 139,143 ---- } ! private NiceClass declaringClass(JavaMethod m, Alternative alt) { ?mlsub.typing.TypeConstructor firstArgument = alt.getPatterns()[0].getTC(); --- NiceClass.java DELETED --- Index: niceclass.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/niceclass.nice,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** niceclass.nice 12 Jan 2005 22:06:53 -0000 1.18 --- niceclass.nice 14 Jan 2005 11:12:11 -0000 1.19 *************** *** 16,23 **** /** ! Concrete Nice Class definition. */ ! public class CNiceClass extends NiceClass { TypeDefinition definition; --- 16,36 ---- /** ! Abstract superclass for NiceClass, JavaClass and PrimitiveType ! */ ! public abstract class ClassImplementation ! { ! void resolveClass(); ! void resolveBody() {} ! void typecheck() {} ! void compile() {} ! void recompile() {} ! void printInterface(java.io.PrintWriter s); ! } ! ! /** ! A Nice Class definition. */ ! public class NiceClass extends ClassImplementation { TypeDefinition definition; *************** *** 57,61 **** } ! getName() = definition.getName(); TypeDefinition getDefinition() = definition; --- 70,74 ---- } ! LocatedString getName() = definition.getName(); TypeDefinition getDefinition() = definition; *************** *** 105,109 **** public boolean isInterface() = definition instanceof InterfaceDefinition; ! ?CNiceClass getParent() { let superTC = definition.getSuperClass(); --- 118,122 ---- public boolean isInterface() = definition instanceof InterfaceDefinition; ! ?NiceClass getParent() { let superTC = definition.getSuperClass(); *************** *** 363,367 **** } ! createClassExp() { gnu.expr.ClassExp res = new gnu.expr.ClassExp(); --- 376,380 ---- } ! gnu.expr.ClassExp createClassExp() { gnu.expr.ClassExp res = new gnu.expr.ClassExp(); *************** *** 464,468 **** let supTC = definition.getSuperClass(); ! let ?CNiceClass sup = (supTC == null) ? null : getNiceClass(supTC); List<(?MethodDeclaration, List<Parameter>)> res; if (sup == null) --- 477,481 ---- let supTC = definition.getSuperClass(); ! let ?NiceClass sup = (supTC == null) ? null : getNiceClass(supTC); List<(?MethodDeclaration, List<Parameter>)> res; if (sup == null) *************** *** 681,685 **** } ! importMethod(gnu.bytecode.Method method) { if (method.isConstructor()) --- 694,698 ---- } ! ?Definition importMethod(gnu.bytecode.Method method) { if (method.isConstructor()) *************** *** 734,741 **** compile() = notNull(declaringClass.thisExp); ! final CNiceClass declaringClass; } ! CNiceClass createNiceClass(TypeDefinition cdef) = new CNiceClass(definition: cdef); private TypeSymbol asTypeSymbol(mlsub.typing.Monotype type) --- 747,754 ---- compile() = notNull(declaringClass.thisExp); ! final NiceClass declaringClass; } ! NiceClass createNiceClass(TypeDefinition cdef) = new NiceClass(definition: cdef); private TypeSymbol asTypeSymbol(mlsub.typing.Monotype type) *************** *** 753,757 **** if (c != null && c.getImplementation() instanceof NiceClass) { ! CNiceClass nc = cast(c.getImplementation()); return nc.classe; } --- 766,770 ---- if (c != null && c.getImplementation() instanceof NiceClass) { ! NiceClass nc = cast(c.getImplementation()); return nc.classe; } *************** *** 760,764 **** } ! ?CNiceClass getNiceClass(TypeConstructor tc) { let res = getTypeDefinition(tc); --- 773,777 ---- } ! ?NiceClass getNiceClass(TypeConstructor tc) { let res = getTypeDefinition(tc); *************** *** 769,773 **** } ! public ?CNiceClass getNiceClass(mlsub.typing.Monotype type) { if (! nice.tools.typing.Types.isSure(type)) --- 782,786 ---- } ! public ?NiceClass getNiceClass(mlsub.typing.Monotype type) { if (! nice.tools.typing.Types.isSure(type)) *************** *** 775,777 **** return getNiceClass(nice.tools.typing.Types.constructor(type)); ! } \ No newline at end of file --- 788,808 ---- return getNiceClass(nice.tools.typing.Types.constructor(type)); ! } ! ! public LocatedString NiceClass_getName(Object nc) ! { ! NiceClass niceC = cast(nc); ! return niceC.getName(); ! } ! ! public gnu.expr.ClassExp NiceClass_createClassExp(Object nc) ! { ! NiceClass niceC = cast(nc); ! return niceC.createClassExp(); ! } ! ! public ?Definition NiceClass_importMethod(Object nc, gnu.bytecode.Method method) ! { ! NiceClass niceC = cast(nc); ! return niceC.importMethod(method); ! } Index: niceMethod.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/niceMethod.nice,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** niceMethod.nice 13 Jan 2005 14:06:15 -0000 1.15 --- niceMethod.nice 14 Jan 2005 11:12:11 -0000 1.16 *************** *** 355,359 **** // Try to compile the dispatch method as a member method if possible. ! ?CNiceClass receiver; if (argTypes.length == 0) receiver = null; --- 355,359 ---- // Try to compile the dispatch method as a member method if possible. ! ?NiceClass receiver; if (argTypes.length == 0) receiver = null; Index: Module.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/Module.java,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** Module.java 31 Dec 2004 20:23:31 -0000 1.22 --- Module.java 14 Jan 2005 11:12:10 -0000 1.23 *************** *** 35,39 **** gnu.expr.ReferenceExp addMethod(gnu.expr.LambdaExp method, boolean packageMethod); ! gnu.expr.ClassExp getClassExp(NiceClass def); void addUserClass(gnu.expr.ClassExp classe); } --- 35,39 ---- gnu.expr.ReferenceExp addMethod(gnu.expr.LambdaExp method, boolean packageMethod); ! gnu.expr.ClassExp getClassExp(Object def); void addUserClass(gnu.expr.ClassExp classe); } Index: tools.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/tools.nice,v retrieving revision 1.97 retrieving revision 1.98 diff -C2 -d -r1.97 -r1.98 *** tools.nice 13 Jan 2005 16:47:34 -0000 1.97 --- tools.nice 14 Jan 2005 11:12:11 -0000 1.98 *************** *** 221,229 **** mlsub.typing.AtomicConstraint[?] AtomicConstraint_substitute(java.util.Map<mlsub.typing.TypeSymbol,mlsub.typing.TypeSymbol>, AtomicConstraint[?]) = native mlsub.typing.AtomicConstraint[] mlsub.typing.AtomicConstraint.substitute(java.util.Map, mlsub.typing.AtomicConstraint[]); Module module(Definition) = native Definition.module; - ?Definition importMethod(NiceClass, gnu.bytecode.Method) = native Definition NiceClass.importMethod(gnu.bytecode.Method); boolean equals(LocatedString, LocatedString) = native boolean LocatedString.equals(LocatedString); ?gnu.bytecode.Attribute get(gnu.bytecode.AttrContainer, String) = native gnu.bytecode.Attribute gnu.bytecode.Attribute.get(gnu.bytecode.AttrContainer, String); void printInterface(Definition, java.io.PrintWriter) = native void Definition.printInterface(java.io.PrintWriter); - void printInterface(ClassImplementation, java.io.PrintWriter) = native void ClassImplementation.printInterface(java.io.PrintWriter); ?gnu.bytecode.Type TypeImport_lookup(LocatedString) = native gnu.bytecode.Type nice.tools.code.TypeImport.lookup(LocatedString); List<Node> children(Node) = native Node.children; --- 221,227 ---- Index: typedef.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/typedef.nice,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** typedef.nice 12 Jan 2005 22:06:54 -0000 1.13 --- typedef.nice 14 Jan 2005 11:12:11 -0000 1.14 *************** *** 354,358 **** { let impl = implementation; ! if (impl != null && impl instanceof CNiceClass) impl.precompile(); } --- 354,358 ---- { let impl = implementation; ! if (impl != null && impl instanceof NiceClass) impl.precompile(); } Index: methodImplementation.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/methodImplementation.nice,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** methodImplementation.nice 13 Jan 2005 14:06:15 -0000 1.10 --- methodImplementation.nice 14 Jan 2005 11:12:11 -0000 1.11 *************** *** 198,202 **** return; ! CNiceClass c = cast(def.getImplementation()); gnu.expr.Expression[] params = cast(new gnu.expr.Expression[arity]); --- 198,202 ---- return; ! NiceClass c = cast(def.getImplementation()); gnu.expr.Expression[] params = cast(new gnu.expr.Expression[arity]); Index: super.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/super.nice,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** super.nice 12 Jan 2005 18:50:38 -0000 1.9 --- super.nice 14 Jan 2005 11:12:11 -0000 1.10 *************** *** 169,173 **** // the base method), a call to super is emited. { ! let CNiceClass nc = cast(notNull(getTypeDefinition(notNull(currentMethod).firstArgument())).getImplementation()); code = nc.callSuperMethod(notNull(superMethod)); } --- 169,173 ---- // the base method), a call to super is emited. { ! let NiceClass nc = cast(notNull(getTypeDefinition(notNull(currentMethod).firstArgument())).getImplementation()); code = nc.callSuperMethod(notNull(superMethod)); } Index: importedconstructor.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/importedconstructor.nice,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** importedconstructor.nice 12 Jan 2005 22:06:53 -0000 1.12 --- importedconstructor.nice 14 Jan 2005 11:12:10 -0000 1.13 *************** *** 86,90 **** } ! public ?ImportedConstructor loadImportedConstructor(CNiceClass def, gnu.bytecode.Method method) { if (! method.isConstructor()) --- 86,90 ---- } ! public ?ImportedConstructor loadImportedConstructor(NiceClass def, gnu.bytecode.Method method) { if (! method.isConstructor()) Index: dispatch.java.bootstrap =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/dispatch.java.bootstrap,v retrieving revision 1.51 retrieving revision 1.52 diff -C2 -d -r1.51 -r1.52 *** dispatch.java.bootstrap 12 Jan 2005 18:50:37 -0000 1.51 --- dispatch.java.bootstrap 14 Jan 2005 11:12:10 -0000 1.52 *************** *** 48,51 **** --- 48,60 ---- { return null; } + public static LocatedString NiceClass_getName(Object nc) + { return null; } + + public static gnu.expr.ClassExp NiceClass_createClassExp(Object nc) + { return null; } + + public static Definition NiceClass_importMethod(Object nc, gnu.bytecode.Method method) + { return null; } + public static void _printStackTraceWithSourceInfo(Throwable t) {} } Index: constructor.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/constructor.nice,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** constructor.nice 13 Jan 2005 23:56:06 -0000 1.6 --- constructor.nice 14 Jan 2005 11:12:10 -0000 1.7 *************** *** 21,25 **** abstract class Constructor extends MethodDeclaration { ! CNiceClass classe; final boolean isDefault; --- 21,25 ---- abstract class Constructor extends MethodDeclaration { ! NiceClass classe; final boolean isDefault; |
From: Arjan B. <ar...@us...> - 2005-01-14 11:12:19
|
Update of /cvsroot/nice/Nice/src/bossa/modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3346/F:/nice/src/bossa/modules Modified Files: Package.java Log Message: Converted the last piece of NiceClass. Index: Package.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/modules/Package.java,v retrieving revision 1.133 retrieving revision 1.134 diff -C2 -d -r1.133 -r1.134 *** Package.java 31 Dec 2004 20:23:31 -0000 1.133 --- Package.java 14 Jan 2005 11:12:08 -0000 1.134 *************** *** 608,617 **** static final String packageClassName = "fun"; ! public ClassExp getClassExp(NiceClass def) { if (compiling()) ! return def.createClassExp(); ! String name = def.getName().toString(); ClassType classe = source.readClass(name); if (classe == null) --- 608,617 ---- static final String packageClassName = "fun"; ! public ClassExp getClassExp(Object def) { if (compiling()) ! return bossa.syntax.dispatch.NiceClass_createClassExp(def); ! String name = bossa.syntax.dispatch.NiceClass_getName(def).toString(); ClassType classe = source.readClass(name); if (classe == null) *************** *** 625,629 **** /** Load methods compiled in a class (custom constructors for now). */ ! private void importMethods(NiceClass def, ClassType classe) { for(Method method = classe.getMethods(); --- 625,629 ---- /** Load methods compiled in a class (custom constructors for now). */ ! private void importMethods(Object def, ClassType classe) { for(Method method = classe.getMethods(); *************** *** 631,635 **** method = method.getNext()) { ! Definition d = def.importMethod(method); if (d != null) definitions.add(d); --- 631,635 ---- method = method.getNext()) { ! Definition d = bossa.syntax.dispatch.NiceClass_importMethod(def, method); if (d != null) definitions.add(d); |
From: Arjan B. <ar...@us...> - 2005-01-13 23:56:18
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6384/F:/nice/src/bossa/syntax Modified Files: call.nice constructor.nice defaultMethod.nice javaclass.nice monotype.nice typeIdent.nice Log Message: Removed dead code. Index: typeIdent.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/typeIdent.nice,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** typeIdent.nice 12 Jan 2005 22:06:54 -0000 1.3 --- typeIdent.nice 13 Jan 2005 23:56:06 -0000 1.4 *************** *** 129,144 **** } - - public Monotype createTypeIdent(LocatedString name) - { - return new TypeIdent(name: name); - } - /* - public mlsub.typing.Interface[?] resolveToItf(TypeMap scope, ?List<TypeIdent> idents) - { - if (idents==null || idents.size()==0) - return null; - - return idents.mapToArray(TypeIdent ti => ti.resolveToItf(scope)); - } - */ \ No newline at end of file --- 129,130 ---- Index: monotype.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/monotype.nice,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** monotype.nice 12 Jan 2005 22:06:53 -0000 1.8 --- monotype.nice 13 Jan 2005 23:56:06 -0000 1.9 *************** *** 76,82 **** /** called instead of toString if parenthesis are unnecessary */ public String toStringExtern() = this.toString(); - - /** don't print type parameters */ - public String toStringBase() = this.toString(); } --- 76,79 ---- Index: javaclass.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/javaclass.nice,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** javaclass.nice 20 Dec 2004 20:25:53 -0000 1.4 --- javaclass.nice 13 Jan 2005 23:56:06 -0000 1.5 *************** *** 81,104 **** } - - /** - * Returns a java type constructor with the given name - * and the given java type. - * <p> - * Usefull for primitive types. - */ - TypeConstructor makeJavaClass(bossa.modules.Compilation compilation, String name, - gnu.bytecode.Type javaType) - { - ?TypeConstructor tc = compilation.javaTypeConstructors.get(javaType); - if(tc!=null) - return tc; - - // we put the new JTC in the hashtable in the constructor - // and not after it returned, to avoid infinite loop - // if the code of the constructor does a lookup. - return createJavaType(compilation, name, javaType); - } - /** * @return null, except if javaName already had an --- 81,84 ---- Index: call.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/call.nice,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** call.nice 13 Jan 2005 16:47:34 -0000 1.9 --- call.nice 13 Jan 2005 23:56:06 -0000 1.10 *************** *** 254,266 **** } - public Expression createCallExp(Expression function, - Expression param1, Expression param2, - Expression param3) - { - let res = new CallExp(function:function, arguments:new Arguments(arguments: [new Argument(value: param1), new Argument(value: param2), new Argument(value: param3)])); - res.setLocation(function.location()); - return res; - } - public Expression createCallExp(Expression func, Arguments args, boolean infix, boolean hasBrackets) { --- 254,257 ---- Index: defaultMethod.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/defaultMethod.nice,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** defaultMethod.nice 3 Jan 2005 01:24:28 -0000 1.6 --- defaultMethod.nice 13 Jan 2005 23:56:06 -0000 1.7 *************** *** 85,93 **** } - void typedResolve() - { - notNull(declaration).typedResolve(); - } - void innerTypecheck() { --- 85,88 ---- Index: constructor.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/constructor.nice,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** constructor.nice 4 Jan 2005 21:20:39 -0000 1.5 --- constructor.nice 13 Jan 2005 23:56:06 -0000 1.6 *************** *** 14,19 **** import bossa.util.*; - //import mlsub.typing.Constraint; - //import mlsub.typing.Monotype; /** --- 14,17 ---- |
From: Arjan B. <ar...@us...> - 2005-01-13 23:33:10
|
Update of /cvsroot/nice/Nice In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv659/Nice Modified Files: NEWS Log Message: Print number of errors and warnings at the end of compilation if any. Index: NEWS =================================================================== RCS file: /cvsroot/nice/Nice/NEWS,v retrieving revision 1.57 retrieving revision 1.58 diff -C2 -d -r1.57 -r1.58 *** NEWS 19 Dec 2004 14:44:46 -0000 1.57 --- NEWS 13 Jan 2005 23:33:00 -0000 1.58 *************** *** 23,26 **** --- 23,27 ---- * Java methods and fields with parametric types are given a type with UnknownTypes as type parameters instead of being ignored. + * Number of errors and warning are printed in the console. * Bug fixes (disallowed redefinition of parameters, execution order of initializers in super classes, visibility checking of java classes, |
From: Arjan B. <ar...@us...> - 2005-01-13 19:27:23
|
Update of /cvsroot/nice/Nice/src/nice/tools/compiler/console In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8057/F:/nice/src/nice/tools/compiler/console Modified Files: listener.nice main.nice Log Message: Print number of errors and warnings at the end of compilation if any. Index: main.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/nice/tools/compiler/console/main.nice,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** main.nice 11 Aug 2004 16:09:35 -0000 1.9 --- main.nice 13 Jan 2005 19:27:09 -0000 1.10 *************** *** 166,169 **** --- 166,186 ---- int res = consOutput.statusCode; + if (res != BUG) + { + if (consOutput.errorCount > 0) + { + String msg = "compilation failed with " + consOutput.errorCount + + " error" + (consOutput.errorCount > 1 ? "s" : ""); + if (consOutput.warningCount > 0) + msg = msg + " and " + consOutput.warningCount + + " warning" + (consOutput.warningCount > 1 ? "s" : ""); + + println(msg); + } + else if (consOutput.warningCount > 0) + println("compilation completed with " + consOutput.warningCount + + " warning" + (consOutput.warningCount > 1 ? "s" : "")); + } + if (memInfo) printMemoryUsage(); Index: listener.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/nice/tools/compiler/console/listener.nice,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** listener.nice 3 Sep 2004 16:21:49 -0000 1.4 --- listener.nice 13 Jan 2005 19:27:09 -0000 1.5 *************** *** 23,26 **** --- 23,29 ---- public final class ConsoleOutput extends StatusCodeListener { + int errorCount = 0; + int warningCount = 0; + progress(packageName, phase) { *************** *** 39,42 **** --- 42,46 ---- { super; + warningCount++; if (location != null) System.out.println("\n" + location + ":\nwarning: " + message); *************** *** 48,51 **** --- 52,56 ---- { super; + errorCount++; if (location != null) System.err.println("\n" + location + ":\n" + message); |
From: Arjan B. <ar...@us...> - 2005-01-13 16:47:52
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4275/F:/nice/src/bossa/syntax Modified Files: Node.java VarScope.java analyse.nice assign.nice call.nice enum.nice formalParameters.nice globalvar.nice overloadedsymbol.nice symbol.nice tools.nice Added Files: Symbol.java arguments.nice Removed Files: Arguments.java VarSymbol.java Log Message: Converted VarSymbol and Arguments. Index: analyse.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/analyse.nice,v retrieving revision 1.124 retrieving revision 1.125 diff -C2 -d -r1.124 -r1.125 *** analyse.nice 12 Jan 2005 18:50:37 -0000 1.124 --- analyse.nice 13 Jan 2005 16:47:33 -0000 1.125 *************** *** 534,538 **** { CallExp res = new CallExp(function: createOverloadedSymbolExp(symbols, notNull(e.ident)), ! arguments: Arguments.singleArgument(Node.thisExp)); res.setLocation(e.location()); return res; --- 534,538 ---- { CallExp res = new CallExp(function: createOverloadedSymbolExp(symbols, notNull(e.ident)), ! arguments: new Arguments(arguments: [new Argument(value: notNull(Node.thisExp))])); res.setLocation(e.location()); return res; *************** *** 543,547 **** // Make an implicit call to fetch the static field's value. CallExp res = new CallExp(function: createOverloadedSymbolExp(symbols, notNull(e.ident)), ! arguments: Arguments.noArguments()); res.setLocation(e.location()); return res; --- 543,547 ---- // Make an implicit call to fetch the static field's value. CallExp res = new CallExp(function: createOverloadedSymbolExp(symbols, notNull(e.ident)), ! arguments: new Arguments(arguments: [])); res.setLocation(e.location()); return res; --- NEW FILE: Symbol.java --- /**************************************************************************/ /* N I C E */ /* A high-level object-oriented research language */ /* (c) Daniel Bonniot 2004 */ /* */ /* This program is free software; you can redistribute it and/or modify */ /* it under the terms of the GNU General Public License as published by */ /* the Free Software Foundation; either version 2 of the License, or */ /* (at your option) any later version. */ /* */ /**************************************************************************/ package bossa.syntax; /** A variable (local, field of a class, parameter of a method or function). temporarily abstract superclass of VarSymbol */ public abstract class Symbol extends Node { public Symbol(LocatedString name) { super(Node.upper); this.name = name; addSymbol(this); } LocatedString name; // commenting this triggers a bug abstract mlsub.typing.Polytype getType(); } --- NEW FILE: arguments.nice --- /**************************************************************************/ /* N I C E */ /* A high-level object-oriented research language */ /* (c) Daniel Bonniot 2004 */ /* */ /* This program is free software; you can redistribute it and/or modify */ /* it under the terms of the GNU General Public License as published by */ /* the Free Software Foundation; either version 2 of the License, or */ /* (at your option) any later version. */ /* */ /**************************************************************************/ package bossa.syntax; import java.util.*; import bossa.util.*; /** Arguments of a function call. */ public class Arguments { Argument[] arguments; /** Hold real parameter, after default parameters and parameter reordering has been done. */ Expression[?] computedExpressions = null; java.util.Map<VarSymbol, Expression[]> applicationExpressions = new java.util.HashMap(); // Map actual arguments to formal arguments. Indexes are 1-based. java.util.Map<VarSymbol, int[]> usedArguments = new java.util.HashMap(); java.util.Map<VarSymbol,mlsub.typing.Polytype> types = new java.util.HashMap(); public void addReceiver(Expression value) { if (arguments[0] != null) Internal.error("No room for \"receiver\""); arguments[0] = new Argument(value: value); } void add(Expression arg, ?LocatedString name) { Argument[] newArgs = cast(new Argument[arguments.length + 1]); System.arraycopy(arguments, 0, newArgs, 0, arguments.length); newArgs[arguments.length] = new Argument(value: arg, name: name); arguments = newArgs; } int size() { if (computedExpressions != null) return notNull(computedExpressions).length; else return arguments.length; } Argument get(int num) { return arguments[num]; } Expression getExp(int num) { if (computedExpressions != null) return notNull(computedExpressions)[num]; else return arguments[num].value; } void setExp(int num, Expression value) { arguments[num].value = value; } void noOverloading() { for (int i = arguments.length; --i>=0; ) arguments[i].value = arguments[i].value.noOverloading(); } void computeTypes() { for (int i = arguments.length; --i>=0; ) arguments[i].value.getType(); } Expression[] inOrder() { if (arguments.length == 0) return Expression.noExpressions; Expression[] res = cast(new Expression[arguments.length]); for (int i = arguments.length; --i>=0; ) res[i] = arguments[i].value; return res; } ?gnu.bytecode.ClassType staticClass() { let res = this.getExp(0).staticClass(); if (res != null) // the first argument was fake, remove it { Argument[] newArgs = cast(new Argument[arguments.length - 1]); System.arraycopy(arguments, 1, newArgs, 0, newArgs.length); arguments = newArgs; } return res; } Expression[?] getExpressions(VarSymbol s) = applicationExpressions.get(s); int[?] getUsedArguments(VarSymbol s) = usedArguments.get(s); /** return true if there are arity non-tagged arguments. */ boolean plainApplication(int arity, VarSymbol symbol) { if (arguments.length != arity) return false; for (int i = 0; i<arguments.length; i++) if (arguments[i].name != null) return false; applicationExpressions.put(symbol, this.inOrder()); return true; } toString() = "(" + Util.map("", ", ", "", arguments) + ")"; public String toStringInfix() { StringBuffer res = new StringBuffer("("); for (int i = 1; i<arguments.length; i++) res.append(arguments[i].toString() + (i + 1 < arguments.length ? ", " : "")); return res.append(")").toString(); } public String printTypes() { StringBuffer res = new StringBuffer("("); for (int i = 0; i<arguments.length; i++) res.append((arguments[i].name == null ? "" : notNull(arguments[i].name) + ":") + arguments[i].value.getType() + (i + 1 < arguments.length ? ", " : "")); return res.append(")").toString(); } } public Arguments createArguments(List<Argument> args) { return new Arguments(arguments: args.toArray()); } public class Argument { private Expression value; ?LocatedString name = null; toString() = (name == null ? "" : notNull(name) + ":" ) + value; } Index: enum.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/enum.nice,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** enum.nice 12 Jan 2005 18:50:37 -0000 1.12 --- enum.nice 13 Jan 2005 16:47:34 -0000 1.13 *************** *** 131,135 **** { res = new gnu.expr.Declaration(name.toString(), nice.tools.code.Types.javaType(type)); ! this.setDeclaration(res); definition.module.addGlobalVar(res, true); } --- 131,135 ---- { res = new gnu.expr.Declaration(name.toString(), nice.tools.code.Types.javaType(type)); ! this.setDeclaration(notNull(res)); definition.module.addGlobalVar(res, true); } *************** *** 175,187 **** Monotype type = new TypeIdent(name: enumName); type.nullness = /*absent*/3; ! List<Arguments.Argument> args = new ArrayList(2 + fields.size()); ! args.add(new Arguments.Argument(createStringConstantExp(name.toString()), ! new LocatedString("name",name.location))); ! args.add(new Arguments.Argument(createIntConstantExp(ordinal, notNull(name.location())), ! new LocatedString("ordinal", name.location))); for (int i = 0; i < fields.size(); i++) ! args.add(new Arguments.Argument(argExps[i], fields[i].getName())); return new EnumSymbol(name, syntacticType: type, definition: def, value: ! createNewExp(new TypeIdent(name: enumName), new Arguments(args))); } --- 175,187 ---- Monotype type = new TypeIdent(name: enumName); type.nullness = /*absent*/3; ! List<Argument> args = new ArrayList(2 + fields.size()); ! args.add(new Argument(value: createStringConstantExp(name.toString()), ! name: new LocatedString("name",name.location))); ! args.add(new Argument(value: createIntConstantExp(ordinal, notNull(name.location())), ! name: new LocatedString("ordinal", name.location))); for (int i = 0; i < fields.size(); i++) ! args.add(new Argument(value: argExps[i], name: fields[i].getName())); return new EnumSymbol(name, syntacticType: type, definition: def, value: ! createNewExp(new TypeIdent(name: enumName), new Arguments(arguments: args.toArray()))); } Index: overloadedsymbol.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/overloadedsymbol.nice,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** overloadedsymbol.nice 3 Jan 2005 01:24:28 -0000 1.11 --- overloadedsymbol.nice 13 Jan 2005 16:47:34 -0000 1.12 *************** *** 125,129 **** mlsub.typing.Polytype[] argsType = ! this.computeArgsType(arguments.getExpressions(s), s.getClonedType(), arguments.getUsedArguments(s)); --- 125,129 ---- mlsub.typing.Polytype[] argsType = ! this.computeArgsType(notNull(arguments.getExpressions(s)), s.getClonedType(), arguments.getUsedArguments(s)); *************** *** 322,327 **** try { let res = new CallExp(function: createOverloadedSymbolExp(fieldAccesses, ident, true), ! //Arguments.noArguments()); ! arguments: new Arguments([new Arguments.Argument(Node.thisExp)])); res.setLocation(ident.location()); --- 322,326 ---- try { let res = new CallExp(function: createOverloadedSymbolExp(fieldAccesses, ident, true), ! arguments: new Arguments(arguments: [new Argument(value: notNull(Node.thisExp))])); res.setLocation(ident.location()); *************** *** 624,629 **** for (int i = 0; i < syms.length; i++) for (int j = i+1; j < syms.length; j++) ! if (overlappingJavaMethods(cast(syms[i].getMethodDeclaration()), ! cast(syms[j].getMethodDeclaration()))) { // We can remove either, since they lead to the same implementation --- 623,628 ---- for (int i = 0; i < syms.length; i++) for (int j = i+1; j < syms.length; j++) ! if (overlappingJavaMethods(syms[i].getMethodDeclaration(), ! syms[j].getMethodDeclaration())) { // We can remove either, since they lead to the same implementation *************** *** 636,641 **** } ! private boolean overlappingJavaMethods(MethodDeclaration m1, ! MethodDeclaration m2) { if (! (m1 instanceof JavaMethod) || --- 635,640 ---- } ! private boolean overlappingJavaMethods(?MethodDeclaration m1, ! ?MethodDeclaration m2) { if (! (m1 instanceof JavaMethod) || *************** *** 656,661 **** { for (noMatch : noMatches) ! if (noMatch.isFunSymbol()) ! argnames.retainAll(args.noMatchByName(cast(noMatch.getFormalParameters()))); if (!argnames.isEmpty()) --- 655,660 ---- { for (noMatch : noMatches) ! if (noMatch instanceof FunSymbol) ! argnames.retainAll(args.noMatchByName(noMatch.getFormalParameters())); if (!argnames.isEmpty()) Index: tools.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/tools.nice,v retrieving revision 1.96 retrieving revision 1.97 diff -C2 -d -r1.96 -r1.97 *** tools.nice 12 Jan 2005 22:06:54 -0000 1.96 --- tools.nice 13 Jan 2005 16:47:34 -0000 1.97 *************** *** 203,216 **** ****************************************************************/ - LocatedString name(VarSymbol) = native VarSymbol.name; - Arguments.Argument[] arguments(Arguments) = native Arguments.arguments; - Arguments Argument(List<Arguments.Argument>) = native new Arguments(List); - Arguments Argument(Arguments.Argument[]) = native new Arguments(Arguments.Argument[]); mlsub.typing.Polytype getType(Expression) = native mlsub.typing.Polytype Expression.getType(); GlobalTypeScope getGlobalTypeScope() = native GlobalTypeScope Node.getGlobalTypeScope(); - ?gnu.bytecode.ClassType staticClass(Arguments) = native gnu.bytecode.ClassType Arguments.staticClass(); ?gnu.bytecode.ClassType staticClass(Expression) = native gnu.bytecode.ClassType Expression.staticClass(); - Map<VarSymbol,mlsub.typing.Polytype> types(Arguments) = native Arguments.types; <T> String map(String, String, String, T[]) = native String bossa.util.Util.map(String, String, String, Object[]); <T> String map(String, String, String, ?Collection<T>) = native String bossa.util.Util.map(String, String, String, Collection); --- 203,210 ---- *************** *** 219,223 **** ?Object getFieldAccessMethod(Expression) = native Object Expression.getFieldAccessMethod(); ?Object getField(Expression) = native Object Expression.getField(); - ?Object getFieldAccessMethod(VarSymbol) = native Object VarSymbol.getFieldAccessMethod(); ?mlsub.typing.Monotype Types_getTypeParameter(mlsub.typing.Polytype, int) = native mlsub.typing.Monotype nice.tools.typing.Types.getTypeParameter(mlsub.typing.Polytype, int); ?mlsub.typing.Monotype Types_getTypeParameter(mlsub.typing.Monotype, int) = native mlsub.typing.Monotype nice.tools.typing.Types.getTypeParameter(mlsub.typing.Monotype, int); --- 213,216 ---- *************** *** 225,229 **** ?mlsub.typing.TypeConstructor head(mlsub.typing.Monotype) = native mlsub.typing.TypeConstructor mlsub.typing.Monotype.head(); ?gnu.bytecode.ClassType getSuperclass(gnu.bytecode.ClassType) = native gnu.bytecode.ClassType gnu.bytecode.ClassType.getSuperclass(); - int[?] getUsedArguments(Arguments, VarSymbol) = native int[] Arguments.getUsedArguments(VarSymbol); ?mlsub.typing.Constraint getConstraint(mlsub.typing.Polytype) = native mlsub.typing.Constraint mlsub.typing.Polytype.getConstraint(); mlsub.typing.AtomicConstraint[?] AtomicConstraint_substitute(java.util.Map<mlsub.typing.TypeSymbol,mlsub.typing.TypeSymbol>, AtomicConstraint[?]) = native mlsub.typing.AtomicConstraint[] mlsub.typing.AtomicConstraint.substitute(java.util.Map, mlsub.typing.AtomicConstraint[]); --- 218,221 ---- *************** *** 233,237 **** ?gnu.bytecode.Attribute get(gnu.bytecode.AttrContainer, String) = native gnu.bytecode.Attribute gnu.bytecode.Attribute.get(gnu.bytecode.AttrContainer, String); void printInterface(Definition, java.io.PrintWriter) = native void Definition.printInterface(java.io.PrintWriter); - ?gnu.expr.Declaration getDeclaration(VarSymbol) = native gnu.expr.Declaration VarSymbol.getDeclaration(); void printInterface(ClassImplementation, java.io.PrintWriter) = native void ClassImplementation.printInterface(java.io.PrintWriter); ?gnu.bytecode.Type TypeImport_lookup(LocatedString) = native gnu.bytecode.Type nice.tools.code.TypeImport.lookup(LocatedString); --- 225,228 ---- *************** *** 245,250 **** List<VarSymbol> lookup(VarScope, LocatedString) = native List VarScope.lookup(LocatedString); Map<gnu.bytecode.Type,mlsub.typing.TypeConstructor> javaTypeConstructors(bossa.modules.Compilation ) = native bossa.modules.Compilation.javaTypeConstructors; ! Map<VarSymbol, int[]> usedArguments(Arguments) = native Arguments.usedArguments; ! Map<VarSymbol, Expression[]> applicationExpressions(Arguments) = native Arguments.applicationExpressions; // Retypings needed since java types are not strict. --- 236,240 ---- List<VarSymbol> lookup(VarScope, LocatedString) = native List VarScope.lookup(LocatedString); Map<gnu.bytecode.Type,mlsub.typing.TypeConstructor> javaTypeConstructors(bossa.modules.Compilation ) = native bossa.modules.Compilation.javaTypeConstructors; ! LocatedString name(Symbol) = native Symbol.name; // Retypings needed since java types are not strict. Index: Node.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/Node.java,v retrieving revision 1.66 retrieving revision 1.67 diff -C2 -d -r1.66 -r1.67 *** Node.java 10 Jan 2005 23:58:04 -0000 1.66 --- Node.java 13 Jan 2005 16:47:33 -0000 1.67 *************** *** 91,95 **** } ! void addSymbol(VarSymbol s) { if (varSymbols == null) --- 91,95 ---- } ! void addSymbol(/*VarSymbol*/Symbol s) { if (varSymbols == null) Index: formalParameters.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/formalParameters.nice,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** formalParameters.nice 12 Jan 2005 22:06:53 -0000 1.5 --- formalParameters.nice 13 Jan 2005 16:47:34 -0000 1.6 *************** *** 138,142 **** for (int i = 0; i< args.size(); i++) { ! Arguments.Argument a = args.get(i); if (a.name != null) if (this.fill(map, notNull(a.name).toString(), i)) --- 138,142 ---- for (int i = 0; i< args.size(); i++) { ! Argument a = args.get(i); if (a.name != null) if (this.fill(map, notNull(a.name).toString(), i)) *************** *** 147,151 **** for (int i = 0; i< args.size(); i++) { ! Arguments.Argument a = args.get(i); if (a.name == null) if (this.fill(map, i)) --- 147,151 ---- for (int i = 0; i< args.size(); i++) { ! Argument a = args.get(i); if (a.name == null) if (this.fill(map, i)) Index: symbol.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/symbol.nice,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** symbol.nice 12 Jan 2005 22:06:54 -0000 1.8 --- symbol.nice 13 Jan 2005 16:47:34 -0000 1.9 *************** *** 13,16 **** --- 13,123 ---- package bossa.syntax; + import bossa.util.*; + + /** + A variable (local, field of a class, parameter of a method or function). + + */ + public abstract class VarSymbol extends Symbol implements Located + { + private ?gnu.expr.Declaration decl = null; + private boolean isThis = false; + + location() = notNull(name.location()); + + public LocatedString getName() = name; + + public boolean hasName(LocatedString i) = this.name.equals(i); + + boolean isAssignable() = true; + + boolean isFieldAccess() = this.getFieldAccessMethod() != null; + + ?FieldAccess getFieldAccessMethod() = null; + + public ?MethodDeclaration getMethodDeclaration() = null; + + boolean isIgnored() = false; + + void checkSpecialRequirements(Expression[?] arguments) + { + // Do nothing by default. + } + + public ?Definition getDefinition() = null; + + // uncommenting this triggers a bug + // mlsub.typing.Polytype getType(); + + /** + @return + 0 : doesn't match + 1 : wasn't even a function + 2 : matches + */ + int match(Arguments arguments) = 1; + + /** + * Specialized by MethodSymbol only. + */ + String defaultExplainWhyMatchFails(Arguments arguments) + { + return this.explainWhyMatchFails(arguments); + } + + /** This returns a generic explanation. + A more precise message should be returned if possible in subclasses. + */ + String explainWhyMatchFails(Arguments arguments) + { + return "Incorrect call to " + name; + } + + // explained in OverloadedSymbolExp + void makeClonedType(); + void releaseClonedType(); + mlsub.typing.Polytype getClonedType(); + + /** @return code that accesses this variable. */ + gnu.expr.Expression compile() + { + // Allow a sub-class to compute decl a la demande in getDeclaration(). + let decl = this.getDeclaration(); + + if (decl == null) + Internal.error(this + " has no bytecode declaration"); + + if (isThis) + return new gnu.expr.ThisExp(decl); + else + return new gnu.expr.ReferenceExp(name == null ? null : name.toString(), + decl); + } + + /** @return code that accesses this variable, when it is used + as the function of a call. */ + gnu.expr.Expression compileInCallPosition() + { + // Default implementation. + return this.compile(); + } + + ?gnu.expr.Declaration getDeclaration() = decl; + + public void setDeclaration(gnu.expr.Declaration declaration) + { + this.setDeclaration(declaration, false); + } + + public void setDeclaration(gnu.expr.Declaration declaration, boolean isThis) + { + this.decl = declaration; + this.isThis = isThis; + if (name != null) + notNull(name.location).write(notNull(this.decl)); + notNull(this.decl).setCanRead(true); + notNull(this.decl).setCanWrite(true); + } + } /** *************** *** 31,46 **** boolean used = false; - /* public MonoSymbol(LocatedString name, Monotype type) - { - super(name); - this.syntacticType=type; - } - - public MonoSymbol(LocatedString name, mlsub.typing.Monotype type) - { - super(name); - this.type = type; - } - */ getType() = new mlsub.typing.Polytype(type); --- 138,141 ---- *************** *** 186,192 **** int arity; ! isFunSymbol() = true; ! ! getFormalParameters() = cast(this.parameters); String describeParameters() --- 281,285 ---- int arity; ! ?FormalParameters getFormalParameters() = this.parameters; String describeParameters() Index: assign.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/assign.nice,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** assign.nice 7 Dec 2004 17:33:57 -0000 1.5 --- assign.nice 13 Jan 2005 16:47:34 -0000 1.6 *************** *** 41,50 **** if (to instanceof CallExp && "get".equals(to.function.toString())) { ! List<Arguments.Argument> args = new ArrayList(to.arguments.arguments); ! args.add(new Arguments.Argument(value)); return createCallExp( createIdentExp(new LocatedString("set", to.function.location())), ! new Arguments(args)); } --- 41,50 ---- if (to instanceof CallExp && "get".equals(to.function.toString())) { ! List<Argument> args = new ArrayList(to.arguments.arguments); ! args.add(new Argument(value: value)); return createCallExp( createIdentExp(new LocatedString("set", to.function.location())), ! new Arguments(arguments: args.toArray())); } Index: call.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/call.nice,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** call.nice 10 Jan 2005 23:58:04 -0000 1.8 --- call.nice 13 Jan 2005 16:47:34 -0000 1.9 *************** *** 224,228 **** { SymbolExp func = cast(function); ! Definition def = func.symbol.getDefinition(); if (def instanceof RetypedJavaMethod) --- 224,228 ---- { SymbolExp func = cast(function); ! let def = func.symbol.getDefinition(); if (def instanceof RetypedJavaMethod) *************** *** 241,245 **** Expression param1) { ! let res = new CallExp(function:function, arguments:new Arguments([new Arguments.Argument(param1)])); res.setLocation(function.location()); return res; --- 241,245 ---- Expression param1) { ! let res = new CallExp(function:function, arguments:new Arguments(arguments: [new Argument(value: param1)])); res.setLocation(function.location()); return res; *************** *** 249,253 **** Expression param1, Expression param2) { ! let res = new CallExp(function:function, arguments:new Arguments([new Arguments.Argument(param1), new Arguments.Argument(param2)])); res.setLocation(function.location()); return res; --- 249,253 ---- Expression param1, Expression param2) { ! let res = new CallExp(function:function, arguments:new Arguments(arguments: [new Argument(value: param1), new Argument(value: param2)])); res.setLocation(function.location()); return res; *************** *** 258,262 **** Expression param3) { ! let res = new CallExp(function:function, arguments:new Arguments([new Arguments.Argument(param1), new Arguments.Argument(param2), new Arguments.Argument(param3)])); res.setLocation(function.location()); return res; --- 258,262 ---- Expression param3) { ! let res = new CallExp(function:function, arguments:new Arguments(arguments: [new Argument(value: param1), new Argument(value: param2), new Argument(value: param3)])); res.setLocation(function.location()); return res; Index: VarScope.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/VarScope.java,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** VarScope.java 9 Dec 2003 15:21:05 -0000 1.19 --- VarScope.java 13 Jan 2005 16:47:33 -0000 1.20 *************** *** 37,41 **** } ! void addSymbol(VarSymbol s) { this.defs.put(s.name,s); --- 37,41 ---- } ! void addSymbol(/*VarSymbol*/Symbol s) { this.defs.put(s.name,s); *************** *** 52,57 **** while(i.hasNext()) { ! VarSymbol s = (VarSymbol)i.next(); addSymbol(s); } } --- 52,58 ---- while(i.hasNext()) { ! /*VarSymbol*/Symbol s = (/*VarSymbol*/Symbol)i.next(); addSymbol(s); + } } *************** *** 60,64 **** Adds a collection of VarSymbols */ ! void addSymbols(VarSymbol[] s) { if (s == null) return; --- 61,65 ---- Adds a collection of VarSymbols */ ! void addSymbols(/*VarSymbol*/Symbol[] s) { if (s == null) return; *************** *** 69,73 **** } ! void removeSymbol(VarSymbol sym) { defs.remove(sym.name, sym); --- 70,74 ---- } ! void removeSymbol(/*VarSymbol*/Symbol sym) { defs.remove(sym.name, sym); Index: globalvar.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/globalvar.nice,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** globalvar.nice 11 Jan 2005 21:45:46 -0000 1.3 --- globalvar.nice 13 Jan 2005 16:47:34 -0000 1.4 *************** *** 72,76 **** res = new gnu.expr.Declaration (name.toString(), nice.tools.code.Types.javaType(type)); ! this.setDeclaration(res); if (! definition.inInterfaceFile()) --- 72,76 ---- res = new gnu.expr.Declaration (name.toString(), nice.tools.code.Types.javaType(type)); ! this.setDeclaration(notNull(res)); if (! definition.inInterfaceFile()) --- Arguments.java DELETED --- --- VarSymbol.java DELETED --- |
From: Arjan B. <ar...@us...> - 2005-01-13 16:47:49
|
Update of /cvsroot/nice/Nice/src/nice/tools/code In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4275/F:/nice/src/nice/tools/code Modified Files: Gen.java Log Message: Converted VarSymbol and Arguments. Index: Gen.java =================================================================== RCS file: /cvsroot/nice/Nice/src/nice/tools/code/Gen.java,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** Gen.java 13 Jan 2005 14:06:14 -0000 1.23 --- Gen.java 13 Jan 2005 16:47:32 -0000 1.24 *************** *** 15,20 **** import gnu.bytecode.*; import gnu.expr.*; - //import bossa.syntax.MonoSymbol; - import bossa.syntax.VarSymbol; /** --- 15,18 ---- |
From: Arjan B. <ar...@us...> - 2005-01-13 16:47:46
|
Update of /cvsroot/nice/Nice/src/bossa/parser In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4275/F:/nice/src/bossa/parser Modified Files: Parser.jj Log Message: Converted VarSymbol and Arguments. Index: Parser.jj =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/parser/Parser.jj,v retrieving revision 1.303 retrieving revision 1.304 diff -C2 -d -r1.303 -r1.304 *** Parser.jj 12 Jan 2005 22:06:50 -0000 1.303 --- Parser.jj 13 Jan 2005 16:47:31 -0000 1.304 *************** *** 2238,2246 **** { { Token t; List bracketArgs = new ArrayList(); ! bracketArgs.add(new Arguments.Argument(start)); } ! t="[" res=Expression() {bracketArgs.add(new Arguments.Argument(res));} ! ( "," res=Expression() {bracketArgs.add(new Arguments.Argument(res));} )* "]" ! { return bossa.syntax.dispatch.createCallExp(symb("get",t,false),new Arguments(bracketArgs)); } | "." res=identExp() --- 2238,2246 ---- { { Token t; List bracketArgs = new ArrayList(); ! bracketArgs.add(new Argument(start)); } ! t="[" res=Expression() {bracketArgs.add(new Argument(res));} ! ( "," res=Expression() {bracketArgs.add(new Argument(res));} )* "]" ! { return bossa.syntax.dispatch.createCallExp(symb("get",t,false),bossa.syntax.dispatch.createArguments(bracketArgs)); } | "." res=identExp() *************** *** 2251,2255 **** if (args == null) ! args = Arguments.singleArgument(start); else args.addReceiver(start); --- 2251,2255 ---- if (args == null) ! args = new Arguments(new Argument[]{new Argument(start)}); else args.addReceiver(start); *************** *** 2299,2303 **** { (t="@") ! { return bossa.syntax.dispatch.createCallExp(symb(t), Arguments.noArguments()); } } --- 2299,2303 ---- { (t="@") ! { return bossa.syntax.dispatch.createCallExp(symb(t), new Arguments(new Argument[0])); } } *************** *** 2335,2339 **** } ! Arguments.Argument argument(): { Expression e; --- 2335,2339 ---- } ! Argument argument(): { Expression e; *************** *** 2348,2352 **** e = Expression() ) ! { return new Arguments.Argument(e, id); } } --- 2348,2352 ---- e = Expression() ) ! { return new Argument(e, id); } } *************** *** 2354,2358 **** { List res = new ArrayList(); ! Arguments.Argument a; } { --- 2354,2358 ---- { List res = new ArrayList(); ! Argument a; } { *************** *** 2364,2368 **** ] ")" ! { return new Arguments(res); } } --- 2364,2368 ---- ] ")" ! { return bossa.syntax.dispatch.createArguments(res); } } |
From: Arjan B. <ar...@us...> - 2005-01-13 14:06:29
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3726/F:/nice/src/bossa/syntax Modified Files: customConstructor.nice defaultconstructor.nice funexp.nice methodImplementation.nice niceMethod.nice Added Files: codegen.nice Log Message: Moved a few methods from nice.tools.code.Gen to bossa.syntax. Index: defaultconstructor.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/defaultconstructor.nice,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** defaultconstructor.nice 3 Jan 2005 01:24:28 -0000 1.4 --- defaultconstructor.nice 13 Jan 2005 14:06:15 -0000 1.5 *************** *** 98,102 **** let argsArray = args.toArray(); ! let lambda = nice.tools.code.Gen.createConstructor (thisDecl, argTypesArray, argsArray); lambda.setSuperCall(this.callSuper(thisExp, fullArgs, omitDefaults)); --- 98,102 ---- let argsArray = args.toArray(); ! let lambda = generateConstructor (thisDecl, argTypesArray, argsArray); lambda.setSuperCall(this.callSuper(thisExp, fullArgs, omitDefaults)); Index: niceMethod.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/niceMethod.nice,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** niceMethod.nice 12 Jan 2005 22:06:53 -0000 1.14 --- niceMethod.nice 13 Jan 2005 14:06:15 -0000 1.15 *************** *** 372,377 **** } ! res = nice.tools.code.Gen.createMethod ! (name, argTypes, retType, cast(def.getSymbols()), true, receiver != null); res.parameterCopies = cast(notNull(def.formalParameters()).getParameterCopies()); --- 372,377 ---- } ! res = generateMethod ! (name, argTypes, retType, def.getSymbols(), toplevel: true, member: receiver != null); res.parameterCopies = cast(notNull(def.formalParameters()).getParameterCopies()); Index: methodImplementation.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/methodImplementation.nice,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** methodImplementation.nice 12 Jan 2005 18:50:37 -0000 1.9 --- methodImplementation.nice 13 Jan 2005 14:06:15 -0000 1.10 *************** *** 166,175 **** private void createMethod(String bytecodeName) { ! compiledMethod = ! nice.tools.code.Gen.createMethod(bytecodeName, this.javaArgTypes(), notNull(declaration).javaReturnType(), ! cast(parameters), ! true, false); notNull(compiledMethod).addBytecodeAttribute --- 166,174 ---- private void createMethod(String bytecodeName) { ! compiledMethod = generateMethod(bytecodeName, this.javaArgTypes(), notNull(declaration).javaReturnType(), ! parameters, ! toplevel: true, member: false); notNull(compiledMethod).addBytecodeAttribute --- NEW FILE: codegen.nice --- /**************************************************************************/ /* N I C E */ /* A high-level object-oriented research language */ /* (c) Daniel Bonniot 2004 */ /* */ /* This program is free software; you can redistribute it and/or modify */ /* it under the terms of the GNU General Public License as published by */ /* the Free Software Foundation; either version 2 of the License, or */ /* (at your option) any later version. */ /* */ /**************************************************************************/ package bossa.syntax; /** Create a lambda expression to generate code for the method. @param args can be null if there are no arguments @param member true iff this method is a non-static member of the class in argTypes[0] @param toplevel If the method can be called from foreign code. This forces its generation even if it is apparently never called. */ public gnu.expr.LambdaExp generateMethod(?String bytecodeName, gnu.bytecode.Type[] argTypes, gnu.bytecode.Type retType, MonoSymbol[?] args, boolean toplevel, boolean member = false) { let res = new gnu.expr.LambdaExp(); generateMethod(res, bytecodeName, argTypes, retType, args, toplevel, member, false); return res; } public gnu.expr.ConstructorExp generateConstructor (gnu.expr.Declaration thisDecl, gnu.bytecode.Type[] argTypes, MonoSymbol[?] args) { let res = new gnu.expr.ConstructorExp(thisDecl); generateMethod(res, "<init>", argTypes, gnu.bytecode.Type.void_type, args, true, false, true); return res; } public gnu.expr.ConstructorExp generateCustomConstructor (gnu.bytecode.ClassType classType, gnu.bytecode.Type[] argTypes, MonoSymbol[?] args) { let res = new gnu.expr.ConstructorExp(classType); generateMethod(res, "<init>", argTypes, gnu.bytecode.Type.void_type, args, true, false, true); return res; } /** Create a lambda expression to generate code for the method. @param args can be null if there are no arguments @param member true iff this method is a non-static member of the class in argTypes[0] @param toplevel If the method can be called from foreign code. This forces its generation even if it is apparently never called. */ void generateMethod (gnu.expr.LambdaExp lexp, ?String bytecodeName, gnu.bytecode.Type[] argTypes, gnu.bytecode.Type retType, MonoSymbol[?] args, boolean toplevel, boolean member, boolean constructor) { bytecodeName = nice.tools.code.Strings.escape(bytecodeName); int arity = args == null ? 0 : args.length; lexp.setReturnType(retType); lexp.setName(bytecodeName); lexp.min_args = lexp.max_args = member ? arity - 1 : arity; lexp.forceGeneration(); if (toplevel) lexp.setCanCall(true); if (member) lexp.setClassMethod(true); // Parameters for (int n = 0; n < arity; n++) { boolean isThis = member && n == 0; String parameterName = notNull(args)[n].getName() == null ? "anonymous_" + n : notNull(notNull(args)[n].getName()).toString(); gnu.expr.Declaration d; if (isThis) { d = new gnu.expr.Declaration(parameterName); d.context = lexp; } else d = lexp.addDeclaration(parameterName); if (argTypes != null) d.setType(argTypes[n]); d.noteValue(null); notNull(args)[n].setDeclaration(d, isThis); } } Index: funexp.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/funexp.nice,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** funexp.nice 12 Jan 2005 18:50:37 -0000 1.6 --- funexp.nice 13 Jan 2005 14:06:15 -0000 1.7 *************** *** 116,124 **** compile() { ! gnu.expr.LambdaExp res = nice.tools.code.Gen.createMethod ! (null, nice.tools.code.Types.javaType(getMonotypes(formals)), nice.tools.code.Types.javaType(this.inferredReturnType()), ! cast(formals), false); nice.tools.code.Gen.setMethodBody(res, body.generateCode()); return res; --- 116,124 ---- compile() { ! gnu.expr.LambdaExp res = generateMethod ! (bytecodeName: null, nice.tools.code.Types.javaType(getMonotypes(formals)), nice.tools.code.Types.javaType(this.inferredReturnType()), ! formals, toplevel: false); nice.tools.code.Gen.setMethodBody(res, body.generateCode()); return res; Index: customConstructor.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/customConstructor.nice,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** customConstructor.nice 12 Jan 2005 22:06:53 -0000 1.15 --- customConstructor.nice 13 Jan 2005 14:06:15 -0000 1.16 *************** *** 99,104 **** generatingCode = true; ! let lambda = nice.tools.code.Gen.createCustomConstructor ! (cast(this.javaReturnType()), this.javaArgTypes(), cast(this.getSymbols())); nice.tools.code.Gen.setMethodBody(lambda, body.generateCode()); --- 99,104 ---- generatingCode = true; ! let lambda = generateCustomConstructor ! (cast(this.javaReturnType()), this.javaArgTypes(), this.getSymbols()); nice.tools.code.Gen.setMethodBody(lambda, body.generateCode()); |
From: Arjan B. <ar...@us...> - 2005-01-13 14:06:24
|
Update of /cvsroot/nice/Nice/src/nice/tools/code In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3726/F:/nice/src/nice/tools/code Modified Files: Gen.java Log Message: Moved a few methods from nice.tools.code.Gen to bossa.syntax. Index: Gen.java =================================================================== RCS file: /cvsroot/nice/Nice/src/nice/tools/code/Gen.java,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** Gen.java 11 Jan 2005 21:45:46 -0000 1.22 --- Gen.java 13 Jan 2005 14:06:14 -0000 1.23 *************** *** 90,214 **** (new PrimProcedure(Type.pointer_type.getDeclaredMethod("equals", 1))); - /** - Create a lambda expression to generate code for the method. - - @param args can be null if there are no arguments - */ - public static LambdaExp createMethod(String bytecodeName, - Type[] argTypes, - Type retType, - /*MonoSymbol*/VarSymbol[] args) - { - return createMethod(bytecodeName, argTypes, retType, args, true, false); - } - - /** - @param toplevel If the method can be called from foreign code. - This forces its generation even if it is - apparently never called. - **/ - public static LambdaExp createMethod(String bytecodeName, - Type[] argTypes, - Type retType, - /*MonoSymbol*/VarSymbol[] args, - boolean toplevel) - { - return createMethod(bytecodeName, argTypes, retType, args, toplevel, false); - } - - /** - Create a lambda expression to generate code for the method. - - @param args can be null if there are no arguments - @param member true iff this method is a non-static member of - the class in argTypes[0] - @param toplevel If the method can be called from foreign code. - This forces its generation even if it is - apparently never called. - **/ - public static LambdaExp createMethod(String bytecodeName, - Type[] argTypes, - Type retType, - /*MonoSymbol*/VarSymbol[] args, - boolean toplevel, - boolean member) - { - LambdaExp res = new LambdaExp(); - createMethod(res, bytecodeName, argTypes, retType, args, toplevel, member, false); - return res; - } - - public static ConstructorExp createConstructor - (Declaration thisDecl, Type[] argTypes, /*MonoSymbol*/VarSymbol[] args) - { - ConstructorExp res = new ConstructorExp(thisDecl); - createMethod(res, "<init>", argTypes, Type.void_type, args, - true, false, true); - return res; - } - - public static ConstructorExp createCustomConstructor - (ClassType classType, Type[] argTypes, /*MonoSymbol*/VarSymbol[] args) - { - ConstructorExp res = new ConstructorExp(classType); - createMethod(res, "<init>", argTypes, Type.void_type, args, - true, false, true); - return res; - } - - /** - Create a lambda expression to generate code for the method. - - @param args can be null if there are no arguments - @param member true iff this method is a non-static member of - the class in argTypes[0] - @param toplevel If the method can be called from foreign code. - This forces its generation even if it is - apparently never called. - **/ - private static void createMethod - (LambdaExp lexp, - String bytecodeName, - Type[] argTypes, - Type retType, - /*MonoSymbol*/VarSymbol[] args, - boolean toplevel, - boolean member, - boolean constructor) - { - bytecodeName = nice.tools.code.Strings.escape(bytecodeName); - int arity = args == null ? 0 : args.length; - - lexp.setReturnType(retType); - lexp.setName(bytecodeName); - lexp.min_args = lexp.max_args = member ? arity - 1 : arity; - lexp.forceGeneration(); - if (toplevel) - lexp.setCanCall(true); - if (member) - lexp.setClassMethod(true); - - // Parameters - for(int n = 0; n < arity; n++) - { - boolean isThis = member && n == 0; - String parameterName = args[n].getName() == null - ? "anonymous_" + n - : args[n].getName().toString(); - - gnu.expr.Declaration d; - if (isThis) - { - d = new Declaration(parameterName); - d.context = lexp; - } - else - d = lexp.addDeclaration(parameterName); - if (argTypes != null) - d.setType(argTypes[n]); - d.noteValue(null); - args[n].setDeclaration(d, isThis); - } - } /** --- 90,93 ---- |
From: Arjan B. <ar...@us...> - 2005-01-12 22:07:31
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12858/F:/nice/src/bossa/syntax Modified Files: customConstructor.nice formalParameters.nice importedconstructor.nice monotype.nice niceMethod.nice niceclass.nice nicefieldaccess.nice polytype.nice symbol.nice tools.nice tuple.nice typeIdent.nice typedef.nice Removed Files: Monotype.java Log Message: Converted Monotype. Index: typeIdent.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/typeIdent.nice,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** typeIdent.nice 12 Jan 2005 20:56:30 -0000 1.2 --- typeIdent.nice 12 Jan 2005 22:06:54 -0000 1.3 *************** *** 49,55 **** } ! rawResolve(scope) { ! let res = this.resolveToTypeSymbol(notNull(scope)); if (res instanceof mlsub.typing.Monotype) --- 49,55 ---- } ! rawResolve(tm) { ! let res = this.resolveToTypeSymbol(tm); if (res instanceof mlsub.typing.Monotype) Index: customConstructor.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/customConstructor.nice,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** customConstructor.nice 12 Jan 2005 20:56:30 -0000 1.14 --- customConstructor.nice 12 Jan 2005 22:06:53 -0000 1.15 *************** *** 87,91 **** for (int i = 0; i < source.length; i++) ! res.put(source[i].toString(), new Monotype.MonotypeWrapper(destination[i])); return res; --- 87,91 ---- for (int i = 0; i < source.length; i++) ! res.put(source[i].toString(), new MonotypeWrapper(type: destination[i])); return res; *************** *** 177,181 **** if (! (syms[i] instanceof mlsub.typing.MonotypeVar)) User.error(classe, syms[i] + " is not a type"); ! notNull(params)[i] = new Monotype.MonotypeWrapper(cast(syms[i])); } --- 177,181 ---- if (! (syms[i] instanceof mlsub.typing.MonotypeVar)) User.error(classe, syms[i] + " is not a type"); ! notNull(params)[i] = new MonotypeWrapper(type: cast(syms[i])); } Index: monotype.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/monotype.nice,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** monotype.nice 12 Jan 2005 18:50:37 -0000 1.7 --- monotype.nice 12 Jan 2005 22:06:53 -0000 1.8 *************** *** 16,19 **** --- 16,168 ---- /** + Syntactic monomorphic type. + + */ + public abstract class Monotype implements Located + { + /** Set by the parser. */ + public byte nullness = 0; + /* + public static final byte + none = 0, + maybe = 1, + sure = 2, + absent = 3; + */ + + /** @return true if "alike" appears inside this monotype. */ + boolean containsAlike(); + + mlsub.typing.Monotype rawResolve(TypeMap tm); + + Monotype substitute(Map<String,Monotype> map); + + public boolean isVoid() = false; + + String nullnessString() + { + if (nullness == /*maybe*/1) + return "?"; + else if (nullness == /*sure*/2) + return "!"; + else + return ""; + } + + public mlsub.typing.Monotype resolve(TypeMap tm) + { + mlsub.typing.Monotype raw = this.rawResolve(tm); + + if (nullness == /*none*/0) + return raw; + else if (nullness == /*maybe*/1) + return maybeMonotype(nice.tools.typing.Types.rawType(raw)); + else if (nullness == /*sure*/2) + return sureMonotype(nice.tools.typing.Types.rawType(raw)); + else if (nullness == /*absent*/3) + { + if (raw instanceof mlsub.typing.MonotypeVar) + { + nice.tools.typing.Types.makeMarkedType(raw); + return raw; + } + else + return sureMonotype(raw); + } + else + throw Internal.error("Bad nullness tag"); + } + + /** called instead of toString if parenthesis are unnecessary */ + public String toStringExtern() = this.toString(); + + /** don't print type parameters */ + public String toStringBase() = this.toString(); + } + + /** iterates resolve() on the collection of Monotype */ + mlsub.typing.Monotype[?] resolveMonotypes(TypeMap s, Monotype[?] c) + { + if(c == null || c.length == 0) + return null; + + mlsub.typing.Monotype[] res = cast(new mlsub.typing.Monotype[c.length]); + + for (int n = c.length; --n >= 0;) + { + let old = c[n]; + let nou = old.resolve(s); + + if (nou == null) + User.error(old, old + " : Monotype not defined"); + + res[n] = nou; + } + return res; + } + + /** + Wrapping a mlsub Monotype in a syntactic monotype + */ + public class MonotypeWrapper extends Monotype + { + final mlsub.typing.Monotype type; + + containsAlike() = false; + + rawResolve(tm) = type; + + substitute(map) = this; + + location() = Location.nowhere(); + + toString() = String.valueOf(type); + } + + public final class MonotypeVarWrapper extends MonotypeWrapper + { + rawResolve(tm) + { + let res = tm.lookup(type.toString()); + if (res != null) + return cast(res); + + return type; + } + } + + /** + Wrapper for delaying resolution of constructed monotypes. + */ + public final class SureMonotypeWrapper extends Monotype + { + mlsub.typing.TypeConstructor tc; + mlsub.typing.Monotype[?] params; + + containsAlike() = false; + + rawResolve(tm) + { + try{ + return sureMonotype(new mlsub.typing.MonotypeConstructor(tc, params)); + } + catch(mlsub.typing.BadSizeEx e){ + // See if this is a class with default type parameters + let res = getTypeWithTC(tc, params); + if (res != null) + return sureMonotype(res); + + throw User.error(this, "Class " + tc + Util.has(e.expected, "type parameter", e.actual)); + } + } + + substitute(map) = this; + + location() = Location.nowhere(); + + toString() = tc + ( params != null ? Util.map("<",",",">",params) : ""); + } + + /** A monotype, build by application of a type constructor to type parameters. *************** *** 30,38 **** Monotype cloneType() = new MonotypeConstructor(tc:tc,parameters:parameters,loc:loc); ! rawResolve(typeMap) { if (lowlevelTC == null) { ! let newTC = notNull(this.tc).resolveToTC(notNull(typeMap)); if (! (newTC instanceof TypeConstructor)) throw User.error(notNull(this.tc), notNull(this.tc)+" should be a type constructor"); --- 179,187 ---- Monotype cloneType() = new MonotypeConstructor(tc:tc,parameters:parameters,loc:loc); ! rawResolve(tm) { if (lowlevelTC == null) { ! let newTC = notNull(this.tc).resolveToTC(tm); if (! (newTC instanceof TypeConstructor)) throw User.error(notNull(this.tc), notNull(this.tc)+" should be a type constructor"); *************** *** 40,44 **** } ! mlsub.typing.Monotype[?] resolvedParams = parameters.resolve(notNull(typeMap)); try{ --- 189,193 ---- } ! mlsub.typing.Monotype[?] resolvedParams = parameters.resolve(tm); try{ *************** *** 107,111 **** mlsub.typing.Monotype[?] resolve(TypeMap ts) { ! return Monotype.resolve(ts, content); } --- 256,260 ---- mlsub.typing.Monotype[?] resolve(TypeMap ts) { ! return resolveMonotypes(ts, content); } *************** *** 126,134 **** private bossa.syntax.Monotype out; ! rawResolve(typeMap) { return new mlsub.typing.FunType ! (bossa.syntax.Monotype.resolve(notNull(typeMap), in), ! out.resolve(typeMap)); } --- 275,283 ---- private bossa.syntax.Monotype out; ! rawResolve(tm) { return new mlsub.typing.FunType ! (resolveMonotypes(notNull(tm), in), ! out.resolve(tm)); } *************** *** 175,179 **** // Alike should be removed as soon as types are constructed. ! rawResolve(map) { throw User.error(this, "\"alike\" can only be used in class method definitions"); --- 324,328 ---- // Alike should be removed as soon as types are constructed. ! rawResolve(tm) { throw User.error(this, "\"alike\" can only be used in class method definitions"); Index: polytype.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/polytype.nice,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** polytype.nice 10 Jan 2005 23:58:04 -0000 1.2 --- polytype.nice 12 Jan 2005 22:06:53 -0000 1.3 *************** *** 31,35 **** { return new mlsub.typing.Polytype(constraint.resolveToLowlevel(), ! monotype.resolve(typeScope)); } --- 31,35 ---- { return new mlsub.typing.Polytype(constraint.resolveToLowlevel(), ! monotype.resolve(notNull(typeScope))); } Index: tuple.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/tuple.nice,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** tuple.nice 12 Jan 2005 18:50:38 -0000 1.3 --- tuple.nice 12 Jan 2005 22:06:54 -0000 1.4 *************** *** 23,28 **** Location location; ! rawResolve(typeMap) = new mlsub.typing.TupleType ! (bossa.syntax.Monotype.resolve(notNull(typeMap), types.toArray())); substitute(map) --- 23,28 ---- Location location; ! rawResolve(tm) = new mlsub.typing.TupleType ! (resolveMonotypes(tm, types.toArray())); substitute(map) Index: niceclass.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/niceclass.nice,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** niceclass.nice 12 Jan 2005 20:56:30 -0000 1.17 --- niceclass.nice 12 Jan 2005 22:06:53 -0000 1.18 *************** *** 408,412 **** List<Parameter> params = new ArrayList(); for (arg : m.getArgTypes()) ! params.add(new Parameter(type: new Monotype.MonotypeWrapper(arg))); res.add((m, params)); --- 408,412 ---- List<Parameter> params = new ArrayList(); for (arg : m.getArgTypes()) ! params.add(new Parameter(type: new MonotypeWrapper(type: arg))); res.add((m, params)); *************** *** 566,570 **** let cname = new LocatedString("<init>",definition.location()); ! let ctype = new mlsub.typing.Polytype(specificCst, new mlsub.typing.FunType(Monotype.resolve(definition.getLocalScope(), values.types()),sureMonotype(new mlsub.typing.MonotypeConstructor(definition.getTC(), definition.getTypeParameters())))); notNull(constructorMethod)[i] = new DefaultConstructor (cname, Node.global, parameters: values, arity: values.size, --- 566,570 ---- let cname = new LocatedString("<init>",definition.location()); ! let ctype = new mlsub.typing.Polytype(specificCst, new mlsub.typing.FunType(resolveMonotypes(definition.getLocalScope(), values.types()),sureMonotype(new mlsub.typing.MonotypeConstructor(definition.getTC(), definition.getTypeParameters())))); notNull(constructorMethod)[i] = new DefaultConstructor (cname, Node.global, parameters: values, arity: values.size, Index: niceMethod.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/niceMethod.nice,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** niceMethod.nice 12 Jan 2005 20:56:30 -0000 1.13 --- niceMethod.nice 12 Jan 2005 22:06:53 -0000 1.14 *************** *** 292,297 **** constraint.addAtom(new AtomicConstraintWrapper(atom: atom)); ! thisType = new Monotype.MonotypeWrapper ! (sureMonotype (new mlsub.typing.MonotypeConstructor (alikeTC, c.getTypeParameters()))); --- 292,297 ---- constraint.addAtom(new AtomicConstraintWrapper(atom: atom)); ! thisType = new MonotypeWrapper ! (type: sureMonotype (new mlsub.typing.MonotypeConstructor (alikeTC, c.getTypeParameters()))); *************** *** 308,312 **** } else ! thisType = new Monotype.SureMonotypeWrapper(tc, c.getTypeParameters()); params.addThis(thisType); --- 308,312 ---- } else ! thisType = new SureMonotypeWrapper(tc: tc, params: c.getTypeParameters()); params.addThis(thisType); Index: formalParameters.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/formalParameters.nice,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** formalParameters.nice 12 Jan 2005 20:56:30 -0000 1.4 --- formalParameters.nice 12 Jan 2005 22:06:53 -0000 1.5 *************** *** 254,258 **** { Parameter p = parameters[i].cloneParam(); ! p.type = new Monotype.MonotypeWrapper(p.type.resolve(scope)); res.add(p); } --- 254,258 ---- { Parameter p = parameters[i].cloneParam(); ! p.type = new MonotypeWrapper(type: p.type.resolve(scope)); res.add(p); } Index: nicefieldaccess.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/nicefieldaccess.nice,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** nicefieldaccess.nice 12 Jan 2005 20:56:30 -0000 1.9 --- nicefieldaccess.nice 12 Jan 2005 22:06:53 -0000 1.10 *************** *** 46,50 **** let argType = sureMonotype(classDef.lowlevelMonotype()); ! let params = createFormalParameters([new Parameter(type: new Monotype.MonotypeWrapper(argType))]); let constr = createConstraint(classDef.getBinders(), null); let res = new NiceFieldAccess(field.getName(), Node.down, --- 46,50 ---- let argType = sureMonotype(classDef.lowlevelMonotype()); ! let params = createFormalParameters([new Parameter(type: new MonotypeWrapper(type: argType))]); let constr = createConstraint(classDef.getBinders(), null); let res = new NiceFieldAccess(field.getName(), Node.down, Index: typedef.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/typedef.nice,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** typedef.nice 12 Jan 2005 20:56:30 -0000 1.12 --- typedef.nice 12 Jan 2005 22:06:54 -0000 1.13 *************** *** 333,337 **** return null; ! return bossa.syntax.Monotype.resolve(typeScope, cast(notNull(parent.parameters).content)); } --- 333,337 ---- return null; ! return resolveMonotypes(typeScope, cast(notNull(parent.parameters).content)); } *************** *** 406,412 **** typeParameters[i] = mvar; ! bossa.syntax.Monotype v = new Monotype.MonotypeWrapper(mvar); ! atoms.add(new MonotypeLeqCst(m1: new Monotype.MonotypeWrapper(params[i]), m2: v)); ! atoms.add(new MonotypeLeqCst(m1: v, m2: new Monotype.MonotypeWrapper(params[i]))); } --- 406,412 ---- typeParameters[i] = mvar; ! bossa.syntax.Monotype v = new MonotypeWrapper(type: mvar); ! atoms.add(new MonotypeLeqCst(m1: new MonotypeWrapper(type: params[i]), m2: v)); ! atoms.add(new MonotypeLeqCst(m1: v, m2: new MonotypeWrapper(type: params[i]))); } --- Monotype.java DELETED --- Index: symbol.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/symbol.nice,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** symbol.nice 11 Jan 2005 21:45:46 -0000 1.7 --- symbol.nice 12 Jan 2005 22:06:54 -0000 1.8 *************** *** 52,56 **** resolve() { ! type = notNull(syntacticType).resolve(typeScope); syntacticType = null; --- 52,56 ---- resolve() { ! type = notNull(syntacticType).resolve(notNull(typeScope)); syntacticType = null; Index: tools.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/tools.nice,v retrieving revision 1.95 retrieving revision 1.96 diff -C2 -d -r1.95 -r1.96 *** tools.nice 12 Jan 2005 18:50:38 -0000 1.95 --- tools.nice 12 Jan 2005 22:06:54 -0000 1.96 *************** *** 235,239 **** ?gnu.expr.Declaration getDeclaration(VarSymbol) = native gnu.expr.Declaration VarSymbol.getDeclaration(); void printInterface(ClassImplementation, java.io.PrintWriter) = native void ClassImplementation.printInterface(java.io.PrintWriter); - mlsub.typing.Monotype[?] resolve(TypeMap, Monotype[?]) = native mlsub.typing.Monotype[] Monotype.resolve(TypeMap, Monotype[]); ?gnu.bytecode.Type TypeImport_lookup(LocatedString) = native gnu.bytecode.Type nice.tools.code.TypeImport.lookup(LocatedString); List<Node> children(Node) = native Node.children; --- 235,238 ---- *************** *** 242,246 **** gnu.expr.CopyArgument CopyArgument(Stack<gnu.bytecode.Variable>) = native new gnu.expr.CopyArgument(Stack); AST AST(List<Definition>, int) = native new AST(List, int); - bossa.syntax.Monotype substitute(bossa.syntax.Monotype,Map<String,bossa.syntax.Monotype>) = native bossa.syntax.Monotype bossa.syntax.Monotype.substitute(Map); ?mlsub.typing.TypeSymbol lookup(TypeMap, LocatedString) = native mlsub.typing.TypeSymbol TypeMap.lookup(LocatedString); ?mlsub.typing.TypeSymbol lookup(TypeMap, String) = native mlsub.typing.TypeSymbol TypeMap.lookup(String); --- 241,244 ---- Index: importedconstructor.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/importedconstructor.nice,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** importedconstructor.nice 12 Jan 2005 20:56:30 -0000 1.11 --- importedconstructor.nice 12 Jan 2005 22:06:53 -0000 1.12 *************** *** 96,100 **** let classDef = def.getDefinition(); ! let returnType = new Monotype.MonotypeWrapper(sureMonotype (new mlsub.typing.MonotypeConstructor(classDef.getTC(), classDef.getTypeParameters()))); --- 96,100 ---- let classDef = def.getDefinition(); ! let returnType = new MonotypeWrapper(type: sureMonotype (new mlsub.typing.MonotypeConstructor(classDef.getTC(), classDef.getTypeParameters()))); |
From: Arjan B. <ar...@us...> - 2005-01-12 22:07:04
|
Update of /cvsroot/nice/Nice/src/bossa/parser In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12858/F:/nice/src/bossa/parser Modified Files: Parser.jj Log Message: Converted Monotype. Index: Parser.jj =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/parser/Parser.jj,v retrieving revision 1.302 retrieving revision 1.303 diff -C2 -d -r1.302 -r1.303 *** Parser.jj 12 Jan 2005 20:56:28 -0000 1.302 --- Parser.jj 12 Jan 2005 22:06:50 -0000 1.303 *************** *** 822,826 **** | ("unknown" | "?") ! { return new Monotype.MonotypeWrapper(mlsub.typing.UnknownMonotype.instance); } } --- 822,826 ---- | ("unknown" | "?") ! { return new MonotypeWrapper(mlsub.typing.UnknownMonotype.instance); } } *************** *** 873,877 **** LOOKAHEAD(monotype()) t=monotype() [ id=ident() [ "=" val=Expression() ]] ! { return bossa.syntax.dispatch.createParameter(t, id ,val); } | { Token first,last; --- 873,877 ---- LOOKAHEAD(monotype()) t=monotype() [ id=ident() [ "=" val=Expression() ]] ! { return t.createParameter(id ,val); } | { Token first,last; *************** *** 895,899 **** t.nullness = /*absent*/3; ! return bossa.syntax.dispatch.createParameter(t, ident ,val); } ) --- 895,899 ---- t.nullness = /*absent*/3; ! return t.createParameter(ident ,val); } ) *************** *** 1218,1222 **** { bound.nullness = /*absent*/3; ! atoms.add(new MonotypeLeqCst(new Monotype.MonotypeVarWrapper(mv), bound)); } --- 1218,1222 ---- { bound.nullness = /*absent*/3; ! atoms.add(new MonotypeLeqCst(new MonotypeVarWrapper(mv), bound)); } |
From: Arjan B. <ar...@us...> - 2005-01-12 20:56:48
|
Update of /cvsroot/nice/Nice/src/bossa/parser In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28791/F:/nice/src/bossa/parser Modified Files: Parser.jj Log Message: More preparation for Monotype conversion. Index: Parser.jj =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/parser/Parser.jj,v retrieving revision 1.301 retrieving revision 1.302 diff -C2 -d -r1.301 -r1.302 *** Parser.jj 12 Jan 2005 18:50:32 -0000 1.301 --- Parser.jj 12 Jan 2005 20:56:28 -0000 1.302 *************** *** 822,826 **** | ("unknown" | "?") ! { return Monotype.create(mlsub.typing.UnknownMonotype.instance); } } --- 822,826 ---- | ("unknown" | "?") ! { return new Monotype.MonotypeWrapper(mlsub.typing.UnknownMonotype.instance); } } *************** *** 1218,1222 **** { bound.nullness = /*absent*/3; ! atoms.add(new MonotypeLeqCst(Monotype.createVar(mv), bound)); } --- 1218,1222 ---- { bound.nullness = /*absent*/3; ! atoms.add(new MonotypeLeqCst(new Monotype.MonotypeVarWrapper(mv), bound)); } |
From: Arjan B. <ar...@us...> - 2005-01-12 20:56:45
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28791/F:/nice/src/bossa/syntax Modified Files: Monotype.java customConstructor.nice formalParameters.nice importedconstructor.nice niceMethod.nice niceclass.nice nicefieldaccess.nice typeIdent.nice typedef.nice Log Message: More preparation for Monotype conversion. Index: typeIdent.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/typeIdent.nice,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** typeIdent.nice 18 Dec 2004 19:41:01 -0000 1.1 --- typeIdent.nice 12 Jan 2005 20:56:30 -0000 1.2 *************** *** 40,44 **** } ! resolveToTypeSymbol(scope) { let res = notNull(scope).lookup(name); --- 40,44 ---- } ! public mlsub.typing.TypeSymbol resolveToTypeSymbol(TypeMap scope) { let res = notNull(scope).lookup(name); *************** *** 51,55 **** rawResolve(scope) { ! let res = this.resolveToTypeSymbol(scope); if (res instanceof mlsub.typing.Monotype) --- 51,55 ---- rawResolve(scope) { ! let res = this.resolveToTypeSymbol(notNull(scope)); if (res instanceof mlsub.typing.Monotype) Index: typedef.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/typedef.nice,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** typedef.nice 10 Jan 2005 23:58:04 -0000 1.11 --- typedef.nice 12 Jan 2005 20:56:30 -0000 1.12 *************** *** 406,412 **** typeParameters[i] = mvar; ! bossa.syntax.Monotype v = bossa.syntax.Monotype.create(mvar); ! atoms.add(new MonotypeLeqCst(m1: bossa.syntax.Monotype.create(params[i]), m2: v)); ! atoms.add(new MonotypeLeqCst(m1: v, m2: bossa.syntax.Monotype.create(params[i]))); } --- 406,412 ---- typeParameters[i] = mvar; ! bossa.syntax.Monotype v = new Monotype.MonotypeWrapper(mvar); ! atoms.add(new MonotypeLeqCst(m1: new Monotype.MonotypeWrapper(params[i]), m2: v)); ! atoms.add(new MonotypeLeqCst(m1: v, m2: new Monotype.MonotypeWrapper(params[i]))); } Index: Monotype.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/Monotype.java,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** Monotype.java 12 Jan 2005 18:50:37 -0000 1.40 --- Monotype.java 12 Jan 2005 20:56:30 -0000 1.41 *************** *** 16,42 **** import bossa.util.*; - import mlsub.typing.MonotypeVar; - import mlsub.typing.TypeConstructor; - import nice.tools.typing.PrimitiveType; - /** Syntactic monomorphic type. - @version $Date$ - @author Daniel Bonniot (d.b...@ma...) */ ! public abstract class Monotype ! implements Located { - - /** @return true if "alike" appears inside this monotype. */ - abstract boolean containsAlike(); - - public boolean isVoid() { return false; } - - /************************************************************** - * Scoping - **************************************************************/ - /** Set by the parser. */ public byte nullness; --- 16,25 ---- import bossa.util.*; /** Syntactic monomorphic type. */ ! public abstract class Monotype implements Located { /** Set by the parser. */ public byte nullness; *************** *** 48,88 **** absent = 3; */ ! final String nullnessString() { ! switch(nullness) ! { ! case /*maybe*/1: return "?"; ! case /*sure*/2: return "!"; ! default: return ""; ! } } ! // public since it is called from bossa.dispatch ! public final mlsub.typing.Monotype resolve(TypeMap tm) { mlsub.typing.Monotype raw = rawResolve(tm); ! ! switch (nullness) { ! case /*none*/0: return raw; ! case /*maybe*/1: return sourceMaybe(raw); ! case /*sure*/2: return sourceSure(raw); ! case /*absent*/3: ! if (raw instanceof MonotypeVar) { ! nice.tools.typing.Types.makeMarkedType((MonotypeVar) raw); return raw; } else ! return sure(raw); ! default: ! throw Internal.error("Bad nullness tag"); } } ! abstract mlsub.typing.Monotype rawResolve(TypeMap tm); /** iterates resolve() on the collection of Monotype */ ! static final mlsub.typing.Monotype[] resolve(TypeMap s, Monotype[] c) { if(c == null || c.length == 0) --- 31,86 ---- absent = 3; */ ! ! /** @return true if "alike" appears inside this monotype. */ ! abstract boolean containsAlike(); ! ! abstract mlsub.typing.Monotype rawResolve(TypeMap tm); ! ! abstract Monotype substitute(Map/*<String,Monotype>*/ map); ! ! public boolean isVoid() { return false; } ! ! String nullnessString() { ! if (nullness == /*maybe*/1) ! return "?"; ! else if (nullness == /*sure*/2) ! return "!"; ! else ! return ""; } ! public mlsub.typing.Monotype resolve(TypeMap tm) { mlsub.typing.Monotype raw = rawResolve(tm); ! ! if (nullness == /*none*/0) ! return raw; ! else if (nullness == /*maybe*/1) ! return nice.tools.typing.Types.maybeMonotype(nice.tools.typing.Types.rawType(raw)); ! else if (nullness == /*sure*/2) ! return nice.tools.typing.Types.sureMonotype(nice.tools.typing.Types.rawType(raw)); ! else if (nullness == /*absent*/3) { ! if (raw instanceof mlsub.typing.MonotypeVar) { ! nice.tools.typing.Types.makeMarkedType((mlsub.typing.MonotypeVar) raw); return raw; } else ! return nice.tools.typing.Types.sureMonotype(raw); } + else + throw Internal.error("Bad nullness tag"); } ! /** called instead of toString if parenthesis are unnecessary */ ! public String toStringExtern() { return this.toString(); } ! ! /** don't print type parameters */ ! public String toStringBase() { return this.toString(); } /** iterates resolve() on the collection of Monotype */ ! static mlsub.typing.Monotype[] resolve(TypeMap s, Monotype[] c) { if(c == null || c.length == 0) *************** *** 103,143 **** return res; } ! ! abstract Monotype substitute(Map map); ! ! //temporarily method to call on TypeIdent's ! public mlsub.typing.TypeSymbol resolveToTypeSymbol(TypeMap scope) ! { ! return null; ! } ! ! /**************************************************************** ! * Printing ! ****************************************************************/ ! ! /** called instead of toString if parenthesis are unnecessary */ ! public String toStringExtern() ! { ! return toString(); ! } ! ! /** don't print type parameters */ ! public String toStringBase() { ! return toString(); ! } ! /**************************************************************** ! * Wrapping a mlsub Monotype in a syntactic monotype ! ****************************************************************/ ! ! public static Monotype create(mlsub.typing.Monotype m) ! { ! return new Wrapper(m); ! } ! ! private static class Wrapper extends Monotype ! { ! Wrapper(mlsub.typing.Monotype m) { this.type = m; --- 101,113 ---- return res; } ! ! /** ! Wrapping a mlsub Monotype in a syntactic monotype ! */ ! public static class MonotypeWrapper extends Monotype { ! final mlsub.typing.Monotype type; ! public MonotypeWrapper(mlsub.typing.Monotype m) { this.type = m; *************** *** 146,187 **** boolean containsAlike() { return false; } ! public mlsub.typing.Monotype rawResolve(TypeMap s) ! { ! return type; ! } ! Monotype substitute(Map m) ! { ! return this; ! } ! public Location location() ! { ! return Location.nowhere(); ! } ! public String toString() ! { ! return String.valueOf(type); ! } ! ! final mlsub.typing.Monotype type; } ! public static Monotype createVar(mlsub.typing.MonotypeVar m) ! { ! return new VarWrapper(m); ! } ! ! private static final class VarWrapper extends Wrapper { ! VarWrapper(mlsub.typing.MonotypeVar m) { super(m); } ! public mlsub.typing.Monotype rawResolve(TypeMap s) { ! mlsub.typing.TypeSymbol res = s.lookup(type.toString()); if (res != null) return (mlsub.typing.Monotype) res; --- 116,138 ---- boolean containsAlike() { return false; } ! public mlsub.typing.Monotype rawResolve(TypeMap tm) { return type; } ! Monotype substitute(Map map) { return this; } ! public Location location() { return Location.nowhere(); } ! public String toString() { return String.valueOf(type); } } ! public static final class MonotypeVarWrapper extends MonotypeWrapper { ! public MonotypeVarWrapper(mlsub.typing.MonotypeVar m) { super(m); } ! public mlsub.typing.Monotype rawResolve(TypeMap tm) { ! mlsub.typing.TypeSymbol res = tm.lookup(type.toString()); if (res != null) return (mlsub.typing.Monotype) res; *************** *** 191,271 **** } ! /**************************************************************** ! * Wrapper for delaying resolution of constructed monotypes. ! ****************************************************************/ ! ! static Monotype createSure(final TypeConstructor tc, final mlsub.typing.Monotype[] params) { ! return new Monotype() { ! boolean containsAlike() { return false; } ! ! public mlsub.typing.Monotype rawResolve(TypeMap typeMap) ! { ! try{ ! return sure(new mlsub.typing.MonotypeConstructor(tc, params)); ! } ! catch(mlsub.typing.BadSizeEx e){ ! // See if this is a class with default type parameters ! mlsub.typing.Monotype res = dispatch.getTypeWithTC(tc, params); ! if (res != null) ! return sure(res); ! ! throw User.error(this, "Class " + tc + ! Util.has(e.expected, "type parameter", e.actual)); ! } ! } ! ! Monotype substitute(Map m) ! { ! return this; ! } ! ! public Location location() ! { ! return Location.nowhere(); ! } ! public String toString() ! { ! return tc + ( params != null ? Util.map("<",",",">",params) : ""); ! } ! }; ! } ! /**************************************************************** ! * Nullness markers ! ****************************************************************/ ! /** ! Return a maybe type based on the raw type of the argument ! if the argument is a full type. ! */ ! static mlsub.typing.Monotype sourceMaybe(mlsub.typing.Monotype type) ! { ! mlsub.typing.Monotype raw = nice.tools.typing.Types.rawType(type); ! return maybe(raw); ! } ! public static mlsub.typing.Monotype maybe(mlsub.typing.Monotype type) ! { ! return new mlsub.typing.MonotypeConstructor ! (PrimitiveType.maybeTC, new mlsub.typing.Monotype[]{type}); ! } ! /** ! Return a sure type based on the raw type of the argument ! if the argument is a full type. ! */ ! static mlsub.typing.Monotype sourceSure(mlsub.typing.Monotype type) ! { ! mlsub.typing.Monotype raw = nice.tools.typing.Types.rawType(type); ! return sure(raw); ! } ! public static mlsub.typing.Monotype sure(mlsub.typing.Monotype type) ! { ! return new mlsub.typing.MonotypeConstructor ! (PrimitiveType.sureTC, new mlsub.typing.Monotype[]{type}); } } - --- 142,184 ---- } ! /** ! Wrapper for delaying resolution of constructed monotypes. ! */ ! public static final class SureMonotypeWrapper extends Monotype { ! mlsub.typing.TypeConstructor tc; ! mlsub.typing.Monotype[] params; ! public SureMonotypeWrapper(mlsub.typing.TypeConstructor tc, mlsub.typing.Monotype[] params) ! { ! this.tc = tc; ! this.params = params; ! } ! ! boolean containsAlike() { return false; } ! public mlsub.typing.Monotype rawResolve(TypeMap tm) ! { ! try{ ! return nice.tools.typing.Types.sureMonotype(new mlsub.typing.MonotypeConstructor(tc, params)); ! } ! catch(mlsub.typing.BadSizeEx e){ ! // See if this is a class with default type parameters ! mlsub.typing.Monotype res = dispatch.getTypeWithTC(tc, params); ! if (res != null) ! return nice.tools.typing.Types.sureMonotype(res); ! throw User.error(this, "Class " + tc + Util.has(e.expected, "type parameter", e.actual)); ! } ! } ! Monotype substitute(Map map) { return this; } ! public Location location() { return Location.nowhere(); } ! public String toString() ! { ! return tc + ( params != null ? Util.map("<",",",">",params) : ""); ! } } } Index: customConstructor.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/customConstructor.nice,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** customConstructor.nice 12 Jan 2005 18:50:37 -0000 1.13 --- customConstructor.nice 12 Jan 2005 20:56:30 -0000 1.14 *************** *** 87,91 **** for (int i = 0; i < source.length; i++) ! res.put(source[i].toString(), Monotype.create(destination[i])); return res; --- 87,91 ---- for (int i = 0; i < source.length; i++) ! res.put(source[i].toString(), new Monotype.MonotypeWrapper(destination[i])); return res; *************** *** 177,181 **** if (! (syms[i] instanceof mlsub.typing.MonotypeVar)) User.error(classe, syms[i] + " is not a type"); ! notNull(params)[i] = Monotype.create(cast(syms[i])); } --- 177,181 ---- if (! (syms[i] instanceof mlsub.typing.MonotypeVar)) User.error(classe, syms[i] + " is not a type"); ! notNull(params)[i] = new Monotype.MonotypeWrapper(cast(syms[i])); } Index: nicefieldaccess.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/nicefieldaccess.nice,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** nicefieldaccess.nice 12 Jan 2005 18:50:38 -0000 1.8 --- nicefieldaccess.nice 12 Jan 2005 20:56:30 -0000 1.9 *************** *** 46,50 **** let argType = sureMonotype(classDef.lowlevelMonotype()); ! let params = createFormalParameters([new Parameter(type: Monotype.create(argType))]); let constr = createConstraint(classDef.getBinders(), null); let res = new NiceFieldAccess(field.getName(), Node.down, --- 46,50 ---- let argType = sureMonotype(classDef.lowlevelMonotype()); ! let params = createFormalParameters([new Parameter(type: new Monotype.MonotypeWrapper(argType))]); let constr = createConstraint(classDef.getBinders(), null); let res = new NiceFieldAccess(field.getName(), Node.down, Index: importedconstructor.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/importedconstructor.nice,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** importedconstructor.nice 12 Jan 2005 18:50:37 -0000 1.10 --- importedconstructor.nice 12 Jan 2005 20:56:30 -0000 1.11 *************** *** 96,100 **** let classDef = def.getDefinition(); ! let returnType = Monotype.create(sureMonotype (new mlsub.typing.MonotypeConstructor(classDef.getTC(), classDef.getTypeParameters()))); --- 96,100 ---- let classDef = def.getDefinition(); ! let returnType = new Monotype.MonotypeWrapper(sureMonotype (new mlsub.typing.MonotypeConstructor(classDef.getTC(), classDef.getTypeParameters()))); Index: niceclass.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/niceclass.nice,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** niceclass.nice 12 Jan 2005 18:50:38 -0000 1.16 --- niceclass.nice 12 Jan 2005 20:56:30 -0000 1.17 *************** *** 408,412 **** List<Parameter> params = new ArrayList(); for (arg : m.getArgTypes()) ! params.add(new Parameter(type: Monotype.create(arg))); res.add((m, params)); --- 408,412 ---- List<Parameter> params = new ArrayList(); for (arg : m.getArgTypes()) ! params.add(new Parameter(type: new Monotype.MonotypeWrapper(arg))); res.add((m, params)); Index: niceMethod.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/niceMethod.nice,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** niceMethod.nice 12 Jan 2005 18:50:38 -0000 1.12 --- niceMethod.nice 12 Jan 2005 20:56:30 -0000 1.13 *************** *** 292,296 **** constraint.addAtom(new AtomicConstraintWrapper(atom: atom)); ! thisType = Monotype.create (sureMonotype (new mlsub.typing.MonotypeConstructor --- 292,296 ---- constraint.addAtom(new AtomicConstraintWrapper(atom: atom)); ! thisType = new Monotype.MonotypeWrapper (sureMonotype (new mlsub.typing.MonotypeConstructor *************** *** 308,312 **** } else ! thisType = Monotype.createSure(tc, c.getTypeParameters()); params.addThis(thisType); --- 308,312 ---- } else ! thisType = new Monotype.SureMonotypeWrapper(tc, c.getTypeParameters()); params.addThis(thisType); Index: formalParameters.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/formalParameters.nice,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** formalParameters.nice 12 Jan 2005 18:50:37 -0000 1.3 --- formalParameters.nice 12 Jan 2005 20:56:30 -0000 1.4 *************** *** 254,258 **** { Parameter p = parameters[i].cloneParam(); ! p.type = Monotype.create(p.type.resolve(scope)); res.add(p); } --- 254,258 ---- { Parameter p = parameters[i].cloneParam(); ! p.type = new Monotype.MonotypeWrapper(p.type.resolve(scope)); res.add(p); } |
From: Arjan B. <ar...@us...> - 2005-01-12 18:51:18
|
Update of /cvsroot/nice/Nice/src/nice/tools/code In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31378/F:/nice/src/nice/tools/code Modified Files: Types.java Log Message: Cleanup and preparation for Monotype conversion. Index: Types.java =================================================================== RCS file: /cvsroot/nice/Nice/src/nice/tools/code/Types.java,v retrieving revision 1.64 retrieving revision 1.65 diff -C2 -d -r1.64 -r1.65 *** Types.java 20 Dec 2004 20:25:52 -0000 1.64 --- Types.java 12 Jan 2005 18:50:34 -0000 1.65 *************** *** 344,350 **** { if (sure) ! return bossa.syntax.Monotype.sure(res); else ! return bossa.syntax.Monotype.maybe(res); } return res; --- 344,350 ---- { if (sure) ! return nice.tools.typing.Types.sureMonotype(res); else ! return nice.tools.typing.Types.maybeMonotype(res); } return res; |
From: Arjan B. <ar...@us...> - 2005-01-12 18:51:17
|
Update of /cvsroot/nice/Nice/src/bossa/parser In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31378/F:/nice/src/bossa/parser Modified Files: Parser.jj Log Message: Cleanup and preparation for Monotype conversion. Index: Parser.jj =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/parser/Parser.jj,v retrieving revision 1.300 retrieving revision 1.301 diff -C2 -d -r1.300 -r1.301 *** Parser.jj 11 Jan 2005 21:45:45 -0000 1.300 --- Parser.jj 12 Jan 2005 18:50:32 -0000 1.301 *************** *** 694,698 **** { FunType res = bossa.syntax.dispatch.createFunType(domain, codomain); ! res.nullness = maybe ? res.maybe : res.absent; return res; } --- 694,701 ---- { FunType res = bossa.syntax.dispatch.createFunType(domain, codomain); ! if (maybe) ! res.nullness = /*maybe*/1; ! else ! res.nullness = /*absent*/3; return res; } *************** *** 710,714 **** res = new TypeIdent(new LocatedString("void",makeLocation(start, end))); ! res.nullness = res.absent; return res; } --- 713,717 ---- res = new TypeIdent(new LocatedString("void",makeLocation(start, end))); ! res.nullness = /*absent*/3; return res; } *************** *** 734,738 **** domain = new Monotype[]{ res }; res = bossa.syntax.dispatch.createFunType_(domain, codomain); ! res.nullness = maybe ? res.maybe : res.absent; } ] { return res; } --- 737,744 ---- domain = new Monotype[]{ res }; res = bossa.syntax.dispatch.createFunType_(domain, codomain); ! if (maybe) ! res.nullness = /*maybe*/1; ! else ! res.nullness = /*absent*/3; } ] { return res; } *************** *** 765,769 **** bossa.syntax.dispatch.createTypeParameters(tp), loc); ! res.nullness = maybe ? res.maybe : res.absent; } ] --- 771,778 ---- bossa.syntax.dispatch.createTypeParameters(tp), loc); ! if (maybe) ! res.nullness = /*maybe*/1; ! else ! res.nullness = /*absent*/3; } ] *************** *** 791,812 **** start="alike" [ "<" p=monotypes() ">" ] { res=bossa.syntax.dispatch.createAlike(p, makeLocation(start)); } ! { res.nullness = res.absent; } | LOOKAHEAD(monotypeConstructor()) res=monotypeConstructor() ! { res.nullness = res.absent; } | res=typeIdent() ! { res.nullness = res.absent; } ) { if ((maybe || sure) && ! (res.nullness != res.absent)) throw bossa.util.User.error (res, "Nullness is specified in two ways for " + res); if (maybe) ! res.nullness = res.maybe; else if (sure) ! res.nullness = res.sure; } { return res; } --- 800,821 ---- start="alike" [ "<" p=monotypes() ">" ] { res=bossa.syntax.dispatch.createAlike(p, makeLocation(start)); } ! { res.nullness = /*absent*/3; } | LOOKAHEAD(monotypeConstructor()) res=monotypeConstructor() ! { res.nullness = /*absent*/3; } | res=typeIdent() ! { res.nullness = /*absent*/3; } ) { if ((maybe || sure) && ! (res.nullness != /*absent*/3)) throw bossa.util.User.error (res, "Nullness is specified in two ways for " + res); if (maybe) ! res.nullness = /*maybe*/1; else if (sure) ! res.nullness = /*sure*/2; } { return res; } *************** *** 848,852 **** last=")" { Monotype t = new TupleType(types, makeLocation(first, last)); ! t.nullness = Monotype.absent; monotypes.add(t); return new TupleExp(parts); } --- 857,861 ---- last=")" { Monotype t = new TupleType(types, makeLocation(first, last)); ! t.nullness = /*absent*/3; monotypes.add(t); return new TupleExp(parts); } *************** *** 884,888 **** statements.add(bossa.syntax.dispatch.createExpressionStmt(exp)); t = new TupleType(types, makeLocation(first, last)); ! t.nullness = Monotype.absent; return bossa.syntax.dispatch.createParameter(t, ident ,val); --- 893,897 ---- statements.add(bossa.syntax.dispatch.createExpressionStmt(exp)); t = new TupleType(types, makeLocation(first, last)); ! t.nullness = /*absent*/3; return bossa.syntax.dispatch.createParameter(t, ident ,val); *************** *** 1208,1212 **** if (bound != null) { ! bound.nullness = Monotype.absent; atoms.add(new MonotypeLeqCst(Monotype.createVar(mv), bound)); } --- 1217,1221 ---- if (bound != null) { ! bound.nullness = /*absent*/3; atoms.add(new MonotypeLeqCst(Monotype.createVar(mv), bound)); } *************** *** 1750,1754 **** statements.add(bossa.syntax.dispatch.createExpressionStmt(exp)); type = new TupleType(types, makeLocation(first, last)); ! type.nullness = Monotype.absent; return bossa.syntax.dispatch.createMonoSymbol(name, type); } --- 1759,1763 ---- statements.add(bossa.syntax.dispatch.createExpressionStmt(exp)); type = new TupleType(types, makeLocation(first, last)); ! type.nullness = /*absent*/3; return bossa.syntax.dispatch.createMonoSymbol(name, type); } |
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31378/F:/nice/src/bossa/syntax Modified Files: Monotype.java analyse.nice constant.nice customConstructor.nice dispatch.java.bootstrap enum.nice formalParameters.nice funexp.nice importedconstructor.nice literalarray.nice locals.nice loop.nice methodDeclaration.nice methodImplementation.nice monotype.nice newarray.nice niceMethod.nice niceclass.nice nicefieldaccess.nice super.nice tools.nice try.nice tuple.nice Log Message: Cleanup and preparation for Monotype conversion. Index: newarray.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/newarray.nice,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** newarray.nice 1 Dec 2004 02:00:32 -0000 1.2 --- newarray.nice 12 Jan 2005 18:50:37 -0000 1.3 *************** *** 87,93 **** // Add the nullness marker to the element type. if (sure) ! monotype = bossa.syntax.Monotype.sure(monotype); else if (nullVars == null) ! monotype = bossa.syntax.Monotype.maybe(monotype); else { --- 87,93 ---- // Add the nullness marker to the element type. if (sure) ! monotype = sureMonotype(monotype); else if (nullVars == null) ! monotype = maybeMonotype(monotype); else { *************** *** 119,128 **** else // Unknown dimensions are not initialized: give an option type. ! monotype = bossa.syntax.Monotype.maybe(monotype); } // Known dimensions are initialized: give a sure type. for (int i = 0; i < knownDimensions.length; i++) ! monotype = bossa.syntax.Monotype.sure (mlsub.typing.MonotypeConstructor.apply(nice.tools.typing.PrimitiveType.arrayTC, monotype)); --- 119,128 ---- else // Unknown dimensions are not initialized: give an option type. ! monotype = maybeMonotype(monotype); } // Known dimensions are initialized: give a sure type. for (int i = 0; i < knownDimensions.length; i++) ! monotype = sureMonotype (mlsub.typing.MonotypeConstructor.apply(nice.tools.typing.PrimitiveType.arrayTC, monotype)); Index: literalarray.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/literalarray.nice,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** literalarray.nice 1 Dec 2004 02:00:32 -0000 1.4 --- literalarray.nice 12 Jan 2005 18:50:37 -0000 1.5 *************** *** 43,47 **** let res = new mlsub.typing.Polytype (elementType.getConstraint(), ! bossa.syntax.Monotype.sure(new mlsub.typing.MonotypeConstructor (nice.tools.typing.PrimitiveType.arrayTC, [elementType.getMonotype()]))); res.setNotSimplified(); --- 43,47 ---- let res = new mlsub.typing.Polytype (elementType.getConstraint(), ! sureMonotype(new mlsub.typing.MonotypeConstructor (nice.tools.typing.PrimitiveType.arrayTC, [elementType.getMonotype()]))); res.setNotSimplified(); Index: funexp.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/funexp.nice,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** funexp.nice 11 Jan 2005 21:45:46 -0000 1.5 --- funexp.nice 12 Jan 2005 18:50:37 -0000 1.6 *************** *** 101,105 **** type = new mlsub.typing.Polytype (mlsub.typing.Constraint.and(cst, notNull(_inferredReturnType).getConstraint()), ! bossa.syntax.Monotype.sure(t)); } --- 101,105 ---- type = new mlsub.typing.Polytype (mlsub.typing.Constraint.and(cst, notNull(_inferredReturnType).getConstraint()), ! sureMonotype(t)); } Index: tuple.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/tuple.nice,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** tuple.nice 14 Dec 2004 18:58:08 -0000 1.2 --- tuple.nice 12 Jan 2005 18:50:38 -0000 1.3 *************** *** 24,38 **** rawResolve(typeMap) = new mlsub.typing.TupleType ! (bossa.syntax.Monotype.rawResolve(notNull(typeMap), types)); substitute(map) { bossa.syntax.Monotype res = new bossa.syntax.TupleType ! ( types : bossa.syntax.Monotype.substitute(map, types), location : location); res.nullness = this.nullness; return res; } ! containsAlike() = bossa.syntax.Monotype.containsAlike(types); location() = location; --- 24,38 ---- rawResolve(typeMap) = new mlsub.typing.TupleType ! (bossa.syntax.Monotype.resolve(notNull(typeMap), types.toArray())); substitute(map) { bossa.syntax.Monotype res = new bossa.syntax.TupleType ! ( types : types.mapToArray(Monotype t => t.substitute(map)), location : location); res.nullness = this.nullness; return res; } ! containsAlike() = types.any(Monotype t => t.containsAlike()); location() = location; *************** *** 113,117 **** expectedComponents = components; ! type = new mlsub.typing.Polytype(cst, bossa.syntax.Monotype.sure(tupleType)); } --- 113,117 ---- expectedComponents = components; ! type = new mlsub.typing.Polytype(cst, sureMonotype(tupleType)); } Index: niceclass.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/niceclass.nice,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** niceclass.nice 11 Jan 2005 21:45:46 -0000 1.15 --- niceclass.nice 12 Jan 2005 18:50:38 -0000 1.16 *************** *** 235,239 **** VarScope scope = notNull(definition.scope); mlsub.typing.Monotype thisType = ! Monotype.sure(new mlsub.typing.MonotypeConstructor(definition.getTC(), definition.getTypeParameters())); thisSymbol = new ThisSymbol(thisName, type: thisType, declaringClass: this); --- 235,239 ---- VarScope scope = notNull(definition.scope); mlsub.typing.Monotype thisType = ! sureMonotype(new mlsub.typing.MonotypeConstructor(definition.getTC(), definition.getTypeParameters())); thisSymbol = new ThisSymbol(thisName, type: thisType, declaringClass: this); *************** *** 566,570 **** let cname = new LocatedString("<init>",definition.location()); ! let ctype = new mlsub.typing.Polytype(specificCst, new mlsub.typing.FunType(Monotype.resolve(definition.getLocalScope(), values.types()),Monotype.sure(new mlsub.typing.MonotypeConstructor(definition.getTC(), definition.getTypeParameters())))); notNull(constructorMethod)[i] = new DefaultConstructor (cname, Node.global, parameters: values, arity: values.size, --- 566,570 ---- let cname = new LocatedString("<init>",definition.location()); ! let ctype = new mlsub.typing.Polytype(specificCst, new mlsub.typing.FunType(Monotype.resolve(definition.getLocalScope(), values.types()),sureMonotype(new mlsub.typing.MonotypeConstructor(definition.getTC(), definition.getTypeParameters())))); notNull(constructorMethod)[i] = new DefaultConstructor (cname, Node.global, parameters: values, arity: values.size, Index: formalParameters.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/formalParameters.nice,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** formalParameters.nice 11 Jan 2005 21:45:46 -0000 1.2 --- formalParameters.nice 12 Jan 2005 18:50:37 -0000 1.3 *************** *** 274,289 **** size: parameters.size()); } - /* - FormalParameters(Parameter[] parameters) - { - super(Node.none); - if (parameters == null) - return; - - this.parameters = parameters; - this.size = parameters.length; - } - */ let LocatedString thisName = new LocatedString("this", Location.nowhere()); --- 274,278 ---- Index: super.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/super.nice,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** super.nice 4 Jan 2005 21:20:39 -0000 1.8 --- super.nice 12 Jan 2005 18:50:38 -0000 1.9 *************** *** 145,149 **** else // Our safe bet is to assert that the argument is Object. ! newAtoms.add(new mlsub.typing.MonotypeLeqCst(bossa.syntax.Monotype.sure(mlsub.typing.TopMonotype.instance), m[0])); } --- 145,149 ---- else // Our safe bet is to assert that the argument is Object. ! newAtoms.add(new mlsub.typing.MonotypeLeqCst(sureMonotype(mlsub.typing.TopMonotype.instance), m[0])); } Index: locals.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/locals.nice,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** locals.nice 11 Jan 2005 21:45:46 -0000 1.6 --- locals.nice 12 Jan 2005 18:50:37 -0000 1.7 *************** *** 210,214 **** let value = createFunExp(trueConstraint, parameters.getMonoSymbols() || new MonoSymbol[0], body); let symbol = new FunSymbol(name, trueConstraint, parameters, returnType); ! notNull(symbol.syntacticType).monotype.nullness = Monotype.sure; return new LocalFunction(left: symbol, value: value, parameters: parameters); } --- 210,214 ---- let value = createFunExp(trueConstraint, parameters.getMonoSymbols() || new MonoSymbol[0], body); let symbol = new FunSymbol(name, trueConstraint, parameters, returnType); ! notNull(symbol.syntacticType).monotype.nullness = /*sure*/2; return new LocalFunction(left: symbol, value: value, parameters: parameters); } Index: Monotype.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/Monotype.java,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** Monotype.java 18 Dec 2004 19:40:59 -0000 1.39 --- Monotype.java 12 Jan 2005 18:50:37 -0000 1.40 *************** *** 29,81 **** implements Located { - static final Monotype[] toArray(List monotypes) - { - if (monotypes == null) - return array0; - - return (Monotype[]) monotypes.toArray(new Monotype[monotypes.size()]); - } - - static final Monotype[] array0 = new Monotype[0]; - - /**************************************************************** - * Syntactic fresh monotype variables - ****************************************************************/ - - static Monotype fresh(LocatedString associatedVariable) - { - return dispatch.createTypeIdent(associatedVariable); - } - - static Monotype[] freshs(int arity, LocatedString associatedVariable) - { - Monotype[] res = new Monotype[arity]; - for(int i = 0; i < arity; i++) - res[i] = fresh(new LocatedString(associatedVariable.content + i, - associatedVariable.location())); - return res; - } /** @return true if "alike" appears inside this monotype. */ abstract boolean containsAlike(); - static final boolean containsAlike(List monotypes) - { - for(Iterator i = monotypes.iterator(); i.hasNext();) - if(((Monotype) i.next()).containsAlike()) - return true; - - return false; - } - - static final boolean containsAlike(Monotype[] monotypes) - { - for(int i = monotypes.length; --i >= 0;) - if (monotypes[i].containsAlike()) - return true; - - return false; - } - public boolean isVoid() { return false; } --- 29,36 ---- *************** *** 86,90 **** /** Set by the parser. */ public byte nullness; ! public static final byte none = 0, --- 41,45 ---- /** Set by the parser. */ public byte nullness; ! /* public static final byte none = 0, *************** *** 92,102 **** sure = 2, absent = 3; ! final String nullnessString() { switch(nullness) { ! case maybe: return "?"; ! case sure: return "!"; default: return ""; } --- 47,57 ---- sure = 2, absent = 3; ! */ final String nullnessString() { switch(nullness) { ! case /*maybe*/1: return "?"; ! case /*sure*/2: return "!"; default: return ""; } *************** *** 110,117 **** switch (nullness) { ! case none: return raw; ! case maybe: return sourceMaybe(raw); ! case sure: return sourceSure(raw); ! case absent: if (raw instanceof MonotypeVar) { --- 65,72 ---- switch (nullness) { ! case /*none*/0: return raw; ! case /*maybe*/1: return sourceMaybe(raw); ! case /*sure*/2: return sourceSure(raw); ! case /*absent*/3: if (raw instanceof MonotypeVar) { *************** *** 129,159 **** /** iterates resolve() on the collection of Monotype */ - static final mlsub.typing.Monotype[] rawResolve(TypeMap s, Collection c) - { - if(c.size()==0) - return null; - - mlsub.typing.Monotype[] res = new mlsub.typing.Monotype[c.size()]; - - int n=0; - Iterator i=c.iterator(); - while(i.hasNext()) - { - Object o = i.next(); - if (!(o instanceof Monotype)) - Debug.println(o+" ::: "+o.getClass()); - - Monotype old = (Monotype) o; - mlsub.typing.Monotype nou = old.resolve(s); - - if(nou==null) - User.error(old,old+" : Monotype not defined"); - - res[n++]=nou; - } - return res; - } - - /** iterates resolve() on the collection of Monotype */ static final mlsub.typing.Monotype[] resolve(TypeMap s, Monotype[] c) { --- 84,87 ---- *************** *** 178,203 **** abstract Monotype substitute(Map map); - static List substitute(Map map, Collection c) - { - if(c==null) return null; - - List res = new ArrayList(c.size()); - Iterator i = c.iterator(); - - while(i.hasNext()) - res.add( ((Monotype)i.next()).substitute(map)); - - return res; - } - - static Monotype[] substitute(Map map, Monotype[] m) - { - Monotype[] res = new Monotype[m.length]; - for(int i = m.length; --i >= 0;) - res[i] = m[i].substitute(map); - - return res; - } - //temporarily method to call on TypeIdent's public mlsub.typing.TypeSymbol resolveToTypeSymbol(TypeMap scope) --- 106,109 ---- Index: nicefieldaccess.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/nicefieldaccess.nice,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** nicefieldaccess.nice 10 Jan 2005 23:58:04 -0000 1.7 --- nicefieldaccess.nice 12 Jan 2005 18:50:38 -0000 1.8 *************** *** 44,48 **** { let classDef = field.getTypeDefinition(); ! let argType = Monotype.sure(classDef.lowlevelMonotype()); let params = createFormalParameters([new Parameter(type: Monotype.create(argType))]); --- 44,48 ---- { let classDef = field.getTypeDefinition(); ! let argType = sureMonotype(classDef.lowlevelMonotype()); let params = createFormalParameters([new Parameter(type: Monotype.create(argType))]); Index: try.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/try.nice,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** try.nice 11 Jan 2005 21:45:46 -0000 1.4 --- try.nice 12 Jan 2005 18:50:38 -0000 1.5 *************** *** 102,106 **** { Monotype type = createMonotypeConstructor(tc, null, tc.location()); ! type.nullness = Monotype.sure; this(exnVar: new MonoSymbol(varName, syntacticType: type), tc: tc, --- 102,106 ---- { Monotype type = createMonotypeConstructor(tc, null, tc.location()); ! type.nullness = /*sure*/2; this(exnVar: new MonoSymbol(varName, syntacticType: type), tc: tc, Index: analyse.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/analyse.nice,v retrieving revision 1.123 retrieving revision 1.124 diff -C2 -d -r1.123 -r1.124 *** analyse.nice 10 Jan 2005 23:58:04 -0000 1.123 --- analyse.nice 12 Jan 2005 18:50:37 -0000 1.124 *************** *** 627,631 **** c.type = new mlsub.typing.Polytype ! (Monotype.sure(new mlsub.typing.MonotypeConstructor(tc, null))); return c; --- 627,631 ---- c.type = new mlsub.typing.Polytype ! (sureMonotype(new mlsub.typing.MonotypeConstructor(tc, null))); return c; *************** *** 647,651 **** return new mlsub.typing.Polytype (res.getConstraint(), ! sure ? Monotype.sure(type) : Monotype.maybe(type)); } --- 647,651 ---- return new mlsub.typing.Polytype (res.getConstraint(), ! sure ? sureMonotype(type) : maybeMonotype(type)); } Index: constant.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/constant.nice,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** constant.nice 31 Dec 2004 18:40:45 -0000 1.6 --- constant.nice 12 Jan 2005 18:50:37 -0000 1.7 *************** *** 27,64 **** ?LocatedString className = null; - /* - ConstantExp() - { - } - - ConstantExp(Polytype type, TypeConstructor tc, Object value, String representation, - Location location) - { - this.type = type; - this.tc = tc; - this.value = value; - this.representation = representation; - setLocation(location); - } - - ConstantExp(TypeConstructor tc, Object value, String representation, - Location location) - { - this(new mlsub.typing.Polytype(Monotype.sure(new mlsub.typing.MonotypeConstructor(tc,null))), - tc, value, representation, location); - } - - ConstantExp(TypeConstructor tc, String representation, Location location) - { - this(tc, null, representation, location); - } - - public ConstantExp(Object value) - { - this.value = value; - this.representation = value.toString(); - } - */ - computeType() { --- 27,30 ---- *************** *** 287,291 **** let alpha = new mlsub.typing.MonotypeVar("any"); return new mlsub.typing.Polytype(new mlsub.typing.Constraint([alpha], null), ! bossa.syntax.Monotype.maybe(alpha)); } --- 253,257 ---- let alpha = new mlsub.typing.MonotypeVar("any"); return new mlsub.typing.Polytype(new mlsub.typing.Constraint([alpha], null), ! maybeMonotype(alpha)); } *************** *** 498,502 **** res.type = new mlsub.typing.Polytype (type.getConstraint(), ! Monotype.sure(new mlsub.typing.MonotypeConstructor (nice.tools.typing.PrimitiveType.classTC, [type.getMonotype()]))); return res; --- 464,468 ---- res.type = new mlsub.typing.Polytype (type.getConstraint(), ! sureMonotype(new mlsub.typing.MonotypeConstructor (nice.tools.typing.PrimitiveType.classTC, [type.getMonotype()]))); return res; *************** *** 576,580 **** return new mlsub.typing.Polytype (vars == null ? null : new mlsub.typing.Constraint(cast(vars), null), ! sure ? Monotype.sure(type) : Monotype.maybe(type)); } --- 542,546 ---- return new mlsub.typing.Polytype (vars == null ? null : new mlsub.typing.Constraint(cast(vars), null), ! sure ? sureMonotype(type) : maybeMonotype(type)); } Index: customConstructor.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/customConstructor.nice,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** customConstructor.nice 11 Jan 2005 21:45:46 -0000 1.12 --- customConstructor.nice 12 Jan 2005 18:50:37 -0000 1.13 *************** *** 165,169 **** { let classe = new TypeIdent(name: className); ! classe.nullness = Monotype.sure; if (cst == trueConstraint) --- 165,169 ---- { let classe = new TypeIdent(name: className); ! classe.nullness = /*sure*/2; if (cst == trueConstraint) *************** *** 182,186 **** let res = createMonotypeConstructor (classe, new TypeParameters(content: params), classe.location()); ! res.nullness = Monotype.sure; return res; } --- 182,186 ---- let res = createMonotypeConstructor (classe, new TypeParameters(content: params), classe.location()); ! res.nullness = /*sure*/2; return res; } Index: monotype.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/monotype.nice,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** monotype.nice 20 Dec 2004 17:16:48 -0000 1.6 --- monotype.nice 12 Jan 2005 18:50:37 -0000 1.7 *************** *** 60,64 **** Monotype res = createMonotypeConstructor (notNull(tc), ! new TypeParameters(content: Monotype.substitute(map, notNull(parameters.content))), loc); res.nullness = this.nullness; --- 60,64 ---- Monotype res = createMonotypeConstructor (notNull(tc), ! new TypeParameters(content: notNull(parameters.content).mapToArray(Monotype t => t.substitute(map))), loc); res.nullness = this.nullness; *************** *** 66,70 **** } ! containsAlike() = Monotype.containsAlike(notNull(parameters.content)); public ?TypeIdent getTC() = tc; --- 66,70 ---- } ! containsAlike() = notNull(parameters.content).any(Monotype t => t.containsAlike()); public ?TypeIdent getTC() = tc; *************** *** 115,119 **** public TypeParameters createTypeParameters(List<Monotype> tps) { ! return new TypeParameters(content: Monotype.toArray(tps)); } /** --- 115,119 ---- public TypeParameters createTypeParameters(List<Monotype> tps) { ! return new TypeParameters(content: tps.toArray()); } /** *************** *** 136,145 **** { bossa.syntax.Monotype res = new bossa.syntax.FunType ! (in: bossa.syntax.Monotype.substitute(map,in), out: out.substitute(map)); res.nullness = this.nullness; return res; } ! containsAlike() = Monotype.containsAlike(in) || out.containsAlike(); location() = out.location(); --- 136,145 ---- { bossa.syntax.Monotype res = new bossa.syntax.FunType ! (in: in.mapToArray(Monotype t => t.substitute(map)), out: out.substitute(map)); res.nullness = this.nullness; return res; } ! containsAlike() = in.any(Monotype t => t.containsAlike()) || out.containsAlike(); location() = out.location(); *************** *** 148,152 **** { return "(" + Util.map("", ", ", "", in) + ! (nullness == maybe ? ")?->" : ")->") + out; } --- 148,152 ---- { return "(" + Util.map("", ", ", "", in) + ! (nullness == /*maybe*/1 ? ")?->" : ")->") + out; } *************** *** 194,198 **** assert tc instanceof MonotypeConstructor; let res = createMonotypeConstructor(notNull(tc.lowlevelTC), ! new TypeParameters(content: Monotype.substitute(map, parameters)), loc); res.nullness = this.nullness; --- 194,198 ---- assert tc instanceof MonotypeConstructor; let res = createMonotypeConstructor(notNull(tc.lowlevelTC), ! new TypeParameters(content: parameters.mapToArray(Monotype t => t.substitute(map))), loc); res.nullness = this.nullness; *************** *** 211,216 **** String getAlikeID() = alike_id; ! public Monotype createAlike(List<Monotype> parameters, Location location) { ! return new Alike(parameters: Monotype.toArray(parameters), loc: location); } --- 211,216 ---- String getAlikeID() = alike_id; ! public Monotype createAlike(?List<Monotype> parameters, Location location) { ! return new Alike(parameters: parameters == null ? [] : parameters.toArray(), loc: location); } Index: niceMethod.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/niceMethod.nice,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** niceMethod.nice 11 Jan 2005 21:45:46 -0000 1.11 --- niceMethod.nice 12 Jan 2005 18:50:38 -0000 1.12 *************** *** 293,297 **** thisType = Monotype.create ! (Monotype.sure (new mlsub.typing.MonotypeConstructor (alikeTC, c.getTypeParameters()))); --- 293,297 ---- thisType = Monotype.create ! (sureMonotype (new mlsub.typing.MonotypeConstructor (alikeTC, c.getTypeParameters()))); Index: methodDeclaration.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/methodDeclaration.nice,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** methodDeclaration.nice 2 Jan 2005 02:20:59 -0000 1.1 --- methodDeclaration.nice 12 Jan 2005 18:50:37 -0000 1.2 *************** *** 15,23 **** import bossa.util.*; - //import mlsub.typing.*; - - //import gnu.bytecode.*; - //import gnu.expr.*; - /** Declaration of a method. --- 15,18 ---- Index: loop.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/loop.nice,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** loop.nice 20 Dec 2004 17:16:48 -0000 1.9 --- loop.nice 12 Jan 2005 18:50:37 -0000 1.10 *************** *** 137,141 **** itertype = createMonotypeConstructor(new TypeIdent(name: new LocatedString("Iterator", loc)), createTypeParameters(tparams), loc); ! notNull(itertype).nullness = Monotype.sure; } --- 137,141 ---- itertype = createMonotypeConstructor(new TypeIdent(name: new LocatedString("Iterator", loc)), createTypeParameters(tparams), loc); ! notNull(itertype).nullness = /*sure*/2; } Index: methodImplementation.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/methodImplementation.nice,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** methodImplementation.nice 11 Jan 2005 21:45:46 -0000 1.8 --- methodImplementation.nice 12 Jan 2005 18:50:37 -0000 1.9 *************** *** 71,75 **** type.setKind(notNull(v)); ! type = bossa.syntax.Monotype.sure(type); } else --- 71,75 ---- type.setKind(notNull(v)); ! type = sureMonotype(type); } else Index: enum.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/enum.nice,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** enum.nice 11 Jan 2005 21:45:46 -0000 1.11 --- enum.nice 12 Jan 2005 18:50:37 -0000 1.12 *************** *** 174,178 **** { Monotype type = new TypeIdent(name: enumName); ! type.nullness = Monotype.absent; List<Arguments.Argument> args = new ArrayList(2 + fields.size()); args.add(new Arguments.Argument(createStringConstantExp(name.toString()), --- 174,178 ---- { Monotype type = new TypeIdent(name: enumName); ! type.nullness = /*absent*/3; List<Arguments.Argument> args = new ArrayList(2 + fields.size()); args.add(new Arguments.Argument(createStringConstantExp(name.toString()), Index: tools.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/tools.nice,v retrieving revision 1.94 retrieving revision 1.95 diff -C2 -d -r1.94 -r1.95 *** tools.nice 11 Jan 2005 21:45:46 -0000 1.94 --- tools.nice 12 Jan 2005 18:50:38 -0000 1.95 *************** *** 51,58 **** mlsub.typing.Monotype makeSure(mlsub.typing.Monotype m) = ! notNull(bossa.syntax.Monotype.sure(nice.tools.typing.Types.rawType(m))); mlsub.typing.Monotype makeUnsure(mlsub.typing.Monotype m) = ! notNull(bossa.syntax.Monotype.maybe(nice.tools.typing.Types.rawType(m))); mlsub.typing.Monotype ensureMonomorphic(mlsub.typing.Polytype type, --- 51,64 ---- mlsub.typing.Monotype makeSure(mlsub.typing.Monotype m) = ! notNull(sureMonotype(nice.tools.typing.Types.rawType(m))); mlsub.typing.Monotype makeUnsure(mlsub.typing.Monotype m) = ! notNull(maybeMonotype(nice.tools.typing.Types.rawType(m))); ! ! mlsub.typing.Monotype sureMonotype(?mlsub.typing.Monotype type) = ! nice.tools.typing.Types.sureMonotype(type); ! ! mlsub.typing.Monotype maybeMonotype(?mlsub.typing.Monotype type) = ! nice.tools.typing.Types.maybeMonotype(type); mlsub.typing.Monotype ensureMonomorphic(mlsub.typing.Polytype type, *************** *** 121,125 **** try { ! return (sym, Monotype.sure(new mlsub.typing.MonotypeConstructor(tc, parameters))); } catch(BadSizeEx e) { return null; --- 127,131 ---- try { ! return (sym, sureMonotype(new mlsub.typing.MonotypeConstructor(tc, parameters))); } catch(BadSizeEx e) { return null; *************** *** 237,248 **** AST AST(List<Definition>, int) = native new AST(List, int); bossa.syntax.Monotype substitute(bossa.syntax.Monotype,Map<String,bossa.syntax.Monotype>) = native bossa.syntax.Monotype bossa.syntax.Monotype.substitute(Map); - List<bossa.syntax.Monotype> substitute(Map<String,bossa.syntax.Monotype>,Collection<bossa.syntax.Monotype>) = native List bossa.syntax.Monotype.substitute(Map,Collection); - boolean containsAlike(List<bossa.syntax.Monotype>) = native boolean bossa.syntax.Monotype.containsAlike(List); - mlsub.typing.Monotype[] rawResolve(TypeMap,Collection<bossa.syntax.Monotype>) = native mlsub.typing.Monotype[] bossa.syntax.Monotype.rawResolve(TypeMap, Collection); - boolean containsAlike(Monotype[]) = native boolean Monotype.containsAlike(Monotype[]); - bossa.syntax.Monotype[] substitute(Map<String,bossa.syntax.Monotype>,bossa.syntax.Monotype[]) = native bossa.syntax.Monotype[] bossa.syntax.Monotype.substitute(Map,bossa.syntax.Monotype[]); ?mlsub.typing.TypeSymbol lookup(TypeMap, LocatedString) = native mlsub.typing.TypeSymbol TypeMap.lookup(LocatedString); ?mlsub.typing.TypeSymbol lookup(TypeMap, String) = native mlsub.typing.TypeSymbol TypeMap.lookup(String); - Monotype[] Monotype_toArray(?List<Monotype>) = native Monotype[] Monotype.toArray(List); List<VarSymbol> lookup(VarScope, LocatedString) = native List VarScope.lookup(LocatedString); Map<gnu.bytecode.Type,mlsub.typing.TypeConstructor> javaTypeConstructors(bossa.modules.Compilation ) = native bossa.modules.Compilation.javaTypeConstructors; --- 243,248 ---- Index: importedconstructor.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/importedconstructor.nice,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** importedconstructor.nice 10 Jan 2005 23:58:04 -0000 1.9 --- importedconstructor.nice 12 Jan 2005 18:50:37 -0000 1.10 *************** *** 96,100 **** let classDef = def.getDefinition(); ! let returnType = Monotype.create(Monotype.sure (new mlsub.typing.MonotypeConstructor(classDef.getTC(), classDef.getTypeParameters()))); --- 96,100 ---- let classDef = def.getDefinition(); ! let returnType = Monotype.create(sureMonotype (new mlsub.typing.MonotypeConstructor(classDef.getTC(), classDef.getTypeParameters()))); Index: dispatch.java.bootstrap =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/dispatch.java.bootstrap,v retrieving revision 1.50 retrieving revision 1.51 diff -C2 -d -r1.50 -r1.51 *** dispatch.java.bootstrap 4 Jan 2005 21:20:39 -0000 1.50 --- dispatch.java.bootstrap 12 Jan 2005 18:50:37 -0000 1.51 *************** *** 34,40 **** { return null; } - public static Monotype createTypeIdent(LocatedString name) - { return null;} - public static void resetTypeDefinitionMappings() {} --- 34,37 ---- |
From: Arjan B. <ar...@us...> - 2005-01-12 18:50:50
|
Update of /cvsroot/nice/Nice/src/nice/tools/typing In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31378/F:/nice/src/nice/tools/typing Modified Files: Types.java Log Message: Cleanup and preparation for Monotype conversion. Index: Types.java =================================================================== RCS file: /cvsroot/nice/Nice/src/nice/tools/typing/Types.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** Types.java 1 Dec 2004 02:43:53 -0000 1.11 --- Types.java 12 Jan 2005 18:50:35 -0000 1.12 *************** *** 117,120 **** --- 117,126 ---- } + public static mlsub.typing.Monotype maybeMonotype(mlsub.typing.Monotype type) + { + return new mlsub.typing.MonotypeConstructor + (PrimitiveType.maybeTC, new mlsub.typing.Monotype[]{type}); + } + /**************************************************************** * Functional types |