[Nice-commit] Nice/src/bossa/syntax NiceMethod.java,1.38,1.39 FormalParameters.java,1.37,1.38 Constr
Brought to you by:
bonniot
From: Daniel B. <bo...@us...> - 2004-06-16 14:56:24
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12590/src/bossa/syntax Modified Files: NiceMethod.java FormalParameters.java Constraint.java AtomicConstraint.java Log Message: Simplification and optimization of the scope building phase. Index: FormalParameters.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/FormalParameters.java,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** FormalParameters.java 5 Feb 2004 23:55:16 -0000 1.37 --- FormalParameters.java 16 Jun 2004 14:56:14 -0000 1.38 *************** *** 32,38 **** An anonymous formal parameter. */ ! public static class Parameter extends Node { ! public Parameter(Monotype type) { super(Node.down); this.type = type; } Monotype type; --- 32,38 ---- An anonymous formal parameter. */ ! public static class Parameter { ! public Parameter(Monotype type) { this.type = type; } Monotype type; *************** *** 54,58 **** boolean isOverriden() { return false; } ! void resolve() { if (symbol != null) --- 54,58 ---- boolean isOverriden() { return false; } ! void resolve(VarScope scope, TypeScope typeScope) { if (symbol != null) *************** *** 226,234 **** } ! void resolve() { defaultValue = dispatch.analyse(defaultValue, scope, typeScope); defaultValue = defaultValue.noOverloading(); ! super.resolve(); } --- 226,234 ---- } ! void resolve(VarScope scope, TypeScope typeScope) { defaultValue = dispatch.analyse(defaultValue, scope, typeScope); defaultValue = defaultValue.noOverloading(); ! super.resolve(scope, typeScope); } *************** *** 237,241 **** defaultValue = dispatch.analyse(defaultValue, info); defaultValue = defaultValue.noOverloading(); ! super.resolve(); } --- 237,241 ---- defaultValue = dispatch.analyse(defaultValue, info); defaultValue = defaultValue.noOverloading(); ! super.resolve(null, null); } *************** *** 267,271 **** public FormalParameters(java.util.List parameters) { ! super(Node.down); if (parameters == null) --- 267,271 ---- public FormalParameters(java.util.List parameters) { ! super(Node.none); if (parameters == null) *************** *** 275,287 **** (Parameter[]) parameters.toArray(new Parameter[parameters.size()]); this.size = this.parameters.length; - - for (int i = 0; i < size; i++) - if (this.parameters[i] != null) - addChild(this.parameters[i]); } FormalParameters(Parameter[] parameters) { ! super(Node.down); if (parameters == null) --- 275,283 ---- (Parameter[]) parameters.toArray(new Parameter[parameters.size()]); this.size = this.parameters.length; } FormalParameters(Parameter[] parameters) { ! super(Node.none); if (parameters == null) *************** *** 290,297 **** this.parameters = parameters; this.size = parameters.length; - - for (int i = 0; i < size; i++) - if (parameters[i] != null) - addChild(parameters[i]); } --- 286,289 ---- *************** *** 302,308 **** parameters[0] = new NamedParameter(type, thisName); - // We need to add it as the first child, because the order - // is used when refering to previous parameters inside default values. - addFirstChild(parameters[0]); } --- 294,297 ---- *************** *** 379,385 **** } ! void doResolve() { ! super.doResolve(); for (int i = 0; i<size; i++) --- 368,375 ---- } ! void resolve() { ! for (int i = 0; i<size; i++) ! parameters[i].resolve(scope, typeScope); for (int i = 0; i<size; i++) Index: AtomicConstraint.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/AtomicConstraint.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** AtomicConstraint.java 15 Nov 2003 12:26:32 -0000 1.12 --- AtomicConstraint.java 16 Jun 2004 14:56:14 -0000 1.13 *************** *** 24,34 **** @author Daniel Bonniot (d.b...@ma...) */ ! public abstract class AtomicConstraint extends Node { - AtomicConstraint() - { - super(Node.down); - } - /**************************************************************** * Scoping --- 24,29 ---- @author Daniel Bonniot (d.b...@ma...) */ ! public abstract class AtomicConstraint { /**************************************************************** * Scoping Index: Constraint.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/Constraint.java,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** Constraint.java 24 Feb 2004 15:50:19 -0000 1.39 --- Constraint.java 16 Jun 2004 14:56:14 -0000 1.40 *************** *** 69,80 **** { if(binders==null) ! binders = noBinders; else addTypeSymbols(binders); this.binders = binders; - this.atomics = addChildren(atomics); - } ! private static final List noBinders = new ArrayList(0); /** --- 69,82 ---- { if(binders==null) ! binders = Collections.EMPTY_LIST; else addTypeSymbols(binders); this.binders = binders; ! if (atomics == null) ! this.atomics = Collections.EMPTY_LIST; ! else ! this.atomics = atomics; ! } /** *************** *** 214,218 **** { // avoid the modification of the shared empty list ! if (binders == noBinders) binders = new ArrayList(4); --- 216,220 ---- { // avoid the modification of the shared empty list ! if (binders == Collections.EMPTY_LIST) binders = new ArrayList(4); *************** *** 227,231 **** { // avoid the modification of the shared empty list ! if (binders == noBinders) binders = new ArrayList(4); --- 229,233 ---- { // avoid the modification of the shared empty list ! if (binders == Collections.EMPTY_LIST) binders = new ArrayList(4); Index: NiceMethod.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/NiceMethod.java,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** NiceMethod.java 26 Mar 2004 10:48:41 -0000 1.38 --- NiceMethod.java 16 Jun 2004 14:56:14 -0000 1.39 *************** *** 161,165 **** homonyms = Node.getGlobalScope().lookup(getName()); ! homonyms.remove(getSymbol()); } --- 161,168 ---- homonyms = Node.getGlobalScope().lookup(getName()); ! if (homonyms.size() == 1) ! homonyms = null; ! else ! homonyms.remove(getSymbol()); } *************** *** 201,207 **** public boolean specializesMethods() { - //if (homonyms != null) - //throw new Error(this.toString()); - return specializedMethods != null; } --- 204,207 ---- *************** *** 209,217 **** void findSpecializedMethods() { ! if (homonyms.isEmpty()) ! { ! homonyms = null; ! return; ! } Domain ourDomain = Types.domain(getType()); --- 209,214 ---- void findSpecializedMethods() { ! if (homonyms == null) ! return; Domain ourDomain = Types.domain(getType()); |