[Nice-commit] Nice/src/bossa/syntax LocatedString.java,1.19,1.20 alternative.nice,1.6,1.7 analyse.ni
Brought to you by:
bonniot
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"); |